Merged some older revisions which seemed to be missing, namely 3986-4057 from trunk
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4490 dfc29bdd-3216-0410-991c-e03cc46cb475master
18
changes.txt
|
@ -641,7 +641,7 @@ Changes in 1.7.4 (not yet released)
|
|||
- Yield on Linux now uses nanosleep with 1ns as 0 isn't guaranteed to yield (thx @ hendu for finding + fix)
|
||||
|
||||
-----------------------------
|
||||
Changes in 1.7.3 (??.??.2011)
|
||||
Changes in 1.7.3 (20.02.2012)
|
||||
|
||||
- SceneNodeAnimatorFlyCircle fixes serialization of RadiusEllipsoid (was writing Radius). Thx @ wing64 for reporting.
|
||||
|
||||
|
@ -683,14 +683,20 @@ Changes in 1.7.3 (??.??.2011)
|
|||
|
||||
- Fix crash in editbox when scrolling up with empty first lines caused by textwrapping.
|
||||
|
||||
- triangle3d::isPointInside can now work with larger integers, old version failed already with values in the 3-digit range. It got also faster. (thx @ Eigen for report + testcase and REDDemon for patch proposal).
|
||||
- Fix endianess conversions
|
||||
|
||||
- Changes to isPointInside
|
||||
|
||||
- Fix focus problem when removing an unfocused modal dialog reported by Reiko here: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=44358
|
||||
|
||||
- Fix md2 normals problem again
|
||||
|
||||
- Add integer template specialization for vector3d::getSphericalCoordinateAngles which rounds angles to nearest integer now.
|
||||
|
||||
- Recalculate FrameRect and ScrollPos in CGUIEditBox when AbsoluteRect gets changed (thx @ serengeor for report + testcase)
|
||||
|
||||
- Fix crash in editbox
|
||||
|
||||
- Fix 'k' in bigfont.png (thx @ Scrappi for reporting)
|
||||
|
||||
- fix serialization for CBillboardSceneNode, it had missed 2 color (thx for finding + patch from pc0de)
|
||||
|
@ -701,6 +707,10 @@ Changes in 1.7.3 (??.??.2011)
|
|||
|
||||
- Fix crash in collada (.dae) loading
|
||||
|
||||
- Fix bug handling in case RTT is not properly created
|
||||
|
||||
- Fix SColorf interpolation
|
||||
|
||||
- Fix memory-leaks in example 22 MaterialViewer
|
||||
|
||||
- Fix array::erase which did destroy objects more than once when used with a range (thx @ RedDragCZ for reporting + testcase).
|
||||
|
@ -711,6 +721,8 @@ Changes in 1.7.3 (??.??.2011)
|
|||
|
||||
- CGUIScrollBar passes unused mousemove-events now to parent element. Fixes focus-bug in ComboBox reported by REDDemon here: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=43474&highlight=
|
||||
|
||||
- Fix getAngle and getAngleWith
|
||||
|
||||
- Fix clipping in CGUITabControl
|
||||
|
||||
- Fix clipping in CGUITable, reported by ceyron
|
||||
|
@ -1953,6 +1965,8 @@ Changes in version 1.5 (15.12.2008)
|
|||
|
||||
- Fixed LMTS problems with extra data in files.
|
||||
|
||||
- Removed VS6 .dsw / .dsp project files - VS6 is no longer supported.
|
||||
|
||||
- Particles can be scaled during animations. Particle scaling needs to happen in the emitter now, instead of in the Particle system scene node. Deprecation methods will guide the user.
|
||||
|
||||
- ISceneNode::setParent and addChild now updates node SceneManager pointers if the node was from another SceneManager.
|
||||
|
|
|
@ -136,7 +136,11 @@ public:
|
|||
|
||||
case GUI_ID_FILE_OPEN_BUTTON:
|
||||
Context.listbox->addItem(L"File open");
|
||||
env->addFileOpenDialog(L"Please choose a file.");
|
||||
// There are some options for the file open dialog
|
||||
// We set the title, make it a modal window, and make sure
|
||||
// that the working directory is restored after the dialog
|
||||
// is finished.
|
||||
env->addFileOpenDialog(L"Please choose a file.", true, 0, -1, true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -144,6 +148,15 @@ public:
|
|||
}
|
||||
break;
|
||||
|
||||
case EGET_FILE_SELECTED:
|
||||
{
|
||||
// show the model filename, selected in the file dialog
|
||||
IGUIFileOpenDialog* dialog =
|
||||
(IGUIFileOpenDialog*)event.GUIEvent.Caller;
|
||||
Context.listbox->addItem(dialog->getFileName());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -147,8 +147,7 @@ void updateScaleInfo(scene::ISceneNode* model)
|
|||
}
|
||||
|
||||
/*
|
||||
The three following functions do several stuff used by the mesh viewer. The
|
||||
first function showAboutText() simply displays a messagebox with a caption and
|
||||
Function showAboutText() displays a messagebox with a caption and
|
||||
a message text. The texts will be stored in the MessageText and Caption
|
||||
variables at startup.
|
||||
*/
|
||||
|
@ -162,7 +161,7 @@ void showAboutText()
|
|||
|
||||
|
||||
/*
|
||||
The second function loadModel() loads a model and displays it using an
|
||||
Function loadModel() loads a model and displays it using an
|
||||
addAnimatedMeshSceneNode and the scene manager. Nothing difficult. It also
|
||||
displays a short message box, if the model could not be loaded.
|
||||
*/
|
||||
|
@ -259,7 +258,7 @@ void loadModel(const c8* fn)
|
|||
|
||||
|
||||
/*
|
||||
Finally, the third function creates a toolbox window. In this simple mesh
|
||||
Function createToolBox() creates a toolbox window. In this simple mesh
|
||||
viewer, this toolbox only contains a tab control with three edit boxes for
|
||||
changing the scale of the displayed model.
|
||||
*/
|
||||
|
@ -323,6 +322,10 @@ void createToolBox()
|
|||
scrollbar->setSmallStep(1);
|
||||
}
|
||||
|
||||
/*
|
||||
Function updateToolBox() is called each frame to update dynamic information in
|
||||
the toolbox.
|
||||
*/
|
||||
void updateToolBox()
|
||||
{
|
||||
IGUIEnvironment* env = Device->getGUIEnvironment();
|
||||
|
@ -397,7 +400,7 @@ bool hasModalDialog()
|
|||
To get all the events sent by the GUI Elements, we need to create an event
|
||||
receiver. This one is really simple. If an event occurs, it checks the id of
|
||||
the caller and the event type, and starts an action based on these values. For
|
||||
example, if a menu item with id GUI_ID_OPEN_MODEL was selected, if opens a file-open-dialog.
|
||||
example, if a menu item with id GUI_ID_OPEN_MODEL was selected, it opens a file-open-dialog.
|
||||
*/
|
||||
class MyEventReceiver : public IEventReceiver
|
||||
{
|
||||
|
@ -521,6 +524,11 @@ public:
|
|||
*/
|
||||
bool OnKeyUp(irr::EKEY_CODE keyCode)
|
||||
{
|
||||
// Don't handle keys if we have a modal dialog open as it would lead
|
||||
// to unexpected application behaviour for the user.
|
||||
if ( hasModalDialog() )
|
||||
return false;
|
||||
|
||||
if (keyCode == irr::KEY_ESCAPE)
|
||||
{
|
||||
if (Device)
|
||||
|
|
|
@ -376,7 +376,7 @@ int main()
|
|||
anim->drop();
|
||||
|
||||
// attach billboard to the light
|
||||
scene::ISceneNode* bill =
|
||||
scene::IBillboardSceneNode* bill =
|
||||
smgr->addBillboardSceneNode(light1, core::dimension2d<f32>(60, 60));
|
||||
|
||||
bill->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
|
|
@ -783,7 +783,7 @@ funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename)
|
|||
#endif
|
||||
|
||||
/*
|
||||
get the current collision respone camera animator
|
||||
get the current collision response camera animator
|
||||
*/
|
||||
ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device )
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/** Example 024 Cursor Control
|
||||
/** Example 024 CursorControl
|
||||
|
||||
Show how to modify cursors and offer some useful tool-functions for creating cursors.
|
||||
It can also be used for experiments with the mouse in general.
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
/** Example 025 Xml Handling
|
||||
*
|
||||
* Demonstrates loading and saving of configurations via XML
|
||||
* @author Y.M. Bosman <yoran.bosman@gmail.com>
|
||||
*/
|
||||
|
||||
Demonstrates loading and saving of configurations via XML
|
||||
|
||||
@author Y.M. Bosman \<yoran.bosman@gmail.com\>
|
||||
|
||||
This demo features a fully usable system for configuration handling. The code
|
||||
can easily be intergrated into own apps.
|
||||
|
||||
*/
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
|
@ -18,24 +23,20 @@ using namespace gui;
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* SettingManager class
|
||||
* This class loads and writes the settings
|
||||
* and manages the options.
|
||||
*
|
||||
*
|
||||
* The class makes use of irrMap which is a an associative arrays using a red-black tree
|
||||
* it allows easy mapping of a key to a value, along the way there is some information on how to use it
|
||||
*
|
||||
*/
|
||||
/* SettingManager class.
|
||||
|
||||
This class loads and writes the settings and manages the options.
|
||||
|
||||
The class makes use of irrMap which is a an associative arrays using a
|
||||
red-black tree it allows easy mapping of a key to a value, along the way there
|
||||
is some information on how to use it.
|
||||
*/
|
||||
|
||||
class SettingManager
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct setting managers and set default settings
|
||||
*/
|
||||
// Construct setting managers and set default settings
|
||||
SettingManager(const stringw& settings_file): SettingsFile(settings_file), NullDevice(0)
|
||||
{
|
||||
// Irrlicht null device, we want to load settings before we actually created our device, therefore, nulldevice
|
||||
|
@ -59,10 +60,9 @@ public:
|
|||
SettingMap.insert(L"fullscreen", L"0"); //0 is false
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor, you could store settings automatically on exit of your application if you wanted to
|
||||
* in our case we simply drop the nulldevice
|
||||
*/
|
||||
// Destructor, you could store settings automatically on exit of your
|
||||
// application if you wanted to in our case we simply drop the
|
||||
// nulldevice
|
||||
~SettingManager()
|
||||
{
|
||||
if (NullDevice)
|
||||
|
@ -72,20 +72,21 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Load xml from disk, overwrite default settings
|
||||
* The xml we are trying to load has the following structure
|
||||
* settings nested in sections nested in the root node, like so
|
||||
*
|
||||
* <?xml version="1.0"?>
|
||||
* <mygame>
|
||||
* <video>
|
||||
* <setting name="driver" value="Direct3D9" />
|
||||
* <setting name="fullscreen" value="0" />
|
||||
* <setting name="resolution" value="1024x768" />
|
||||
* </video>
|
||||
* </mygame>
|
||||
*/
|
||||
/*
|
||||
Load xml from disk, overwrite default settings
|
||||
The xml we are trying to load has the following structure
|
||||
settings nested in sections nested in the root node, like so
|
||||
<pre>
|
||||
<?xml version="1.0"?>
|
||||
<mygame>
|
||||
<video>
|
||||
<setting name="driver" value="Direct3D9" />
|
||||
<setting name="fullscreen" value="0" />
|
||||
<setting name="resolution" value="1024x768" />
|
||||
</video>
|
||||
</mygame>
|
||||
</pre>
|
||||
*/
|
||||
bool load()
|
||||
{
|
||||
//if not able to create device dont attempt to load
|
||||
|
@ -149,10 +150,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the xml to disk
|
||||
* We use the nulldevice
|
||||
*/
|
||||
// Save the xml to disk. We use the nulldevice.
|
||||
bool save()
|
||||
{
|
||||
|
||||
|
@ -206,27 +204,19 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set setting in our manager
|
||||
*/
|
||||
// Set setting in our manager
|
||||
void setSetting(const stringw& name, const stringw& value)
|
||||
{
|
||||
SettingMap[name]=value;
|
||||
}
|
||||
|
||||
/**
|
||||
* set setting overload to quickly assign integers to our setting map
|
||||
*/
|
||||
// set setting overload to quickly assign integers to our setting map
|
||||
void setSetting(const stringw& name, s32 value)
|
||||
{
|
||||
SettingMap[name]=stringw(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting as string
|
||||
* @param key Name of setting
|
||||
* @return Empty string if the settings is not found, else value of the setting
|
||||
*/
|
||||
// Get setting as string
|
||||
stringw getSetting(const stringw& key) const
|
||||
{
|
||||
//the find function or irrmap returns a pointer to a map Node
|
||||
|
@ -239,11 +229,7 @@ public:
|
|||
return L"";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting as bool
|
||||
* @param key Name of setting
|
||||
* @return False if the key cannot be found, else true if the setting == 1
|
||||
*/
|
||||
//
|
||||
bool getSettingAsBoolean(const stringw& key ) const
|
||||
{
|
||||
stringw s = getSetting(key);
|
||||
|
@ -252,11 +238,7 @@ public:
|
|||
return s.equals_ignore_case(L"1");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get setting as integer NOTE: function is not used in example but provided for completeness
|
||||
* @param key name of setting
|
||||
* @return 0 if the key cannot be found, else the setting converted to an integer
|
||||
*/
|
||||
//
|
||||
s32 getSettingAsInteger(const stringw& key) const
|
||||
{
|
||||
//we implicitly cast to string instead of stringw because strtol10 does not accept wide strings
|
||||
|
@ -280,9 +262,9 @@ private:
|
|||
irr::IrrlichtDevice* NullDevice;
|
||||
};
|
||||
|
||||
/**
|
||||
* Application context for global variables
|
||||
*/
|
||||
/*
|
||||
Application context for global variables
|
||||
*/
|
||||
struct SAppContext
|
||||
{
|
||||
SAppContext()
|
||||
|
@ -372,10 +354,10 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function to create a video settings dialog
|
||||
* This dialog shows the current settings from the configuration xml and allows them to be changed
|
||||
*/
|
||||
/*
|
||||
Function to create a video settings dialog
|
||||
This dialog shows the current settings from the configuration xml and allows them to be changed
|
||||
*/
|
||||
void createSettingsDialog(SAppContext& app)
|
||||
{
|
||||
// first get rid of alpha in gui
|
||||
|
@ -431,6 +413,9 @@ void createSettingsDialog(SAppContext& app)
|
|||
L"Cancel and exit");
|
||||
}
|
||||
|
||||
/*
|
||||
The main function. Creates all objects and does the XML handling.
|
||||
*/
|
||||
int main()
|
||||
{
|
||||
//create new application context
|
||||
|
@ -441,11 +426,9 @@ int main()
|
|||
param.DriverType = EDT_SOFTWARE;
|
||||
param.WindowSize.set(640,480);
|
||||
|
||||
/**
|
||||
* Try to load config.
|
||||
* I leave it as an exercise of the reader to store the configuration in the local application data folder,
|
||||
* the only logical place to store config data for games. For all other operating systems I redirect to your manuals
|
||||
*/
|
||||
// Try to load config.
|
||||
// I leave it as an exercise of the reader to store the configuration in the local application data folder,
|
||||
// the only logical place to store config data for games. For all other operating systems I redirect to your manuals
|
||||
app.Settings = new SettingManager("../../media/settings.xml");
|
||||
if ( !app.Settings->load() )
|
||||
{
|
||||
|
@ -518,3 +501,5 @@ int main()
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
**/
|
||||
|
|
|
@ -540,12 +540,7 @@ void CDemo::loadSceneData()
|
|||
campFire->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
campFire->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
|
||||
campFire->setMaterialTexture(0, driver->getTexture("../../media/fireball.bmp"));
|
||||
campFire->setMaterialType(video::EMT_ONETEXTURE_BLEND);
|
||||
campFire->getMaterial(0).MaterialTypeParam=
|
||||
video::pack_textureBlendFunc(video::EBF_ONE,
|
||||
video::EBF_ONE_MINUS_SRC_ALPHA,
|
||||
video::EMFN_MODULATE_1X,
|
||||
video::EAS_VERTEX_COLOR);
|
||||
campFire->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
|
||||
|
||||
// load music
|
||||
|
||||
|
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 11 KiB |
|
@ -90,9 +90,10 @@ The Irrlicht Engine SDK version 1.8
|
|||
|
||||
* Linux:
|
||||
* Needed: XServer with include files
|
||||
* Optional: OpenGL headers and libraries (libGL.so), for OpenGL support
|
||||
* GLX + XF86VidMode or XRandr extension (X11 support libraries,
|
||||
the latter two for fullscreen mode)
|
||||
* Optional: OpenGL headers and libraries (libGL.so) for OpenGL support
|
||||
GLX +
|
||||
XF86VidMode [package x11proto-xf86vidmode-dev] or XRandr
|
||||
(X11 support libraries, the latter two for fullscreen mode)
|
||||
|
||||
* OSX:
|
||||
* Needed: XCode and Cocoa framework
|
||||
|
|
|
@ -1,314 +0,0 @@
|
|||
table.irrlicht {
|
||||
width: 100%;
|
||||
background-color: #9395C1;
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border-spacing: 4px 2px;
|
||||
border-color: #b0b0b0;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
table.memname {
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #b0b0b0;
|
||||
}
|
||||
|
||||
BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
|
||||
font-family: Geneva, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
BODY,TD {
|
||||
font-size: 90%;
|
||||
}
|
||||
H1 {
|
||||
text-align: center;
|
||||
font-size: 160%;
|
||||
}
|
||||
H2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
H3 {
|
||||
font-size: 110%;
|
||||
}
|
||||
CAPTION { font-weight: bold }
|
||||
DIV.qindex {
|
||||
width: 100%;
|
||||
background-color: #eeeeff;
|
||||
border: 1px solid #b0b0b0;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
DIV.nav {
|
||||
width: 100%;
|
||||
background-color: #eeeeff;
|
||||
border: 1px solid #b0b0b0;
|
||||
text-align: center;
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
line-height: 140%;
|
||||
}
|
||||
A.qindex {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1A419D;
|
||||
}
|
||||
A.qindex:visited {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #1A419D
|
||||
}
|
||||
A.qindex:hover {
|
||||
text-decoration: none;
|
||||
background-color: #ddddff;
|
||||
}
|
||||
A.qindexHL {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
border: 1px double #9295C2;
|
||||
}
|
||||
A.qindexHL:hover {
|
||||
text-decoration: none;
|
||||
background-color: #6666cc;
|
||||
color: #ffffff;
|
||||
}
|
||||
A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
|
||||
A.el { text-decoration: none; font-weight: bold }
|
||||
A.elRef { font-weight: bold }
|
||||
A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
|
||||
A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
|
||||
A.codeRef:link { font-weight: normal; color: #0000FF}
|
||||
A.codeRef:visited { font-weight: normal; color: #0000FF}
|
||||
A:hover { text-decoration: none; background-color: #f2f2ff }
|
||||
DL.el { margin-left: -1cm }
|
||||
.fragment {
|
||||
font-family: monospace
|
||||
}
|
||||
PRE.fragment {
|
||||
border: 1px solid #CCCCCC;
|
||||
background-color: #f5f5f5;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-left: 2px;
|
||||
margin-right: 8px;
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
|
||||
TD.md { background-color: #F4F4FB; font-weight: bold; }
|
||||
TD.mdPrefix {
|
||||
background-color: #F4F4FB;
|
||||
color: #606060;
|
||||
font-size: 80%;
|
||||
}
|
||||
TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; }
|
||||
TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; }
|
||||
DIV.groupHeader {
|
||||
margin-left: 16px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
|
||||
BODY {
|
||||
background: white;
|
||||
color: black;
|
||||
margin-right: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
TD.indexkey {
|
||||
background-color: #eeeeff;
|
||||
font-weight: bold;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
TD.indexvalue {
|
||||
background-color: #eeeeff;
|
||||
font-style: italic;
|
||||
padding-right : 10px;
|
||||
padding-top : 2px;
|
||||
padding-left : 10px;
|
||||
padding-bottom : 2px;
|
||||
margin-left : 0px;
|
||||
margin-right : 0px;
|
||||
margin-top : 2px;
|
||||
margin-bottom : 2px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
TR.memlist {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
P.formulaDsp { text-align: center; }
|
||||
IMG.formulaDsp { }
|
||||
IMG.formulaInl { vertical-align: middle; }
|
||||
SPAN.keyword { color: #008000 }
|
||||
SPAN.keywordtype { color: #604020 }
|
||||
SPAN.keywordflow { color: #e08000 }
|
||||
SPAN.comment { color: #800000 }
|
||||
SPAN.preprocessor { color: #806020 }
|
||||
SPAN.stringliteral { color: #002080 }
|
||||
SPAN.charliteral { color: #008080 }
|
||||
.mdTable {
|
||||
border: 1px solid #868686;
|
||||
background-color: #F4F4FB;
|
||||
}
|
||||
.mdRow {
|
||||
padding: 8px 10px;
|
||||
}
|
||||
.mdescLeft {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.mdescRight {
|
||||
padding: 0px 8px 4px 8px;
|
||||
font-size: 80%;
|
||||
font-style: italic;
|
||||
background-color: #FAFAFA;
|
||||
border-top: 1px none #E0E0E0;
|
||||
border-right: 1px none #E0E0E0;
|
||||
border-bottom: 1px none #E0E0E0;
|
||||
border-left: 1px none #E0E0E0;
|
||||
margin: 0px;
|
||||
}
|
||||
.memItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemLeft {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplItemRight {
|
||||
padding: 1px 8px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: none;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.memTemplParams {
|
||||
padding: 1px 0px 0px 8px;
|
||||
margin: 4px;
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-color: #E0E0E0;
|
||||
border-right-color: #E0E0E0;
|
||||
border-bottom-color: #E0E0E0;
|
||||
border-left-color: #E0E0E0;
|
||||
border-top-style: solid;
|
||||
border-right-style: none;
|
||||
border-bottom-style: none;
|
||||
border-left-style: none;
|
||||
color: #606060;
|
||||
background-color: #FAFAFA;
|
||||
font-size: 80%;
|
||||
}
|
||||
.search { color: #003399;
|
||||
font-weight: bold;
|
||||
}
|
||||
FORM.search {
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
INPUT.search { font-size: 75%;
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
background-color: #eeeeff;
|
||||
}
|
||||
TD.tiny { font-size: 75%;
|
||||
}
|
||||
a {
|
||||
color: #252E78;
|
||||
}
|
||||
a:visited {
|
||||
color: #3D2185;
|
||||
}
|
||||
.dirtab { padding: 4px;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #b0b0b0;
|
||||
}
|
||||
TH.dirtab { background: #eeeeff;
|
||||
font-weight: bold;
|
||||
}
|
||||
HR { height: 1px;
|
||||
border: none;
|
||||
border-top: 1px solid black;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
||||
<title>$title</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head><body>
|
||||
<table class="irrlicht" >
|
||||
<tr valign="middle">
|
||||
<td><font size="2"><a class="qindex" href="index.html"><font color="#FFFFFF">Home</font></a>
|
||||
| <a class="qindex" href="namespaces.html"><font color="#FFFFFF">Namespaces</font></a>
|
||||
| <a class="qindex" href="hierarchy.html"><font color="#FFFFFF">Hierarchy</font></a>
|
||||
| <a class="qindex" href="classes.html"><font color="#FFFFFF">Alphabetical
|
||||
List</font></a> | <a class="qindex" href="annotated.html"><font color="#FFFFFF">
|
||||
Class list</font></a> | <a class="qindex" href="files.html"><font color="#FFFFFF">Files</font></a>
|
||||
| <a class="qindex" href="namespacemembers.html"><font color="#FFFFFF">
|
||||
Namespace Members</font></a> | <a class="qindex" href="functions.html"><font color="#FFFFFF">Class
|
||||
members</font></a> | <a class="qindex" href="globals.html"><font color="#FFFFFF">File
|
||||
members</font></a> | <a class="qindex" href="pages.html"><font color="#FFFFFF">Tutorials</font></a></font> </td>
|
||||
</tr>
|
||||
</table>
|
After Width: | Height: | Size: 12 KiB |
|
@ -31,6 +31,9 @@ rem for /F %%i in ('dir ..\..\..\examples\[01]*\main.cpp') DO ..\sed.exe -f tuto
|
|||
..\sed.exe -f tutorials.sed ..\..\..\examples\21.Quake3Explorer\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\22.MaterialViewer\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\23.SMeshHandling\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\24.CursorControl\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\25.XmlHandling\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\26.OcclusionQuery\main.cpp >>tut.txt
|
||||
|
||||
:SKIP_TUTS
|
||||
|
||||
|
|
|
@ -361,6 +361,8 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
|
|||
if (Driver->testGLError())
|
||||
os::Printer::log("Could not bind Texture", ELL_ERROR);
|
||||
|
||||
bool mipmapLegacyMode = true;
|
||||
|
||||
// mipmap handling for main texture
|
||||
if (!level && newTexture)
|
||||
{
|
||||
|
@ -482,6 +484,17 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
|
|||
}
|
||||
}
|
||||
|
||||
if (!mipmapLegacyMode)
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
Driver->extGlGenerateMipmap(GL_TEXTURE_2D);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
AutomaticMipmapUpdate=true;
|
||||
}
|
||||
|
||||
if (Driver->testGLError())
|
||||
os::Printer::log("Could not glTexImage2D", ELL_ERROR);
|
||||
}
|
||||
|
|
|
@ -234,21 +234,21 @@ namespace irr
|
|||
void postKeyEvent(void *event, irr::SEvent &ievent, bool pressed);
|
||||
void pollJoysticks();
|
||||
|
||||
NSWindow *Window;
|
||||
CGLContextObj CGLContext;
|
||||
NSOpenGLContext *OGLContext;
|
||||
int DeviceWidth,
|
||||
DeviceHeight;
|
||||
std::map<int,int> KeyCodes;
|
||||
int ScreenWidth,
|
||||
ScreenHeight;
|
||||
bool IsActive;
|
||||
NSBitmapImageRep *SoftwareDriverTarget;
|
||||
bool IsSoftwareRenderer,
|
||||
IsShiftDown,
|
||||
IsControlDown,
|
||||
IsResizable;
|
||||
u32 MouseButtonStates;
|
||||
NSWindow *Window;
|
||||
CGLContextObj CGLContext;
|
||||
NSOpenGLContext *OGLContext;
|
||||
NSBitmapImageRep *SoftwareDriverTarget;
|
||||
std::map<int,int> KeyCodes;
|
||||
int DeviceWidth;
|
||||
int DeviceHeight;
|
||||
int ScreenWidth;
|
||||
int ScreenHeight;
|
||||
u32 MouseButtonStates;
|
||||
bool IsActive;
|
||||
bool IsSoftwareRenderer;
|
||||
bool IsShiftDown;
|
||||
bool IsControlDown;
|
||||
bool IsResizable;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -43,14 +43,153 @@
|
|||
#include <IOKit/hid/IOHIDLib.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
// Contents from Events.h from Carbon/HIToolbox but we need it with Cocoa too
|
||||
// and for some reason no Cocoa equivalent of these constants seems provided.
|
||||
// So I'm doing like everyone else and using copy-and-paste.
|
||||
|
||||
/*
|
||||
* Summary:
|
||||
* Virtual keycodes
|
||||
*
|
||||
* Discussion:
|
||||
* These constants are the virtual keycodes defined originally in
|
||||
* Inside Mac Volume V, pg. V-191. They identify physical keys on a
|
||||
* keyboard. Those constants with "ANSI" in the name are labeled
|
||||
* according to the key position on an ANSI-standard US keyboard.
|
||||
* For example, kVK_ANSI_A indicates the virtual keycode for the key
|
||||
* with the letter 'A' in the US keyboard layout. Other keyboard
|
||||
* layouts may have the 'A' key label on a different physical key;
|
||||
* in this case, pressing 'A' will generate a different virtual
|
||||
* keycode.
|
||||
*/
|
||||
enum {
|
||||
kVK_ANSI_A = 0x00,
|
||||
kVK_ANSI_S = 0x01,
|
||||
kVK_ANSI_D = 0x02,
|
||||
kVK_ANSI_F = 0x03,
|
||||
kVK_ANSI_H = 0x04,
|
||||
kVK_ANSI_G = 0x05,
|
||||
kVK_ANSI_Z = 0x06,
|
||||
kVK_ANSI_X = 0x07,
|
||||
kVK_ANSI_C = 0x08,
|
||||
kVK_ANSI_V = 0x09,
|
||||
kVK_ANSI_B = 0x0B,
|
||||
kVK_ANSI_Q = 0x0C,
|
||||
kVK_ANSI_W = 0x0D,
|
||||
kVK_ANSI_E = 0x0E,
|
||||
kVK_ANSI_R = 0x0F,
|
||||
kVK_ANSI_Y = 0x10,
|
||||
kVK_ANSI_T = 0x11,
|
||||
kVK_ANSI_1 = 0x12,
|
||||
kVK_ANSI_2 = 0x13,
|
||||
kVK_ANSI_3 = 0x14,
|
||||
kVK_ANSI_4 = 0x15,
|
||||
kVK_ANSI_6 = 0x16,
|
||||
kVK_ANSI_5 = 0x17,
|
||||
kVK_ANSI_Equal = 0x18,
|
||||
kVK_ANSI_9 = 0x19,
|
||||
kVK_ANSI_7 = 0x1A,
|
||||
kVK_ANSI_Minus = 0x1B,
|
||||
kVK_ANSI_8 = 0x1C,
|
||||
kVK_ANSI_0 = 0x1D,
|
||||
kVK_ANSI_RightBracket = 0x1E,
|
||||
kVK_ANSI_O = 0x1F,
|
||||
kVK_ANSI_U = 0x20,
|
||||
kVK_ANSI_LeftBracket = 0x21,
|
||||
kVK_ANSI_I = 0x22,
|
||||
kVK_ANSI_P = 0x23,
|
||||
kVK_ANSI_L = 0x25,
|
||||
kVK_ANSI_J = 0x26,
|
||||
kVK_ANSI_Quote = 0x27,
|
||||
kVK_ANSI_K = 0x28,
|
||||
kVK_ANSI_Semicolon = 0x29,
|
||||
kVK_ANSI_Backslash = 0x2A,
|
||||
kVK_ANSI_Comma = 0x2B,
|
||||
kVK_ANSI_Slash = 0x2C,
|
||||
kVK_ANSI_N = 0x2D,
|
||||
kVK_ANSI_M = 0x2E,
|
||||
kVK_ANSI_Period = 0x2F,
|
||||
kVK_ANSI_Grave = 0x32,
|
||||
kVK_ANSI_KeypadDecimal = 0x41,
|
||||
kVK_ANSI_KeypadMultiply = 0x43,
|
||||
kVK_ANSI_KeypadPlus = 0x45,
|
||||
kVK_ANSI_KeypadClear = 0x47,
|
||||
kVK_ANSI_KeypadDivide = 0x4B,
|
||||
kVK_ANSI_KeypadEnter = 0x4C,
|
||||
kVK_ANSI_KeypadMinus = 0x4E,
|
||||
kVK_ANSI_KeypadEquals = 0x51,
|
||||
kVK_ANSI_Keypad0 = 0x52,
|
||||
kVK_ANSI_Keypad1 = 0x53,
|
||||
kVK_ANSI_Keypad2 = 0x54,
|
||||
kVK_ANSI_Keypad3 = 0x55,
|
||||
kVK_ANSI_Keypad4 = 0x56,
|
||||
kVK_ANSI_Keypad5 = 0x57,
|
||||
kVK_ANSI_Keypad6 = 0x58,
|
||||
kVK_ANSI_Keypad7 = 0x59,
|
||||
kVK_ANSI_Keypad8 = 0x5B,
|
||||
kVK_ANSI_Keypad9 = 0x5C
|
||||
};
|
||||
|
||||
/* keycodes for keys that are independent of keyboard layout*/
|
||||
enum {
|
||||
kVK_Return = 0x24,
|
||||
kVK_Tab = 0x30,
|
||||
kVK_Space = 0x31,
|
||||
kVK_Delete = 0x33,
|
||||
kVK_Escape = 0x35,
|
||||
kVK_Command = 0x37,
|
||||
kVK_Shift = 0x38,
|
||||
kVK_CapsLock = 0x39,
|
||||
kVK_Option = 0x3A,
|
||||
kVK_Control = 0x3B,
|
||||
kVK_RightShift = 0x3C,
|
||||
kVK_RightOption = 0x3D,
|
||||
kVK_RightControl = 0x3E,
|
||||
kVK_Function = 0x3F,
|
||||
kVK_F17 = 0x40,
|
||||
kVK_VolumeUp = 0x48,
|
||||
kVK_VolumeDown = 0x49,
|
||||
kVK_Mute = 0x4A,
|
||||
kVK_F18 = 0x4F,
|
||||
kVK_F19 = 0x50,
|
||||
kVK_F20 = 0x5A,
|
||||
kVK_F5 = 0x60,
|
||||
kVK_F6 = 0x61,
|
||||
kVK_F7 = 0x62,
|
||||
kVK_F3 = 0x63,
|
||||
kVK_F8 = 0x64,
|
||||
kVK_F9 = 0x65,
|
||||
kVK_F11 = 0x67,
|
||||
kVK_F13 = 0x69,
|
||||
kVK_F16 = 0x6A,
|
||||
kVK_F14 = 0x6B,
|
||||
kVK_F10 = 0x6D,
|
||||
kVK_F12 = 0x6F,
|
||||
kVK_F15 = 0x71,
|
||||
kVK_Help = 0x72,
|
||||
kVK_Home = 0x73,
|
||||
kVK_PageUp = 0x74,
|
||||
kVK_ForwardDelete = 0x75,
|
||||
kVK_F4 = 0x76,
|
||||
kVK_End = 0x77,
|
||||
kVK_F2 = 0x78,
|
||||
kVK_PageDown = 0x79,
|
||||
kVK_F1 = 0x7A,
|
||||
kVK_LeftArrow = 0x7B,
|
||||
kVK_RightArrow = 0x7C,
|
||||
kVK_DownArrow = 0x7D,
|
||||
kVK_UpArrow = 0x7E
|
||||
};
|
||||
|
||||
|
||||
struct JoystickComponent
|
||||
{
|
||||
IOHIDElementCookie cookie; // unique value which identifies element, will NOT change
|
||||
long min; // reported min value possible
|
||||
long max; // reported max value possible
|
||||
IOHIDElementCookie cookie; // unique value which identifies element, will NOT change
|
||||
long min; // reported min value possible
|
||||
long max; // reported max value possible
|
||||
|
||||
long minRead; //min read value
|
||||
long maxRead; //max read value
|
||||
long minRead; //min read value
|
||||
long maxRead; //max read value
|
||||
|
||||
JoystickComponent() : min(0), minRead(0), max(0), maxRead(0)
|
||||
{
|
||||
|
@ -63,10 +202,9 @@ struct JoystickInfo
|
|||
irr::core::array <JoystickComponent> buttonComp;
|
||||
irr::core::array <JoystickComponent> hatComp;
|
||||
|
||||
int hats;
|
||||
int axes;
|
||||
int buttons;
|
||||
|
||||
int hats;
|
||||
int axes;
|
||||
int buttons;
|
||||
int numActiveJoysticks;
|
||||
|
||||
irr::SEvent persistentData;
|
||||
|
@ -74,8 +212,8 @@ struct JoystickInfo
|
|||
IOHIDDeviceInterface ** interface;
|
||||
bool removed;
|
||||
char joystickName[256];
|
||||
long usage; // usage page from IOUSBHID Parser.h which defines general usage
|
||||
long usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage
|
||||
long usage; // usage page from IOUSBHID Parser.h which defines general usage
|
||||
long usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage
|
||||
|
||||
JoystickInfo() : hats(0), axes(0), buttons(0), interface(0), removed(false), usage(0), usagePage(0), numActiveJoysticks(0)
|
||||
{
|
||||
|
@ -140,7 +278,6 @@ static void addJoystickComponent (CFTypeRef refElement, JoystickInfo* joyInfo)
|
|||
CFTypeRef refUsagePage = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementUsagePageKey));
|
||||
CFTypeRef refUsage = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementUsageKey));
|
||||
|
||||
|
||||
if ((refElementType) && (CFNumberGetValue ((CFNumberRef)refElementType, kCFNumberLongType, &elementType)))
|
||||
{
|
||||
/* look at types of interest */
|
||||
|
@ -211,7 +348,6 @@ static void addJoystickComponent (CFTypeRef refElement, JoystickInfo* joyInfo)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void getJoystickComponentArrayHandler (const void * value, void * parameter)
|
||||
|
@ -337,12 +473,14 @@ namespace irr
|
|||
{
|
||||
//! constructor
|
||||
CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
||||
: CIrrDeviceStub(param), Window(NULL), IsActive(true), OGLContext(NULL), CGLContext(NULL),
|
||||
SoftwareDriverTarget(0), IsSoftwareRenderer(false), IsResizable(false),
|
||||
IsShiftDown(false), IsControlDown(false), MouseButtonStates(0)
|
||||
: CIrrDeviceStub(param), Window(NULL), CGLContext(NULL), OGLContext(NULL),
|
||||
SoftwareDriverTarget(0), DeviceWidth(0), DeviceHeight(0),
|
||||
ScreenWidth(0), ScreenHeight(0), MouseButtonStates(0),
|
||||
IsActive(true), IsSoftwareRenderer(false),
|
||||
IsShiftDown(false), IsControlDown(false), IsResizable(false)
|
||||
{
|
||||
struct utsname name;
|
||||
NSString *path;
|
||||
NSString *path;
|
||||
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceMacOSX");
|
||||
|
@ -376,13 +514,14 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param)
|
|||
|
||||
bool success = true;
|
||||
if (CreationParams.DriverType != video::EDT_NULL)
|
||||
createWindow();
|
||||
success = createWindow();
|
||||
// in case of failure, one can check VideoDriver for initialization
|
||||
if (!success)
|
||||
return;
|
||||
|
||||
setResizable(false);
|
||||
|
||||
CursorControl = new CCursorControl(CreationParams.WindowSize, this);
|
||||
createDriver();
|
||||
|
||||
createGUIAndScene();
|
||||
}
|
||||
|
||||
|
@ -461,9 +600,11 @@ bool CIrrDeviceMacOSX::createWindow()
|
|||
|
||||
VideoModeList.setDesktop(CreationParams.Bits, core::dimension2d<u32>(ScreenWidth, ScreenHeight));
|
||||
|
||||
if (!CreationParams.Fullscreen)
|
||||
// we need to check where the exceptions may happen and work at them
|
||||
// for now we will just catch them to be able to avoid an app exit
|
||||
@try
|
||||
{
|
||||
if(!CreationParams.WindowId) //create another window when WindowId is null
|
||||
if (!CreationParams.Fullscreen)
|
||||
{
|
||||
const NSBackingStoreType type = (CreationParams.DriverType == video::EDT_OPENGL) ? NSBackingStoreBuffered : NSBackingStoreNonretained;
|
||||
int x = std::max(0, CreationParams.WindowPosition.X);
|
||||
|
@ -482,89 +623,94 @@ bool CIrrDeviceMacOSX::createWindow()
|
|||
{
|
||||
NSOpenGLPixelFormatAttribute windowattribs[] =
|
||||
{
|
||||
NSOpenGLPFANoRecovery,
|
||||
NSOpenGLPFAAccelerated,
|
||||
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)depthSize,
|
||||
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)CreationParams.Bits,
|
||||
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)alphaSize,
|
||||
NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
|
||||
NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias,
|
||||
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
(NSOpenGLPixelFormatAttribute)nil
|
||||
};
|
||||
|
||||
if (CreationParams.AntiAlias<2)
|
||||
{
|
||||
windowattribs[ 9] = (NSOpenGLPixelFormatAttribute)0;
|
||||
windowattribs[11] = (NSOpenGLPixelFormatAttribute)0;
|
||||
Window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask backing:NSBackingStoreBuffered defer:FALSE];
|
||||
}
|
||||
|
||||
NSOpenGLPixelFormat *format;
|
||||
for (int i=0; i<3; ++i)
|
||||
if (Window != NULL || CreationParams.WindowId)
|
||||
{
|
||||
if (1==i)
|
||||
NSOpenGLPixelFormatAttribute windowattribs[] =
|
||||
{
|
||||
// Second try without stencilbuffer
|
||||
if (CreationParams.Stencilbuffer)
|
||||
{
|
||||
windowattribs[13]=(NSOpenGLPixelFormatAttribute)0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if (2==i)
|
||||
NSOpenGLPFANoRecovery,
|
||||
NSOpenGLPFAAccelerated,
|
||||
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)depthSize,
|
||||
NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)CreationParams.Bits,
|
||||
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)alphaSize,
|
||||
NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
|
||||
NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias,
|
||||
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
(NSOpenGLPixelFormatAttribute)nil
|
||||
};
|
||||
|
||||
if (CreationParams.AntiAlias<2)
|
||||
{
|
||||
// Third try without Doublebuffer
|
||||
os::Printer::log("No doublebuffering available.", ELL_WARNING);
|
||||
windowattribs[14]=(NSOpenGLPixelFormatAttribute)nil;
|
||||
windowattribs[ 9] = (NSOpenGLPixelFormatAttribute)0;
|
||||
windowattribs[11] = (NSOpenGLPixelFormatAttribute)0;
|
||||
}
|
||||
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
if (format == NULL)
|
||||
NSOpenGLPixelFormat *format;
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
if (CreationParams.AntiAlias>1)
|
||||
if (1==i)
|
||||
{
|
||||
while (!format && windowattribs[12]>1)
|
||||
// Second try without stencilbuffer
|
||||
if (CreationParams.Stencilbuffer)
|
||||
{
|
||||
windowattribs[12] = (NSOpenGLPixelFormatAttribute)((int)windowattribs[12]-1);
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
windowattribs[13]=(NSOpenGLPixelFormatAttribute)0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else if (2==i)
|
||||
{
|
||||
// Third try without Doublebuffer
|
||||
os::Printer::log("No doublebuffering available.", ELL_WARNING);
|
||||
windowattribs[14]=(NSOpenGLPixelFormatAttribute)nil;
|
||||
}
|
||||
|
||||
if (!format)
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
if (format == NULL)
|
||||
{
|
||||
if (CreationParams.AntiAlias>1)
|
||||
{
|
||||
windowattribs[9] = (NSOpenGLPixelFormatAttribute)0;
|
||||
windowattribs[11] = (NSOpenGLPixelFormatAttribute)0;
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
while (!format && windowattribs[12]>1)
|
||||
{
|
||||
windowattribs[12] = (NSOpenGLPixelFormatAttribute)((int)windowattribs[12]-1);
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
}
|
||||
|
||||
if (!format)
|
||||
{
|
||||
// reset values for next try
|
||||
windowattribs[9] = (NSOpenGLPixelFormatAttribute)1;
|
||||
windowattribs[11] = (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias;
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("No FSAA available.", ELL_WARNING);
|
||||
}
|
||||
windowattribs[9] = (NSOpenGLPixelFormatAttribute)0;
|
||||
windowattribs[11] = (NSOpenGLPixelFormatAttribute)0;
|
||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
|
||||
if (!format)
|
||||
{
|
||||
// reset values for next try
|
||||
windowattribs[9] = (NSOpenGLPixelFormatAttribute)1;
|
||||
windowattribs[11] = (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias;
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("No FSAA available.", ELL_WARNING);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
CreationParams.AntiAlias = windowattribs[11];
|
||||
CreationParams.Stencilbuffer=(windowattribs[13]==1);
|
||||
CreationParams.AntiAlias = windowattribs[11];
|
||||
CreationParams.Stencilbuffer=(windowattribs[13]==1);
|
||||
|
||||
if (format != NULL)
|
||||
{
|
||||
OGLContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:NULL];
|
||||
[format release];
|
||||
}
|
||||
if (format != NULL)
|
||||
{
|
||||
OGLContext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:NULL];
|
||||
[format release];
|
||||
}
|
||||
|
||||
if (OGLContext != NULL)
|
||||
{
|
||||
if (!CreationParams.WindowId)
|
||||
if (OGLContext != NULL)
|
||||
{
|
||||
if (CreationParams.WindowPosition.X == -1 && CreationParams.WindowPosition.Y == -1)
|
||||
{
|
||||
|
@ -576,68 +722,66 @@ bool CIrrDeviceMacOSX::createWindow()
|
|||
[Window setIsVisible:TRUE];
|
||||
[Window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
else //use another window for drawing
|
||||
[OGLContext setView:(NSView*)CreationParams.WindowId];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displaymode = CGDisplayBestModeForParameters(display,CreationParams.Bits,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height,NULL);
|
||||
if (displaymode != NULL)
|
||||
{
|
||||
olddisplaymode = CGDisplayCurrentMode(display);
|
||||
error = CGCaptureAllDisplays();
|
||||
if (error == CGDisplayNoErr)
|
||||
{
|
||||
error = CGDisplaySwitchToMode(display,displaymode);
|
||||
if (error == CGDisplayNoErr)
|
||||
{
|
||||
CGLPixelFormatAttribute fullattribs[] =
|
||||
{
|
||||
kCGLPFAFullScreen,
|
||||
kCGLPFADisplayMask, (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display),
|
||||
kCGLPFADoubleBuffer,
|
||||
kCGLPFANoRecovery,
|
||||
kCGLPFAAccelerated,
|
||||
kCGLPFADepthSize, (CGLPixelFormatAttribute)depthSize,
|
||||
kCGLPFAColorSize, (CGLPixelFormatAttribute)CreationParams.Bits,
|
||||
kCGLPFAAlphaSize, (CGLPixelFormatAttribute)alphaSize,
|
||||
kCGLPFASampleBuffers, (CGLPixelFormatAttribute)(CreationParams.AntiAlias?1:0),
|
||||
kCGLPFASamples, (CGLPixelFormatAttribute)CreationParams.AntiAlias,
|
||||
kCGLPFAStencilSize, (CGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
|
||||
(CGLPixelFormatAttribute)NULL
|
||||
};
|
||||
|
||||
CGLContext = (CGLContextObj) [OGLContext CGLContextObj];
|
||||
DeviceWidth = CreationParams.WindowSize.Width;
|
||||
DeviceHeight = CreationParams.WindowSize.Height;
|
||||
result = true;
|
||||
pixelFormat = NULL;
|
||||
numPixelFormats = 0;
|
||||
CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats);
|
||||
|
||||
if (pixelFormat != NULL)
|
||||
{
|
||||
CGLCreateContext(pixelFormat,NULL,&CGLContext);
|
||||
CGLDestroyPixelFormat(pixelFormat);
|
||||
}
|
||||
|
||||
if (CGLContext != NULL)
|
||||
{
|
||||
CGLSetFullScreen(CGLContext);
|
||||
displayRect = CGDisplayBounds(display);
|
||||
ScreenWidth = DeviceWidth = (int)displayRect.size.width;
|
||||
ScreenHeight = DeviceHeight = (int)displayRect.size.height;
|
||||
CreationParams.WindowSize.set(ScreenWidth, ScreenHeight);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
CGReleaseAllDisplays();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@catch (NSException *exception)
|
||||
{
|
||||
displaymode = CGDisplayBestModeForParameters(display,CreationParams.Bits,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height,NULL);
|
||||
if (displaymode != NULL)
|
||||
{
|
||||
olddisplaymode = CGDisplayCurrentMode(display);
|
||||
error = CGCaptureAllDisplays();
|
||||
if (error == CGDisplayNoErr)
|
||||
{
|
||||
error = CGDisplaySwitchToMode(display,displaymode);
|
||||
if (error == CGDisplayNoErr)
|
||||
{
|
||||
CGLPixelFormatAttribute fullattribs[] =
|
||||
{
|
||||
kCGLPFAFullScreen,
|
||||
kCGLPFADisplayMask, (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display),
|
||||
kCGLPFADoubleBuffer,
|
||||
kCGLPFANoRecovery,
|
||||
kCGLPFAAccelerated,
|
||||
kCGLPFADepthSize, (CGLPixelFormatAttribute)depthSize,
|
||||
kCGLPFAColorSize, (CGLPixelFormatAttribute)CreationParams.Bits,
|
||||
kCGLPFAAlphaSize, (CGLPixelFormatAttribute)alphaSize,
|
||||
kCGLPFASampleBuffers, (CGLPixelFormatAttribute)(CreationParams.AntiAlias?1:0),
|
||||
kCGLPFASamples, (CGLPixelFormatAttribute)CreationParams.AntiAlias,
|
||||
kCGLPFAStencilSize, (CGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
|
||||
(CGLPixelFormatAttribute)NULL
|
||||
};
|
||||
|
||||
pixelFormat = NULL;
|
||||
numPixelFormats = 0;
|
||||
CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats);
|
||||
|
||||
if (pixelFormat != NULL)
|
||||
{
|
||||
CGLCreateContext(pixelFormat,NULL,&CGLContext);
|
||||
CGLDestroyPixelFormat(pixelFormat);
|
||||
}
|
||||
|
||||
if (CGLContext != NULL)
|
||||
{
|
||||
CGLSetFullScreen(CGLContext);
|
||||
displayRect = CGDisplayBounds(display);
|
||||
ScreenWidth = DeviceWidth = (int)displayRect.size.width;
|
||||
ScreenHeight = DeviceHeight = (int)displayRect.size.height;
|
||||
CreationParams.WindowSize.set(ScreenWidth, ScreenHeight);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
CGReleaseAllDisplays();
|
||||
}
|
||||
}
|
||||
closeDevice();
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (result)
|
||||
|
@ -947,10 +1091,13 @@ void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed
|
|||
mkey = mchar = 0;
|
||||
skipCommand = false;
|
||||
c = [str characterAtIndex:0];
|
||||
mchar = c;
|
||||
|
||||
iter = KeyCodes.find(c);
|
||||
iter = KeyCodes.find([(NSEvent *)event keyCode]);
|
||||
if (iter != KeyCodes.end())
|
||||
mkey = (*iter).second;
|
||||
else if ((iter = KeyCodes.find(c)) != KeyCodes.end())
|
||||
mkey = (*iter).second;
|
||||
else
|
||||
{
|
||||
// workaround for period character
|
||||
|
@ -1010,8 +1157,14 @@ void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
|||
}
|
||||
else
|
||||
{
|
||||
ievent.MouseInput.X = (int)[NSEvent mouseLocation].x;
|
||||
ievent.MouseInput.Y = DeviceHeight - (int)[NSEvent mouseLocation].y;
|
||||
CGEventRef ourEvent = CGEventCreate(NULL);
|
||||
CGPoint point = CGEventGetLocation(ourEvent);
|
||||
|
||||
ievent.MouseInput.X = (int)point.x;
|
||||
ievent.MouseInput.Y = (int)point.y;
|
||||
|
||||
if (ievent.MouseInput.Y < 0)
|
||||
post = false;
|
||||
}
|
||||
|
||||
if (post)
|
||||
|
@ -1023,22 +1176,35 @@ void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent)
|
|||
|
||||
void CIrrDeviceMacOSX::storeMouseLocation()
|
||||
{
|
||||
NSPoint p;
|
||||
int x,y;
|
||||
|
||||
p = [NSEvent mouseLocation];
|
||||
int x,y;
|
||||
|
||||
if (Window != NULL)
|
||||
{
|
||||
NSPoint p;
|
||||
p = [NSEvent mouseLocation];
|
||||
p = [Window convertScreenToBase:p];
|
||||
x = (int)p.x;
|
||||
y = DeviceHeight - (int)p.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (int)p.x;
|
||||
y = (int)p.y;
|
||||
y -= (ScreenHeight - DeviceHeight);
|
||||
CGEventRef ourEvent = CGEventCreate(NULL);
|
||||
CGPoint point = CGEventGetLocation(ourEvent);
|
||||
|
||||
x = (int)point.x;
|
||||
y = (int)point.y;
|
||||
|
||||
const core::position2di& curr = ((CCursorControl *)CursorControl)->getPosition();
|
||||
if (curr.X != x || curr.Y != y)
|
||||
{
|
||||
// In fullscreen mode, events are not sent regularly so rely on polling
|
||||
irr::SEvent ievent;
|
||||
ievent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
ievent.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN;
|
||||
ievent.MouseInput.X = x;
|
||||
ievent.MouseInput.Y = y;
|
||||
postEventFromUser(ievent);
|
||||
}
|
||||
}
|
||||
|
||||
((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y);
|
||||
|
@ -1082,42 +1248,115 @@ void CIrrDeviceMacOSX::setCursorVisible(bool visible)
|
|||
|
||||
void CIrrDeviceMacOSX::initKeycodes()
|
||||
{
|
||||
KeyCodes[NSUpArrowFunctionKey] = irr::KEY_UP;
|
||||
KeyCodes[NSDownArrowFunctionKey] = irr::KEY_DOWN;
|
||||
KeyCodes[NSLeftArrowFunctionKey] = irr::KEY_LEFT;
|
||||
KeyCodes[NSRightArrowFunctionKey] = irr::KEY_RIGHT;
|
||||
KeyCodes[NSF1FunctionKey] = irr::KEY_F1;
|
||||
KeyCodes[NSF2FunctionKey] = irr::KEY_F2;
|
||||
KeyCodes[NSF3FunctionKey] = irr::KEY_F3;
|
||||
KeyCodes[NSF4FunctionKey] = irr::KEY_F4;
|
||||
KeyCodes[NSF5FunctionKey] = irr::KEY_F5;
|
||||
KeyCodes[NSF6FunctionKey] = irr::KEY_F6;
|
||||
KeyCodes[NSF7FunctionKey] = irr::KEY_F7;
|
||||
KeyCodes[NSF8FunctionKey] = irr::KEY_F8;
|
||||
KeyCodes[NSF9FunctionKey] = irr::KEY_F9;
|
||||
KeyCodes[NSF10FunctionKey] = irr::KEY_F10;
|
||||
KeyCodes[NSF11FunctionKey] = irr::KEY_F11;
|
||||
KeyCodes[NSF12FunctionKey] = irr::KEY_F12;
|
||||
KeyCodes[NSF13FunctionKey] = irr::KEY_F13;
|
||||
KeyCodes[NSF14FunctionKey] = irr::KEY_F14;
|
||||
KeyCodes[NSF15FunctionKey] = irr::KEY_F15;
|
||||
KeyCodes[NSF16FunctionKey] = irr::KEY_F16;
|
||||
KeyCodes[NSHomeFunctionKey] = irr::KEY_HOME;
|
||||
KeyCodes[NSEndFunctionKey] = irr::KEY_END;
|
||||
KeyCodes[kVK_UpArrow] = irr::KEY_UP;
|
||||
KeyCodes[kVK_DownArrow] = irr::KEY_DOWN;
|
||||
KeyCodes[kVK_LeftArrow] = irr::KEY_LEFT;
|
||||
KeyCodes[kVK_RightArrow] = irr::KEY_RIGHT;
|
||||
KeyCodes[kVK_F1] = irr::KEY_F1;
|
||||
KeyCodes[kVK_F2] = irr::KEY_F2;
|
||||
KeyCodes[kVK_F3] = irr::KEY_F3;
|
||||
KeyCodes[kVK_F4] = irr::KEY_F4;
|
||||
KeyCodes[kVK_F5] = irr::KEY_F5;
|
||||
KeyCodes[kVK_F6] = irr::KEY_F6;
|
||||
KeyCodes[kVK_F7] = irr::KEY_F7;
|
||||
KeyCodes[kVK_F8] = irr::KEY_F8;
|
||||
KeyCodes[kVK_F9] = irr::KEY_F9;
|
||||
KeyCodes[kVK_F10] = irr::KEY_F10;
|
||||
KeyCodes[kVK_F11] = irr::KEY_F11;
|
||||
KeyCodes[kVK_F12] = irr::KEY_F12;
|
||||
KeyCodes[kVK_F13] = irr::KEY_F13;
|
||||
KeyCodes[kVK_F14] = irr::KEY_F14;
|
||||
KeyCodes[kVK_F15] = irr::KEY_F15;
|
||||
KeyCodes[kVK_F16] = irr::KEY_F16;
|
||||
KeyCodes[kVK_F17] = irr::KEY_F17;
|
||||
KeyCodes[kVK_F18] = irr::KEY_F18;
|
||||
KeyCodes[kVK_F19] = irr::KEY_F19;
|
||||
KeyCodes[kVK_F20] = irr::KEY_F20;
|
||||
KeyCodes[kVK_Home] = irr::KEY_HOME;
|
||||
KeyCodes[kVK_End] = irr::KEY_END;
|
||||
KeyCodes[NSInsertFunctionKey] = irr::KEY_INSERT;
|
||||
KeyCodes[NSDeleteFunctionKey] = irr::KEY_DELETE;
|
||||
KeyCodes[NSHelpFunctionKey] = irr::KEY_HELP;
|
||||
KeyCodes[kVK_ForwardDelete] = irr::KEY_DELETE;
|
||||
KeyCodes[kVK_Help] = irr::KEY_HELP;
|
||||
KeyCodes[NSSelectFunctionKey] = irr::KEY_SELECT;
|
||||
KeyCodes[NSPrintFunctionKey] = irr::KEY_PRINT;
|
||||
KeyCodes[NSExecuteFunctionKey] = irr::KEY_EXECUT;
|
||||
KeyCodes[NSPrintScreenFunctionKey] = irr::KEY_SNAPSHOT;
|
||||
KeyCodes[NSPauseFunctionKey] = irr::KEY_PAUSE;
|
||||
KeyCodes[NSScrollLockFunctionKey] = irr::KEY_SCROLL;
|
||||
KeyCodes[0x7F] = irr::KEY_BACK;
|
||||
KeyCodes[0x09] = irr::KEY_TAB;
|
||||
KeyCodes[0x0D] = irr::KEY_RETURN;
|
||||
KeyCodes[0x03] = irr::KEY_RETURN;
|
||||
KeyCodes[0x1B] = irr::KEY_ESCAPE;
|
||||
KeyCodes[kVK_Delete] = irr::KEY_BACK;
|
||||
KeyCodes[kVK_Tab] = irr::KEY_TAB;
|
||||
KeyCodes[kVK_Return] = irr::KEY_RETURN;
|
||||
KeyCodes[kVK_Escape] = irr::KEY_ESCAPE;
|
||||
KeyCodes[kVK_Control] = irr::KEY_CONTROL;
|
||||
KeyCodes[kVK_RightControl] = irr::KEY_RCONTROL;
|
||||
KeyCodes[kVK_Command] = irr::KEY_MENU;
|
||||
KeyCodes[kVK_Shift] = irr::KEY_SHIFT;
|
||||
KeyCodes[kVK_RightShift] = irr::KEY_RSHIFT;
|
||||
KeyCodes[kVK_Space] = irr::KEY_SPACE;
|
||||
|
||||
KeyCodes[kVK_ANSI_A] = irr::KEY_KEY_A;
|
||||
KeyCodes[kVK_ANSI_B] = irr::KEY_KEY_B;
|
||||
KeyCodes[kVK_ANSI_C] = irr::KEY_KEY_C;
|
||||
KeyCodes[kVK_ANSI_D] = irr::KEY_KEY_D;
|
||||
KeyCodes[kVK_ANSI_E] = irr::KEY_KEY_E;
|
||||
KeyCodes[kVK_ANSI_F] = irr::KEY_KEY_F;
|
||||
KeyCodes[kVK_ANSI_G] = irr::KEY_KEY_G;
|
||||
KeyCodes[kVK_ANSI_H] = irr::KEY_KEY_H;
|
||||
KeyCodes[kVK_ANSI_I] = irr::KEY_KEY_I;
|
||||
KeyCodes[kVK_ANSI_J] = irr::KEY_KEY_J;
|
||||
KeyCodes[kVK_ANSI_K] = irr::KEY_KEY_K;
|
||||
KeyCodes[kVK_ANSI_L] = irr::KEY_KEY_L;
|
||||
KeyCodes[kVK_ANSI_M] = irr::KEY_KEY_M;
|
||||
KeyCodes[kVK_ANSI_N] = irr::KEY_KEY_N;
|
||||
KeyCodes[kVK_ANSI_O] = irr::KEY_KEY_O;
|
||||
KeyCodes[kVK_ANSI_P] = irr::KEY_KEY_P;
|
||||
KeyCodes[kVK_ANSI_Q] = irr::KEY_KEY_Q;
|
||||
KeyCodes[kVK_ANSI_R] = irr::KEY_KEY_R;
|
||||
KeyCodes[kVK_ANSI_S] = irr::KEY_KEY_S;
|
||||
KeyCodes[kVK_ANSI_T] = irr::KEY_KEY_T;
|
||||
KeyCodes[kVK_ANSI_U] = irr::KEY_KEY_U;
|
||||
KeyCodes[kVK_ANSI_V] = irr::KEY_KEY_V;
|
||||
KeyCodes[kVK_ANSI_W] = irr::KEY_KEY_W;
|
||||
KeyCodes[kVK_ANSI_X] = irr::KEY_KEY_X;
|
||||
KeyCodes[kVK_ANSI_X] = irr::KEY_KEY_X;
|
||||
KeyCodes[kVK_ANSI_Y] = irr::KEY_KEY_Y;
|
||||
KeyCodes[kVK_ANSI_Z] = irr::KEY_KEY_Z;
|
||||
|
||||
KeyCodes[kVK_ANSI_0] = irr::KEY_KEY_0;
|
||||
KeyCodes[kVK_ANSI_1] = irr::KEY_KEY_1;
|
||||
KeyCodes[kVK_ANSI_2] = irr::KEY_KEY_2;
|
||||
KeyCodes[kVK_ANSI_3] = irr::KEY_KEY_3;
|
||||
KeyCodes[kVK_ANSI_4] = irr::KEY_KEY_4;
|
||||
KeyCodes[kVK_ANSI_5] = irr::KEY_KEY_5;
|
||||
KeyCodes[kVK_ANSI_6] = irr::KEY_KEY_6;
|
||||
KeyCodes[kVK_ANSI_7] = irr::KEY_KEY_7;
|
||||
KeyCodes[kVK_ANSI_8] = irr::KEY_KEY_8;
|
||||
KeyCodes[kVK_ANSI_9] = irr::KEY_KEY_9;
|
||||
|
||||
KeyCodes[kVK_ANSI_Slash] = irr::KEY_DIVIDE;
|
||||
KeyCodes[kVK_ANSI_Comma] = irr::KEY_COMMA;
|
||||
KeyCodes[kVK_ANSI_Period] = irr::KEY_PERIOD;
|
||||
KeyCodes[kVK_PageUp] = irr::KEY_PRIOR;
|
||||
KeyCodes[kVK_PageDown] = irr::KEY_NEXT;
|
||||
|
||||
KeyCodes[kVK_ANSI_Keypad0] = irr::KEY_NUMPAD0;
|
||||
KeyCodes[kVK_ANSI_Keypad1] = irr::KEY_NUMPAD1;
|
||||
KeyCodes[kVK_ANSI_Keypad2] = irr::KEY_NUMPAD2;
|
||||
KeyCodes[kVK_ANSI_Keypad3] = irr::KEY_NUMPAD3;
|
||||
KeyCodes[kVK_ANSI_Keypad4] = irr::KEY_NUMPAD4;
|
||||
KeyCodes[kVK_ANSI_Keypad5] = irr::KEY_NUMPAD5;
|
||||
KeyCodes[kVK_ANSI_Keypad6] = irr::KEY_NUMPAD6;
|
||||
KeyCodes[kVK_ANSI_Keypad7] = irr::KEY_NUMPAD7;
|
||||
KeyCodes[kVK_ANSI_Keypad8] = irr::KEY_NUMPAD8;
|
||||
KeyCodes[kVK_ANSI_Keypad9] = irr::KEY_NUMPAD9;
|
||||
|
||||
KeyCodes[kVK_ANSI_KeypadDecimal] = irr::KEY_DECIMAL;
|
||||
KeyCodes[kVK_ANSI_KeypadMultiply] = irr::KEY_MULTIPLY;
|
||||
KeyCodes[kVK_ANSI_KeypadPlus] = irr::KEY_PLUS;
|
||||
KeyCodes[kVK_ANSI_KeypadClear] = irr::KEY_OEM_CLEAR;
|
||||
KeyCodes[kVK_ANSI_KeypadDivide] = irr::KEY_DIVIDE;
|
||||
KeyCodes[kVK_ANSI_KeypadEnter] = irr::KEY_RETURN;
|
||||
KeyCodes[kVK_ANSI_KeypadMinus] = irr::KEY_SUBTRACT;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -261,6 +261,7 @@ bool testEncryptedZip(IFileSystem* fs)
|
|||
|
||||
char tmp[13] = {'\0'};
|
||||
readFile->read(tmp, 12);
|
||||
readFile->drop();
|
||||
if (strncmp(tmp, "Linux Users:", 12))
|
||||
{
|
||||
logTestString("Read bad data from archive: %s\n", tmp);
|
||||
|
@ -278,8 +279,6 @@ bool testEncryptedZip(IFileSystem* fs)
|
|||
if ( fs->getFileArchiveCount() )
|
||||
return false;
|
||||
|
||||
readFile->drop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,60 +4,55 @@
|
|||
#include "testUtils.h"
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
// Tests B3D animations.
|
||||
bool b3dAnimation(void)
|
||||
{
|
||||
// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
|
||||
IrrlichtDevice *device = createDevice( EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
|
||||
IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO, core::dimension2d<u32>(160, 120), 32);
|
||||
assert(device);
|
||||
if (!device)
|
||||
return false;
|
||||
|
||||
IVideoDriver* driver = device->getVideoDriver();
|
||||
ISceneManager * smgr = device->getSceneManager();
|
||||
video::IVideoDriver* driver = device->getVideoDriver();
|
||||
scene::ISceneManager * smgr = device->getSceneManager();
|
||||
|
||||
ISkinnedMesh* mesh = (ISkinnedMesh*)smgr->getMesh("../media/ninja.b3d");
|
||||
scene::ISkinnedMesh* mesh = (scene::ISkinnedMesh*)smgr->getMesh("../media/ninja.b3d");
|
||||
assert(mesh);
|
||||
|
||||
bool result = false;
|
||||
if (!mesh)
|
||||
return false;
|
||||
|
||||
IAnimatedMeshSceneNode* node1 = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
scene::IAnimatedMeshSceneNode* node1 = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
assert(node1);
|
||||
|
||||
/** Verify that two skinned animated mesh scene nodes can use different frames of the skinned mesh */
|
||||
if(node1)
|
||||
{
|
||||
node1->setPosition(vector3df(-3, -3, 10));
|
||||
node1->setMaterialFlag(EMF_LIGHTING, false);
|
||||
node1->setPosition(core::vector3df(-3, -3, 10));
|
||||
node1->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
node1->setAnimationSpeed(0.f);
|
||||
node1->setCurrentFrame(10.f);
|
||||
node1->setDebugDataVisible(irr::scene::EDS_BBOX_BUFFERS);
|
||||
}
|
||||
|
||||
IAnimatedMeshSceneNode* node2 = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
scene::IAnimatedMeshSceneNode* node2 = smgr->addAnimatedMeshSceneNode(mesh);
|
||||
assert(node2);
|
||||
if(node2)
|
||||
{
|
||||
node2->setPosition(vector3df(3, -3, 10));
|
||||
node2->setMaterialFlag(EMF_LIGHTING, false);
|
||||
node2->setPosition(core::vector3df(3, -3, 10));
|
||||
node2->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
node2->setAnimationSpeed(0.f);
|
||||
node2->setCurrentFrame(62.f);
|
||||
node2->setDebugDataVisible(irr::scene::EDS_BBOX_BUFFERS);
|
||||
node2->setDebugDataVisible(scene::EDS_BBOX_BUFFERS);
|
||||
}
|
||||
|
||||
(void)smgr->addCameraSceneNode();
|
||||
|
||||
// Just jump to the last frame since that's all we're interested in.
|
||||
device->run();
|
||||
driver->beginScene(true, true, SColor(255, 60, 60, 60));
|
||||
driver->beginScene(true, true, video::SColor(255, 60, 60, 60));
|
||||
smgr->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
|
@ -67,7 +62,7 @@ bool b3dAnimation(void)
|
|||
|
||||
/** Now test if bones are correctly positioned. */
|
||||
node1->setDebugDataVisible(scene::EDS_SKELETON);
|
||||
node1->setPosition(vector3df(1, -5, 8));
|
||||
node1->setPosition(core::vector3df(1,-5,8));
|
||||
node1->setRotation(core::vector3df(0,180,0));
|
||||
node1->updateAbsolutePosition();
|
||||
for (u32 i=0; i<node1->getJointCount(); ++i)
|
||||
|
@ -78,7 +73,7 @@ bool b3dAnimation(void)
|
|||
|
||||
// Simple render call
|
||||
device->run();
|
||||
driver->beginScene(true, true, SColor(255, 60, 60, 60));
|
||||
driver->beginScene(true, true, video::SColor(255, 60, 60, 60));
|
||||
smgr->drawAll();
|
||||
driver->endScene();
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ int main(int argumentCount, char * arguments[])
|
|||
// (temporarily) to the beginning of the list, since each test runs in its own
|
||||
// process.
|
||||
|
||||
|
||||
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
|
||||
// Now the simple tests without device
|
||||
TEST(testIrrArray);
|
||||
|
@ -67,8 +68,7 @@ int main(int argumentCount, char * arguments[])
|
|||
TEST(testS3DVertex);
|
||||
TEST(testaabbox3d);
|
||||
TEST(color);
|
||||
// TODO: Needs to be fixed first
|
||||
// TEST(testTriangle3d);
|
||||
TEST(testTriangle3d);
|
||||
TEST(vectorPositionDimension2d);
|
||||
// file system checks (with null driver)
|
||||
TEST(filesystem);
|
||||
|
@ -89,6 +89,7 @@ int main(int argumentCount, char * arguments[])
|
|||
TEST(softwareDevice);
|
||||
TEST(b3dAnimation);
|
||||
TEST(burningsVideo);
|
||||
TEST(billboards);
|
||||
TEST(createImage);
|
||||
TEST(cursorSetVisible);
|
||||
TEST(flyCircleAnimator);
|
||||
|
@ -127,6 +128,7 @@ int main(int argumentCount, char * arguments[])
|
|||
TEST(planeMatrix);
|
||||
TEST(terrainSceneNode);
|
||||
TEST(lightMaps);
|
||||
TEST(triangleSelector);
|
||||
|
||||
unsigned int numberOfTests = tests.size();
|
||||
unsigned int testToRun = 0;
|
||||
|
|
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.1 KiB |
|
@ -42,6 +42,8 @@ public:
|
|||
out->addColor("ValColor", ValColor);
|
||||
out->addColorf("ValColorf", ValColorf);
|
||||
out->addVector3d("ValVector3df", ValVector3df);
|
||||
out->addVector2d("ValVector2df", ValVector2df);
|
||||
out->addDimension2d("ValDimension2du", ValDimension2du);
|
||||
out->addPosition2d("ValPosition2di", ValPosition2di);
|
||||
out->addRect("ValRect", ValRect);
|
||||
out->addMatrix("ValMatrix", ValMatrix);
|
||||
|
@ -68,6 +70,8 @@ public:
|
|||
ValColor = in->getAttributeAsColor("ValColor");
|
||||
ValColorf = in->getAttributeAsColorf("ValColorf");
|
||||
ValVector3df = in->getAttributeAsVector3d("ValVector3df");
|
||||
ValVector2df = in->getAttributeAsVector2d("ValVector2df");
|
||||
ValDimension2du = in->getAttributeAsDimension2d("ValDimension2du");
|
||||
ValPosition2di = in->getAttributeAsPosition2d("ValPosition2di");
|
||||
ValRect = in->getAttributeAsRect("ValRect");
|
||||
ValMatrix = in->getAttributeAsMatrix("ValMatrix");
|
||||
|
@ -102,6 +106,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
COMPARE(ValVector3df, other.ValVector3df);
|
||||
COMPARE(ValVector2df, other.ValVector2df);
|
||||
COMPARE(ValDimension2du, other.ValDimension2du);
|
||||
COMPARE(ValPosition2di, other.ValPosition2di);
|
||||
COMPARE(ValRect, other.ValRect);
|
||||
COMPARE(ValMatrix, other.ValMatrix);
|
||||
|
@ -130,6 +136,8 @@ public:
|
|||
ValColor.set(0,0,0,0);
|
||||
ValColorf.set(0.f, 0.f, 0.f, 0.f);
|
||||
ValVector3df.set(0.f, 0.f, 0.f);
|
||||
ValVector2df.set(0.f, 0.f);
|
||||
ValDimension2du.set(0, 0);
|
||||
ValPosition2di.set(0,0);
|
||||
ValRect = core::rect<s32>(0,0,0,0);
|
||||
ValMatrix.makeIdentity();
|
||||
|
@ -158,6 +166,8 @@ public:
|
|||
ValColor.set(1,2,3,4);
|
||||
ValColorf.set(1.f, 2.f, 3.f, 4.f);
|
||||
ValVector3df.set(1.f, 2.f, 3.f);
|
||||
ValVector2df.set(1.f, 2.f);
|
||||
ValDimension2du.set(1, 2);
|
||||
ValPosition2di.set(1,2);
|
||||
ValRect = core::rect<s32>(1,2,3,4);
|
||||
ValMatrix = 99.9f;
|
||||
|
@ -182,6 +192,8 @@ public:
|
|||
video::SColor ValColor;
|
||||
video::SColorf ValColorf;
|
||||
core::vector3df ValVector3df;
|
||||
core::vector2df ValVector2df;
|
||||
core::dimension2du ValDimension2du;
|
||||
core::position2di ValPosition2di;
|
||||
core::rect<s32> ValRect;
|
||||
core::matrix4 ValMatrix;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<Unit filename="anti-aliasing.cpp" />
|
||||
<Unit filename="archiveReader.cpp" />
|
||||
<Unit filename="b3dAnimation.cpp" />
|
||||
<Unit filename="billboards.cpp" />
|
||||
<Unit filename="burningsVideo.cpp" />
|
||||
<Unit filename="collisionResponseAnimator.cpp" />
|
||||
<Unit filename="color.cpp" />
|
||||
|
@ -103,6 +104,7 @@
|
|||
<Unit filename="textureRenderStates.cpp" />
|
||||
<Unit filename="timer.cpp" />
|
||||
<Unit filename="transparentMaterials.cpp" />
|
||||
<Unit filename="triangleSelector.cpp" />
|
||||
<Unit filename="userClipPlane.cpp" />
|
||||
<Unit filename="vectorPositionDimension2d.cpp" />
|
||||
<Unit filename="videoDriver.cpp" />
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
<ClCompile Include="anti-aliasing.cpp" />
|
||||
<ClCompile Include="archiveReader.cpp" />
|
||||
<ClCompile Include="b3dAnimation.cpp" />
|
||||
<ClCompile Include="billboards.cpp" />
|
||||
<ClCompile Include="burningsVideo.cpp" />
|
||||
<ClCompile Include="collisionResponseAnimator.cpp" />
|
||||
<ClCompile Include="color.cpp" />
|
||||
|
@ -209,6 +210,7 @@
|
|||
<ClCompile Include="textureRenderStates.cpp" />
|
||||
<ClCompile Include="timer.cpp" />
|
||||
<ClCompile Include="transparentMaterials.cpp" />
|
||||
<ClCompile Include="triangleSelector.cpp" />
|
||||
<ClCompile Include="userClipPlane.cpp" />
|
||||
<ClCompile Include="vectorPositionDimension2d.cpp" />
|
||||
<ClCompile Include="videoDriver.cpp" />
|
||||
|
|
|
@ -188,6 +188,10 @@
|
|||
RelativePath=".\b3dAnimation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\billboards.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\burningsVideo.cpp"
|
||||
>
|
||||
|
@ -428,6 +432,10 @@
|
|||
RelativePath=".\transparentMaterials.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\triangleSelector.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\userClipPlane.cpp"
|
||||
>
|
||||
|
|
|
@ -187,6 +187,10 @@
|
|||
RelativePath=".\b3dAnimation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\billboards.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\burningsVideo.cpp"
|
||||
>
|
||||
|
|
|
@ -3,27 +3,17 @@
|
|||
|
||||
#include "testUtils.h"
|
||||
#include <irrlicht.h>
|
||||
#include <assert.h>
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
|
||||
template<class T>
|
||||
static bool isOnSameSide(const vector3d<T>& p1, const vector3d<T>& p2,
|
||||
const vector3d<T>& a, const vector3d<T>& b)
|
||||
{
|
||||
vector3d<T> bminusa = b - a;
|
||||
vector3d<T> cp1 = bminusa.crossProduct(p1 - a);
|
||||
vector3d<T> cp2 = bminusa.crossProduct(p2 - a);
|
||||
return (cp1.dotProduct(cp2)+core::ROUNDING_ERROR_f64 >= 0.0f);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static bool testGetIntersectionWithLine(core::triangle3d<T>& triangle, const core::line3d<T>& ray)
|
||||
{
|
||||
bool allExpected=true;
|
||||
const vector3d<T> linevect = ray.getVector().normalize();
|
||||
vector3d<T> intersection;
|
||||
// When we just raise Y parallel to the ray then either all should fail or all succeed (the latter in our case).
|
||||
for (u32 i=0; i<100; ++i)
|
||||
{
|
||||
if (!triangle.getIntersectionOfPlaneWithLine(ray.start, linevect, intersection))
|
||||
|
@ -31,6 +21,7 @@ static bool testGetIntersectionWithLine(core::triangle3d<T>& triangle, const cor
|
|||
allExpected=false;
|
||||
logTestString("triangle3d plane test %d failed\n", i);
|
||||
}
|
||||
//logTestString("intersection: %f %f %f\n", intersection.X, intersection.Y, intersection.Z);
|
||||
if (!triangle.isPointInsideFast(intersection))
|
||||
{
|
||||
allExpected=false;
|
||||
|
@ -40,12 +31,6 @@ static bool testGetIntersectionWithLine(core::triangle3d<T>& triangle, const cor
|
|||
{
|
||||
allExpected=false;
|
||||
logTestString("triangle3d point test %d failed\n", i);
|
||||
if (!isOnSameSide(intersection, triangle.pointA, triangle.pointB, triangle.pointC))
|
||||
logTestString("triangle3d side1 test %d failed\n", i);
|
||||
if (!isOnSameSide(intersection, triangle.pointB, triangle.pointA, triangle.pointC))
|
||||
logTestString("triangle3d side2 test %d failed\n", i);
|
||||
if (!isOnSameSide(intersection, triangle.pointC, triangle.pointA, triangle.pointB))
|
||||
logTestString("triangle3d side3 test %d failed\n", i);
|
||||
}
|
||||
|
||||
if (!triangle.getIntersectionWithLine(ray.start, linevect, intersection))
|
||||
|
@ -102,7 +87,7 @@ static void stageModifications(int stage, vector3d<T>& point)
|
|||
}
|
||||
|
||||
template<class T>
|
||||
static bool isPointInside(triangle3d<T> triangleOrig)
|
||||
static bool isPointInside(triangle3d<T> triangleOrig, bool testIsInside, bool testIsInsideFast)
|
||||
{
|
||||
bool allExpected=true;
|
||||
|
||||
|
@ -124,18 +109,24 @@ static bool isPointInside(triangle3d<T> triangleOrig)
|
|||
vector3d<T> point = pointsInside[i];
|
||||
stageModifications(stage, point);
|
||||
|
||||
allExpected &= triangle.isPointInside( point );
|
||||
if ( !allExpected )
|
||||
if ( testIsInside )
|
||||
{
|
||||
logTestString("triangle3d::isPointInside pointsInside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
allExpected &= triangle.isPointInside( point );
|
||||
if ( !allExpected )
|
||||
{
|
||||
logTestString("triangle3d::isPointInside pointsInside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
allExpected &= triangle.isPointInsideFast( point );
|
||||
if ( !allExpected )
|
||||
if ( testIsInsideFast )
|
||||
{
|
||||
logTestString("triangle3d::isPointInsideFast pointsInside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
allExpected &= triangle.isPointInsideFast( point );
|
||||
if ( !allExpected )
|
||||
{
|
||||
logTestString("triangle3d::isPointInsideFast pointsInside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,18 +154,24 @@ static bool isPointInside(triangle3d<T> triangleOrig)
|
|||
vector3d<T> point = pointsOutside[i];
|
||||
stageModifications(stage, point);
|
||||
|
||||
allExpected &= !triangle.isPointInside( point );
|
||||
if ( !allExpected )
|
||||
if ( testIsInside )
|
||||
{
|
||||
logTestString("triangle3d::isPointInside pointsOutside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
allExpected &= !triangle.isPointInside( point );
|
||||
if ( !allExpected )
|
||||
{
|
||||
logTestString("triangle3d::isPointInside pointsOutside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
allExpected &= !triangle.isPointInsideFast( point );
|
||||
if ( !allExpected )
|
||||
if ( testIsInsideFast )
|
||||
{
|
||||
logTestString("triangle3d::isPointInsideFast pointsOutside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
allExpected &= !triangle.isPointInsideFast( point );
|
||||
if ( !allExpected )
|
||||
{
|
||||
logTestString("triangle3d::isPointInsideFast pointsOutside test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,19 +195,25 @@ static bool isPointInside(triangle3d<T> triangleOrig)
|
|||
vector3d<T> point = pointsBorder[i];
|
||||
stageModifications(stage, point);
|
||||
|
||||
allExpected &= triangle.isPointInside( point );
|
||||
if ( !allExpected )
|
||||
if ( testIsInside )
|
||||
{
|
||||
logTestString("triangle3d::isPointInside pointsBorder test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
allExpected &= triangle.isPointInside( point );
|
||||
if ( !allExpected )
|
||||
{
|
||||
logTestString("triangle3d::isPointInside pointsBorder test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* results for isPointInsideFast are mixed for border cases, but I guess that's fine.
|
||||
if ( triangle.isPointInsideFast( point ) )
|
||||
logTestString("+ triangle3d::isPointInsideFast pointsBorder stage %d point %d is INSIDE\n", stage, i);
|
||||
else
|
||||
logTestString("- triangle3d::isPointInsideFast pointsBorder stage %d point %d is NOT inside\n", stage, i);
|
||||
*/
|
||||
if ( testIsInsideFast )
|
||||
{
|
||||
allExpected &= triangle.isPointInsideFast( point );
|
||||
if ( !allExpected )
|
||||
{
|
||||
logTestString("triangle3d::isPointInsideFast pointsBorder test failed in stage %d point %d\n", stage, i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +221,6 @@ static bool isPointInside(triangle3d<T> triangleOrig)
|
|||
}
|
||||
|
||||
// Test the functionality of triangle3d<T>
|
||||
/** Validation is done with asserts() against expected results. */
|
||||
bool testTriangle3d(void)
|
||||
{
|
||||
bool allExpected = true;
|
||||
|
@ -226,23 +228,23 @@ bool testTriangle3d(void)
|
|||
logTestString("Test getIntersectionWithLine with f32\n");
|
||||
{
|
||||
triangle3df triangle(
|
||||
vector3df(11300.000000f, 129.411758f, 200.000000f),
|
||||
vector3df(11200.000000f, 94.117645f, 300.000000f),
|
||||
vector3df(11300.000000f, 129.411758f, 300.000000f));
|
||||
vector3df(11300.f, 129.411758f, 200.f),
|
||||
vector3df(11200.f, 94.117645f, 300.f),
|
||||
vector3df(11300.f, 129.411758f, 300.f));
|
||||
line3df ray;
|
||||
ray.start = vector3df(11250.000000f, 329.000000f, 250.000000f);
|
||||
ray.end = vector3df(11250.000000, -1000.000000, 250.000000);
|
||||
ray.start = vector3df(11250.f, 329.f, 250.f);
|
||||
ray.end = vector3df(11250.f, -1000.f, 250.f);
|
||||
allExpected &= testGetIntersectionWithLine(triangle, ray);
|
||||
}
|
||||
logTestString("Test getIntersectionWithLine with f64\n");
|
||||
{
|
||||
triangle3d<f64> triangle(
|
||||
vector3d<f64>(11300.000000f, 129.411758f, 200.000000f),
|
||||
vector3d<f64>(11200.000000f, 94.117645f, 300.000000f),
|
||||
vector3d<f64>(11300.000000f, 129.411758f, 300.000000f));
|
||||
vector3d<f64>(11300., 129.411758, 200.),
|
||||
vector3d<f64>(11200., 94.117645, 300.),
|
||||
vector3d<f64>(11300., 129.411758, 300.));
|
||||
line3d<f64> ray;
|
||||
ray.start = vector3d<f64>(11250.000000f, 329.000000f, 250.000000f);
|
||||
ray.end = vector3d<f64>(11250.000000, -1000.000000, 250.000000);
|
||||
ray.start = vector3d<f64>(11250., 329., 250.);
|
||||
ray.end = vector3d<f64>(11250., -1000., 250.);
|
||||
allExpected &= testGetIntersectionWithLine(triangle, ray);
|
||||
}
|
||||
|
||||
|
@ -254,19 +256,19 @@ bool testTriangle3d(void)
|
|||
logTestString("Test isPointInside with f32\n");
|
||||
{
|
||||
triangle3d<f32> t(vector3d<f32>(-1000,-1000,0), vector3d<f32>(1000,-1000,0), vector3d<f32>(0,1000,0));
|
||||
allExpected &= isPointInside(t);
|
||||
allExpected &= isPointInside(t, true, true);
|
||||
}
|
||||
|
||||
logTestString("Test isPointInside with f64\n");
|
||||
{
|
||||
triangle3d<f64> t(vector3d<f64>(-1000,-1000,0), vector3d<f64>(1000,-1000,0), vector3d<f64>(0,1000,0));
|
||||
allExpected &= isPointInside(t);
|
||||
allExpected &= isPointInside(t, true, true);
|
||||
}
|
||||
|
||||
logTestString("Test isPointInside with s32\n");
|
||||
{
|
||||
triangle3d<s32> t(vector3d<s32>(-1000,-1000,0), vector3d<s32>(1000,-1000,0), vector3d<s32>(0,1000,0));
|
||||
allExpected &= isPointInside(t);
|
||||
allExpected &= isPointInside(t, false, true);
|
||||
}
|
||||
|
||||
if(allExpected)
|
||||
|
|