Commit e8fa33e1 authored by hybrid's avatar hybrid

Merged from 1.7 branch, revisions 3300-3357. Huge number of bug fixes, mostly...

Merged from 1.7 branch, revisions 3300-3357. Huge number of bug fixes, mostly in GUI and serialization.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3358 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ab95e198
Changes in 1.8 (??.0?.2010)
- Add IGUIElement::bringToBack (patch written by DtD, although I'm to blame for the function-name)
-----------------------------
Changes in 1.7.1 (05.07.2010) TA (eh... why 1.7.1? Trunk is for 1.8)
- BurningVideo
- add Normalmap Rendering ( one light only), pushed Burningvideo to 0.46
- add Stencil Shadow Rendering (one color only and 32 bit only), pushed Burningvideo to 0.47
- internal vertexformat changed
- changed fixpoint from 9 to 10 bit fract resolution
- renamed createBurningVideoDriver to createBurningVideoDriver and uses SIrrlichtCreationParameters like opengl
- internal interfaces for the trianglerenders unified.
- Example 11.
changed the light billboards to use the light color. ( green light, green particle, red light red particle )
allow to disable the bump/parallax on the earth like in the room ( with transparency )
- added DDS Image files, DXT2, DXT3, DXT4, DXT5, based on code from nvidia and Randy Reddig
- added a Halflife 1 Model Loader. ( bases on code by Fabio Concas ) Halflife 1.1.0.8, Counter-Strike 1.6 working
-> Load all Textures ( can even optimize it to texture atlas ), all bone animation, all submodels.
-> But to make use of the values ( named animation, mouth animation ) the Interface for IAnimatedMeshSceneNode
has to be redone. I don't want to blow up the Interface again...
TODO:
->can handle float frames numbers, the interface for getMesh should be reworked
I already have working implementations for MD2, MD3 and MDL to use float blendning instead
of using some kind of fix point..
This is my idea of a new getMesh interface for IAnimatedMesh
//! Returns the IMesh interface for a frame.
/** \param frameA: Frame number as zero based index.
The Blend Factor is in the fractional part of frameA
The Mesh will be calculated as
frame = integer(frameA) * (1-fractional(frameA )) + frameB * fractional(frameA)
FrameNr KeyFrameA KeyFrameB
40.0 1 0
40.1 0.9 0.1
40.5 0.5 0.5
40.9 0.1 0.9
41.0 0 1
\param frameB: Frame number as zero based index. The other KeyFrame which is blended with FrameA.
\param userParam: for Example Level of detail, or something else
*/
virtual IMesh* getMesh(f32 frameA, s32 frameB = 0,s32 param = 0) = 0;
Should be discussed. handles all situations ( forward/reverse animation ) because the direction
vector is A->B
For now i used the (unused, always 255) detail level parameter and set a blend percentage as
s32 frameNr = (s32) getFrameNr();
s32 frameBlend = (s32) (core::fract ( getFrameNr() ) * 1000.f);
return Mesh->getMesh(frameNr, frameBlend, StartFrame, EndFrame);
So no interface is affected.
TODO:
I also added structures (suggestion) for Keyframe Interpolation which are currently not used here
mainly to unifiy get and set named animations/bones from different model files with a unique function call.
It would also effect the Handling of IAnimatedMeshSceneNode. This Topic should be discussed.
My goal is to get as many information from the original model file like key/bone animation, skin info, shaders
sub models, attachement points etc in a public interface
and to reduce the interface like setMD2Anim, setMD3Animn, setBoneAnim into one slim line function call
for setting and getting.
The callback interface also should be more generalized and event based.
(Halflife for example can notify if your left foot animation touches ground, or tirggers sound or whatever)
Maybe we use the gui event system for that
I included a 357kb Yodan.mdl and the copyright info file from Doug Hillyer to the media directory
used in example 7. collision as 4th model..
it's not easy to unify different model types and that's why it's not finished;-)
-> TODO: Quaternion Rotation is done private hand made and should be done with irrlicht quaterions
- added Halflife 1 Texture Loader
Valve uses WAL archive types like quake2. textures are inside model files
I reworked the existing ImageloaderWAL and added named Halflife textures to wal2 ( they have not extension )
and an LMP (palette/texture) loader into the same file ( all using 32bit now )
- added WAD Archive Loader ( Quake2 (WAL2) and Halflife (WAL3) are supported )
- CFileList
added Offset Parameter to SFileListEntry and removed the private array from the archive loaders.
CFileList::addItem now uses automatic incremental id if id = 0
- coreutil.h
added void splitFilenam, splits a path into components
- irstring.h
added parameter make_lower to substring ( copy just lower case )
string<T> subString(u32 begin, s32 length, bool make_lower = false ) const
- ColorConverter
added
//! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
static void convert8BitTo24Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad = 0, bool flip=false);
//! converts a 8 bit palettized or non palettized image (A8) into A8R8G8B8
static void convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad = 0, bool flip=false);
--------------------------------------
- BurningVideo
- add Normalmap Rendering (one light only), pushed Burningvideo to 0.46
- add Stencil Shadow Rendering (one color only and 32 bit only),
pushed Burningvideo to 0.47
- internal vertexformat changed
- changed fixpoint from 9 to 10 bit fract resolution
- renamed createBurningVideoDriver to createBurningVideoDriver and uses SIrrlichtCreationParameters like opengl
- internal interfaces for the trianglerenders unified.
- Example 11, changed the light billboards to use the light color.
allow to disable the bump/parallax on the earth like in the room ( with transparency )
- added DDS Image files, DXT2, DXT3, DXT4, DXT5, based on code from nvidia and Randy Reddig
- added Halflife 1 Model Loader (based on code by Fabio Concas)
Halflife 1.1.0.8, Counter-Strike 1.6 working
-> Load all Textures ( can even optimize it to texture atlas ), all bone animation, all submodels.
-> But to make use of the values (named animation, mouth animation)
the Interface for IAnimatedMeshSceneNode has to be redone.
TODO:
->can handle float frames numbers, the interface for getMesh should be reworked
This is my idea of a new getMesh interface for IAnimatedMesh
//! Returns the IMesh interface for a frame.
/** \param frameA: Frame number as zero based index.
The Blend Factor is in the fractional part of frameA
The Mesh will be calculated as
frame = integer(frameA) * (1-fractional(frameA )) + frameB * fractional(frameA)
FrameNr KeyFrameA KeyFrameB
40.0 1 0
40.1 0.9 0.1
40.5 0.5 0.5
40.9 0.1 0.9
41.0 0 1
\param frameB: Frame number as zero based index. The other KeyFrame which is blended with FrameA.
\param userParam: for Example Level of detail, or something else
*/
virtual IMesh* getMesh(f32 frameA, s32 frameB = 0,s32 param = 0) = 0;
For now i used the (unused, always 255) detail level parameter and set a blend percentage as
s32 frameNr = (s32) getFrameNr();
s32 frameBlend = (s32) (core::fract ( getFrameNr() ) * 1000.f);
return Mesh->getMesh(frameNr, frameBlend, StartFrame, EndFrame);
So no interface is affected.
-> TODO: Quaternion Rotation is done private hand made and should be done with irrlicht quaternions
- Included 357kb Yodan.mdl mesh and copyright info file from Doug Hillyer
to the media directory, used in example 7. collision as 4th model.
- added Halflife 1 Texture Loader
Valve uses WAL archive types like quake2. textures are inside model files
I reworked the existing ImageloaderWAL and added named Halflife textures to wal2 ( they have no extension )
and an LMP (palette/texture) loader into the same file (all using 32bit now)
- added WAD Archive Loader (Quake2 (WAL2) and Halflife (WAL3) are supported)
- CFileList
added Offset Parameter to SFileListEntry and removed the private array from the archive loaders.
CFileList::addItem now uses automatic incremental id if id = 0
- added void splitFilename, splits a path into components
- added parameter make_lower to substring ( copy just lower case )
string<T> subString(u32 begin, s32 length, bool make_lower = false ) const
- ColorConverter added
//! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
static void convert8BitTo24Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad = 0, bool flip=false);
//! converts a 8 bit palettized or non palettized image (A8) into A8R8G8B8
static void convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad = 0, bool flip=false);
- In IGUITreeView "clearChilds" and "hasChilds" deprecated for "clearChildren" and "hasChildren" (thx @Greenya for noticing)
......@@ -118,6 +96,58 @@ Changes in 1.7.1 (05.07.2010) TA (eh... why 1.7.1? Trunk is for 1.8)
- WM_SYSCOMMAND - SC_KEYMENU message is now ignored (F10 and ALT in Win32 windowed mode)
-----------------------------
Changes in 1.7.2 (??.??.2010)
- Fix crashes when taking Screenhots for DirectX in Windowed mode (thx to agamemnus for reporting)
- StaticText does now serialize the background color
- Fix gui-elements which didn't care when skin-colors changed. That made it impossible to make the gui slowly transparent (thx to PI for reporting).
Note that it couldn't be completely fixed for the SpinBox without breaking the interface, so for that element you have to enforce this by calling for example element->setValue(element->getValue()) once.
- Fix CXMLReaderImpl::getAttributeValueAsInt which returned wrong values with large integers (thx to squisher for finding)
- Add EGET_TREEVIEW_NODE_COLLAPSE and deprecate EGET_TREEVIEW_NODE_COLLAPS (found by greenya)
- Fix compile problem in swap when using irrlicht in combination with stl (backport from trunk r3281)
- Fix serialization in CParticleSystemSceneNode (found by B@z)
- Prevent crash in BillboardTextSceneNode when a custom font is used. Found and fixed by Nalin (bugtracker id: 3020487)
- Fix problem in animation system that currentFrame got messed up after long pauses (especially when not starting at frame 0).
See forum thread (http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?p=210537#210537) and bug id 2898876.
Also remove BeginFrameTime in CAnimatedMeshSceneNode as it hasn't been used anymore since some time.
- Add framerate and current frame information for animations in example 09 and do some minor cleanup.
- Added another test for xml-reader.
- Fix serialization in several particle emitters and affectors (thx to Ion Dune for reporting).
- Fix compile-error on VS for vector2d::getAngleTrig when used with integers. (thx to greenya for reporting)
- Fix bug in dimension2d::getInterpolated that caused wrong results when used with integers as template parameter. (thx to Greenya for noticing a warning which made me look over this code).
- Remove 2 minor memory leaks in meshloaders (found by tool cppcheck-1.43)
- reduce file dependencies for IGUIEventReceiver.h (thx ngc92)
- Initialize GUIEvent.Element in several places (found by greenya)
- Add EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH and deprecated EGDS_MESSAGE_BOX_MAX_TEST_WIDTH (thx to greenya for reporting).
- Fix several places where "used" in core::string was used wrongly preventing some memory corruption
- Remove additional slash in pathnames in X-Loader
- Fix crash in CGUIListBox when environment was cleared on events
- Bugfix: Clear up depth-textures which could not be attached in OpenGL to prevent crashes.
- Fix arrowMesh boundingbox.
-----------------------------
Changes in 1.7.1 (17.02.2010)
......@@ -166,6 +196,7 @@ Changes in 1.7.1 (17.02.2010)
- mem leak in OBJ loader fixed
- Removed some default parameters to reduce ambigious situations
---------------------------
Changes in 1.7 (03.02.2010)
......@@ -286,12 +317,12 @@ Changes in 1.7 (03.02.2010)
- Let maya-cam animator react on a setTarget call to the camera which happened outside it's own control
- New contextmenue features:
automatic checking for checked flag.
close handling now customizable
serialization can handle incomplete xml's
setEventParent now in public interface
New function findItemWithCommandId
New function insertItem
automatic checking for checked flag.
close handling now customizable
serialization can handle incomplete xml's
setEventParent now in public interface
New function findItemWithCommandId
New function insertItem
- new vector3d::getSphericalCoordinateAngles method.
......
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="09.Meshviewer_vc9"
ProjectGUID="{2AE24484-22FC-481B-9A40-7CD0DA5C8E06}"
RootNamespace="Meshviewer_vc9"
......
......@@ -87,8 +87,10 @@ enum
GUI_ID_BUTTON_SHOW_TOOLBOX,
GUI_ID_BUTTON_SELECT_ARCHIVE,
GUI_ID_ANIMATION_INFO,
// And some magic numbers
MAX_FRAMERATE = 1000,
MAX_FRAMERATE = 80,
DEFAULT_FRAMERATE = 30
};
......@@ -111,7 +113,7 @@ void setActiveCamera(scene::ICameraSceneNode* newActive)
/*
Set the skin transparency by changing the alpha values of all skin-colors
*/
void SetSkinTransparency(s32 alpha, irr::gui::IGUISkin * skin)
void setSkinTransparency(s32 alpha, irr::gui::IGUISkin * skin)
{
for (s32 i=0; i<irr::gui::EGDC_COUNT ; ++i)
{
......@@ -124,7 +126,7 @@ void SetSkinTransparency(s32 alpha, irr::gui::IGUISkin * skin)
/*
Update the display of the model scaling
*/
void UpdateScaleInfo(scene::ISceneNode* model)
void updateScaleInfo(scene::ISceneNode* model)
{
IGUIElement* toolboxWnd = Device->getGUIEnvironment()->getRootGUIElement()->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true);
if (!toolboxWnd)
......@@ -252,7 +254,7 @@ void loadModel(const c8* fn)
if (menu)
for(int item = 1; item < 6; ++item)
menu->setItemChecked(item, false);
UpdateScaleInfo(Model);
updateScaleInfo(Model);
}
......@@ -285,7 +287,7 @@ void createToolBox()
core::rect<s32>(10,20,60,45), false, false, t1);
env->addStaticText(L"X:", core::rect<s32>(22,48,40,66), false, false, t1);
env->addEditBox(L"1.0", core::rect<s32>(40,46,130,66), true, t1, GUI_ID_X_SCALE);
env->addStaticText(L"Y:", core::rect<s32>(22,82,40,GUI_ID_OPEN_MODEL), false, false, t1);
env->addStaticText(L"Y:", core::rect<s32>(22,82,40,96), false, false, t1);
env->addEditBox(L"1.0", core::rect<s32>(40,76,130,96), true, t1, GUI_ID_Y_SCALE);
env->addStaticText(L"Z:", core::rect<s32>(22,108,40,126), false, false, t1);
env->addEditBox(L"1.0", core::rect<s32>(40,106,130,126), true, t1, GUI_ID_Z_SCALE);
......@@ -296,7 +298,7 @@ void createToolBox()
env->addButton(core::rect<s32>(65,20,95,40), t1, GUI_ID_BUTTON_SCALE_MUL10, L"* 10");
env->addButton(core::rect<s32>(100,20,130,40), t1, GUI_ID_BUTTON_SCALE_DIV10, L"* 0.1");
UpdateScaleInfo(Model);
updateScaleInfo(Model);
// add transparency control
env->addStaticText(L"GUI Transparency Control:",
......@@ -307,17 +309,43 @@ void createToolBox()
scrollbar->setPos(255);
// add framerate control
env->addStaticText(L":", core::rect<s32>(10,240,150,265), true, false, t1);
env->addStaticText(L"Framerate:",
core::rect<s32>(10,240,150,265), true, false, t1);
core::rect<s32>(12,240,75,265), false, false, t1);
env->addStaticText(L"", core::rect<s32>(75,240,200,265), false, false, t1,
GUI_ID_ANIMATION_INFO);
scrollbar = env->addScrollBar(true,
core::rect<s32>(10,265,150,280), t1, GUI_ID_SKIN_ANIMATION_FPS);
scrollbar->setMax(MAX_FRAMERATE);
scrollbar->setMin(-MAX_FRAMERATE);
scrollbar->setPos(DEFAULT_FRAMERATE);
scrollbar->setSmallStep(1);
}
void updateToolBox()
{
IGUIEnvironment* env = Device->getGUIEnvironment();
IGUIElement* root = env->getRootGUIElement();
IGUIElement* dlg = root->getElementFromId(GUI_ID_DIALOG_ROOT_WINDOW, true);
if (!dlg )
return;
// bring irrlicht engine logo to front, because it
// now may be below the newly created toolbox
root->bringToFront(root->getElementFromId(666, true));
// update the info we have about the animation of the model
IGUIStaticText * aniInfo = (IGUIStaticText *)(dlg->getElementFromId(GUI_ID_ANIMATION_INFO, true));
if (aniInfo)
{
if ( Model && scene::ESNT_ANIMATED_MESH == Model->getType() )
{
scene::IAnimatedMeshSceneNode* animatedModel = (scene::IAnimatedMeshSceneNode*)Model;
core::stringw str( (s32)core::round_(animatedModel->getAnimationSpeed()) );
str += L" Frame: ";
str += core::stringw((s32)animatedModel->getFrameNr());
aniInfo->setText(str.c_str());
}
else
aniInfo->setText(L"");
}
}
/*
......@@ -366,7 +394,7 @@ public:
if (id == GUI_ID_SKIN_TRANSPARENCY)
{
const s32 pos = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
SetSkinTransparency(pos, env->getSkin());
setSkinTransparency(pos, env->getSkin());
}
// control animation speed
else if (id == GUI_ID_SKIN_ANIMATION_FPS)
......@@ -406,18 +434,18 @@ public:
if (Model)
Model->setScale(scale);
UpdateScaleInfo(Model);
updateScaleInfo(Model);
}
break;
case GUI_ID_BUTTON_SCALE_MUL10:
if (Model)
Model->setScale(Model->getScale()*10.f);
UpdateScaleInfo(Model);
updateScaleInfo(Model);
break;
case GUI_ID_BUTTON_SCALE_DIV10:
if (Model)
Model->setScale(Model->getScale()*0.1f);
UpdateScaleInfo(Model);
updateScaleInfo(Model);
break;
case GUI_ID_BUTTON_OPEN_MODEL:
env->addFileOpenDialog(L"Please select a model file to open");
......@@ -810,7 +838,7 @@ int main(int argc, char* argv[])
image = driver->getTexture("help.png");
bar->addButton(GUI_ID_BUTTON_SHOW_ABOUT, 0, L"Open Help", image, 0, false, true);
// create a combobox with some senseless texts
// create a combobox for texture filters
gui::IGUIComboBox* box = env->addComboBox(core::rect<s32>(250,4,350,23), bar, GUI_ID_TEXTUREFILTER);
box->addItem(L"No filtering");
......@@ -914,12 +942,14 @@ int main(int argc, char* argv[])
driver->endScene();
// update information about current frame-rate
core::stringw str(L"FPS: ");
str.append(core::stringw(driver->getFPS()));
str += L" Tris: ";
str.append(core::stringw(driver->getPrimitiveCountDrawn()));
fpstext->setText(str.c_str());
// update information about the active camera
scene::ICameraSceneNode* cam = Device->getSceneManager()->getActiveCamera();
str = L"Pos: ";
str.append(core::stringw(cam->getPosition().X));
......@@ -934,6 +964,9 @@ int main(int argc, char* argv[])
str += L" ";
str.append(core::stringw(cam->getTarget().Z));
postext->setText(str.c_str());
// update the tool dialog
updateToolBox();
}
else
Device->yield();
......
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "18.SplitScreen", "SplitScreen.vcproj", "{EB3B38EA-5CE7-4983-845B-880661E69D09}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "18.SplitScreen", "SplitScreen.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
......@@ -9,10 +9,10 @@ Global
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.ActiveCfg = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.Build.0 = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.ActiveCfg = Release|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.Build.0 = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="18.SplitScreen"
ProjectGUID="{EB3B38EA-5CE7-4983-845B-880661E69D09}"
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
Keyword="Win32Proj">
<Platforms>
<Platform
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8,00"
Name="18.SplitScreen_vc8"
ProjectGUID="{E6F60924-57CD-47F9-A485-853A3BA08FBD}"
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
Keyword="Win32Proj"
>
<Platforms>
......
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MouseAndJoystick", "MouseAndJoystick.vcproj", "{1A16BBE1-A49B-4406-8883-681E6EA8702C}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MouseAndJoystick", "MouseAndJoystick.vcproj", "{FE853A36-E0D1-4AC5-A792-B643E70D2953}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
......@@ -9,10 +9,10 @@ Global
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Debug.ActiveCfg = Debug|Win32
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Debug.Build.0 = Debug|Win32
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Release.ActiveCfg = Release|Win32
{1A16BBE1-A49B-4406-8883-681E6EA8702C}.Release.Build.0 = Release|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug.ActiveCfg = Debug|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug.Build.0 = Debug|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release.ActiveCfg = Release|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="19.MouseAndJoystick"
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
ProjectGUID="{FE853A36-E0D1-4AC5-A792-B643E70D2953}"
SccProjectName=""
SccLocalPath="">
<Platforms>
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8.00"
Name="19.MouseAndJoystick_vc8"
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
ProjectGUID="{FE853A36-E0D1-4AC5-A792-B643E70D2953}"
RootNamespace="MouseAndJoystick_vc8"
>
<Platforms>
......
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "ManagedLights.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "ManagedLights.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -8,8 +8,8 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug|Win32.ActiveCfg = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release|Win32.ActiveCfg = Release|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug|Win32.ActiveCfg = Debug|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release|Win32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="20.ManagedLights"
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
ProjectGUID="{16007FE2-142B-47F8-93E1-519BA3F39E71}"
SccProjectName=""
SccLocalPath="">
<Platforms>
......
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MaterialViewer", "MaterialViewer.vcproj", "{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MaterialViewer", "MaterialViewer.vcproj", "{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
......@@ -9,10 +9,10 @@ Global
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Debug.ActiveCfg = Debug|Win32
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Debug.Build.0 = Debug|Win32
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Release.ActiveCfg = Release|Win32
{C4F5BB37-D873-4DE2-B7D0-A60A936798E1}.Release.Build.0 = Release|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Debug.ActiveCfg = Debug|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Debug.Build.0 = Debug|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Release.ActiveCfg = Release|Win32
{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
......
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Version="9,00"
Name="22.MaterialViewer"
ProjectGUID="{AFC223BD-4371-4A8B-A90B-0D338BD2DEBB}"
SccProjectName=""
SccLocalPath="">
ProjectGUID="{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"/>
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/MaterialViewer.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/MaterialViewer.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCCustomBuildTool"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="3079"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
ProgramDatabaseFile=".\Release/MaterialViewer.pdb"
SubSystem="1"
TargetMachine="1"/>
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/MaterialViewer.tlb"
HeaderFileName=""/>
Name="VCALinkTool"
/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManifestTool"
/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCXDCMakeTool"
/>
<Tool
Name="VCPreLinkEventTool"/>
Name="VCBscMakeTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="3079"/>
Name="VCFxCopTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCAppVerifierTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/MaterialViewer.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="2"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/MaterialViewer.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"/>
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="3079"
/>
<Tool
Name="VCCustomBuildTool"/>
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="..\..\bin\Win32-VisualStudio\22.MaterialViewer.exe"
LinkIncremental="0"
SuppressStartupBanner="TRUE"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
GenerateDebugInformation="TRUE"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/MaterialViewer.pdb"
SubSystem="1"
TargetMachine="1"/>
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/MaterialViewer.tlb"
HeaderFileName=""/>
Name="VCALinkTool"
/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManifestTool"
/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCXDCMakeTool"
/>
<Tool
Name="VCPreLinkEventTool"/>
Name="VCBscMakeTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="3079"/>
Name="VCFxCopTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCAppVerifierTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="main.cpp">
RelativePath="main.cpp"
>
<FileConfiguration
Name="Release|Win32">
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
BasicRuntimeChecks="3"
/>
</FileConfiguration>
</File>
</Files>
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8,00"
Name="22.MaterialViewer_vc8"
ProjectGUID="{2856AB41-9BC5-4716-9B35-762A65F6F5D1}"
ProjectGUID="{4E6C2F8D-BA92-4C5B-96FD-72D4FE8BD7FA}"
RootNamespace="MaterialViewer_vc8"
>
<Platforms>
......
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.SMeshHandling", "SMeshHandling.vcproj", "{EB3B38EA-5CE7-4983-845B-880661E69D09}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.SMeshHandling", "SMeshHandling.vcproj", "{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
......@@ -9,10 +9,10 @@ Global
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.ActiveCfg = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.Build.0 = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.ActiveCfg = Release|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Debug.ActiveCfg = Debug|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Debug.Build.0 = Debug|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Release.ActiveCfg = Release|Win32
{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="23.SMeshHandling"
ProjectGUID="{EB3B38EA-5CE7-4983-845B-880661E69D09}"
ProjectGUID="{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}"
Keyword="Win32Proj">
<Platforms>
<Platform
......
......@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8,00"
Name="23.SMeshHandling_vc8"
ProjectGUID="{08D2F676-9DEB-4443-AEF7-52CC6F7D5F7C}"
ProjectGUID="{6AEC2AA2-C9FF-4B7D-B07A-94A9D34B41D7}"
Keyword="Win32Proj"
>
<Platforms>
......
......@@ -74,7 +74,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16.Quake3MapShader", "16.Qu
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick", "19.MouseAndJoystick\MouseAndJoystick.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick", "19.MouseAndJoystick\MouseAndJoystick.vcproj", "{FE853A36-E0D1-4AC5-A792-B643E70D2953}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
......@@ -83,7 +83,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer", "21.Qua
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "20.ManagedLights\ManagedLights.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "20.ManagedLights\ManagedLights.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
......@@ -165,16 +165,16 @@ Global
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug.Build.0 = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.ActiveCfg = Release|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug.ActiveCfg = Debug|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release.ActiveCfg = Release|Win32
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.ActiveCfg = Debug|Win32
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.Build.0 = Debug|Win32
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.ActiveCfg = Release|Win32
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.Build.0 = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.Build.0 = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.Build.0 = Release|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.ActiveCfg = Debug|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.Build.0 = Debug|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.ActiveCfg = Release|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
......
......@@ -52,7 +52,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo_vc8", "Demo\Demo_vc8.v
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16.Quake3MapShader_vc8", "16.Quake3MapShader\Quake3MapShader_vc8.vcproj", "{EB3B38EA-5CE7-4983-845B-880661E69D09}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick_vc8", "19.MouseAndJoystick\MouseAndJoystick_vc8.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick_vc8", "19.MouseAndJoystick\MouseAndJoystick_vc8.vcproj", "{FE853A36-E0D1-4AC5-A792-B643E70D2953}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights_vc8", "20.ManagedLights\ManagedLights_vc8.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
ProjectSection(ProjectDependencies) = postProject
......@@ -150,10 +150,10 @@ Global
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Debug|Win32.Build.0 = Debug|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release|Win32.ActiveCfg = Release|Win32
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release|Win32.Build.0 = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug|Win32.ActiveCfg = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug|Win32.Build.0 = Debug|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release|Win32.ActiveCfg = Release|Win32
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release|Win32.Build.0 = Release|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug|Win32.ActiveCfg = Debug|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug|Win32.Build.0 = Debug|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release|Win32.ActiveCfg = Release|Win32
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release|Win32.Build.0 = Release|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug|Win32.ActiveCfg = Debug|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug|Win32.Build.0 = Debug|Win32
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release|Win32.ActiveCfg = Release|Win32
......
......@@ -6,7 +6,6 @@
#define __I_EVENT_RECEIVER_H_INCLUDED__
#include "ILogger.h"
#include "position2d.h"
#include "Keycodes.h"
#include "irrString.h"
......@@ -246,9 +245,12 @@ namespace irr
//! A tree view node was expanded. See IGUITreeView::getLastEventNode().
EGET_TREEVIEW_NODE_EXPAND,
//! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
//! deprecated - use EGET_TREEVIEW_NODE_COLLAPSE instead
EGET_TREEVIEW_NODE_COLLAPS,
//! A tree view node was collapsed. See IGUITreeView::getLastEventNode().
EGET_TREEVIEW_NODE_COLLAPSE = EGET_TREEVIEW_NODE_COLLAPS,
//! No real event. Just for convenience to get number of events
EGET_COUNT
};
......
......@@ -12,7 +12,7 @@ namespace irr
namespace gui
{
//! Standard file chooser dialog.
//! Standard color chooser dialog.
class IGUIColorSelectDialog : public IGUIElement
{
public:
......
......@@ -164,7 +164,7 @@ namespace scene
parameters) the position of the collision, and the triangle that was hit.
All scene nodes in the hierarchy tree under the specified node are checked. Only
notes that are visible, with an ID that matches at least one bit in the supplied
nodes that are visible, with an ID that matches at least one bit in the supplied
bitmask, and which have a triangle selector are considered as candidates for being hit.
You do not have to build a meta triangle selector; the individual triangle selectors
of each candidate scene node are used automatically.
......
......@@ -145,7 +145,7 @@ namespace scene
//! Returns the last triangle that caused a collision
virtual const core::triangle3df & getCollisionTriangle() const = 0;
//! Returns the position that the target node will be moved to, unless the collision is consumed in a callback).
//! Returns the position that the target node will be moved to, unless the collision is consumed in a callback.
/**
If you have a collision callback registered, and it consumes the collision, then the
node will ignore the collision and will not stop at this position. Instead, it will
......
......@@ -78,7 +78,7 @@ struct SLight
/** If Type is ELT_POINT, it is ignored. Changed via light scene node's rotation. */
core::vector3df Direction;
//! Read-ONLY! Radius of light. Everything within this radius be be lighted.
//! Read-ONLY! Radius of light. Everything within this radius will be lighted.
f32 Radius;
//! Read-ONLY! Type of the light. Default: ELT_POINT
......
......@@ -195,8 +195,8 @@ namespace core
\return Interpolated dimension. */
dimension2d<T> getInterpolated(const dimension2d<T>& other, f32 d) const
{
T inv = (T) (1.0f - d);
return dimension2d<T>(other.Width*inv + Width*d, other.Height*inv + Height*d);
f32 inv = (1.0f - d);
return dimension2d<T>( (T)(other.Width*inv + Width*d), (T)(other.Height*inv + Height*d));
}
......
......@@ -162,10 +162,10 @@ namespace core
}
//! swaps the content of the passed parameters
// Note: We use the same trick as boost and use two template arguments to
// avoid ambiguity when swapping objectsof an Irrlicht type that has not
// it's own swap overload. Otherwise we get conflicts with some compilers
// in combination with stl.
// Note: We use the same trick as boost and use two template arguments to
// avoid ambiguity when swapping objects of an Irrlicht type that has not
// it's own swap overload. Otherwise we get conflicts with some compilers
// in combination with stl.
template <class T1, class T2>
inline void swap(T1& a, T2& b)
{
......
......@@ -204,7 +204,7 @@ namespace core
//! Get the area of the triangle
T getArea() const
{
return (pointB - pointA).crossProduct(pointC - pointA).getLength() * 0.5;
return (pointB - pointA).crossProduct(pointC - pointA).getLength() * 0.5f;
}
......
......@@ -192,14 +192,14 @@ public:
if ( Y > 0)
if (X > 0)
return atan(Y/X) * RADTODEG64;
return atan((irr::f64)Y/(irr::f64)X) * RADTODEG64;
else
return 180.0-atan(Y/-X) * RADTODEG64;
return 180.0-atan((irr::f64)Y/-(irr::f64)X) * RADTODEG64;
else
if (X > 0)
return 360.0-atan(-Y/X) * RADTODEG64;
return 360.0-atan(-(irr::f64)Y/(irr::f64)X) * RADTODEG64;
else
return 180.0+atan(-Y/-X) * RADTODEG64;
return 180.0+atan(-(irr::f64)Y/-(irr::f64)X) * RADTODEG64;
}
//! Calculates the angle of this vector in degrees in the counter trigonometric sense.
......
......@@ -32,7 +32,7 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
const core::vector3df& rotation,
const core::vector3df& scale)
: IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0),
BeginFrameTime(0), StartFrame(0), EndFrame(0), FramesPerSecond(0.f),
StartFrame(0), EndFrame(0), FramesPerSecond(0.f),
CurrentFrameNr(0.f), LastTimeMs(0),
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
JointMode(EJUOR_NONE), JointsUsed(false),
......@@ -44,7 +44,6 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
setDebugName("CAnimatedMeshSceneNode");
#endif
BeginFrameTime = os::Timer::getTime();
FramesPerSecond = 25.f/1000.f;
setMesh(mesh);
......@@ -78,12 +77,6 @@ void CAnimatedMeshSceneNode::setCurrentFrame(f32 frame)
// if you pass an out of range value, we just clamp it
CurrentFrameNr = core::clamp ( frame, (f32)StartFrame, (f32)EndFrame );
BeginFrameTime = os::Timer::getTime();
if (FramesPerSecond > 0)
BeginFrameTime += (s32)((CurrentFrameNr - StartFrame) / FramesPerSecond);
else if (FramesPerSecond < 0)
BeginFrameTime += (s32)((CurrentFrameNr - EndFrame) / -FramesPerSecond);
beginTransition(); //transit to this frame if enabled
}
......@@ -115,15 +108,18 @@ void CAnimatedMeshSceneNode::buildFrameNr(u32 timeMs)
{
// play animation looped
CurrentFrameNr += timeMs * FramesPerSecond;
// We have no interpolation between EndFrame and StartFrame,
// the last frame must be identical to first one with our current solution.
if (FramesPerSecond > 0.f) //forwards...
{
if (CurrentFrameNr > EndFrame)
CurrentFrameNr -= (EndFrame-StartFrame);
CurrentFrameNr = StartFrame + fmod(CurrentFrameNr - StartFrame, (f32)(EndFrame-StartFrame));
}
else //backwards...
{
if (CurrentFrameNr < StartFrame)
CurrentFrameNr += (EndFrame-StartFrame);
CurrentFrameNr = EndFrame - fmod(EndFrame - CurrentFrameNr, (f32)(EndFrame-StartFrame));
}
}
else
......@@ -1076,7 +1072,6 @@ ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager*
newNode->Materials = Materials;
newNode->Box = Box;
newNode->Mesh = Mesh;
newNode->BeginFrameTime = BeginFrameTime;
newNode->StartFrame = StartFrame;
newNode->EndFrame = EndFrame;
newNode->FramesPerSecond = FramesPerSecond;
......
......@@ -175,7 +175,6 @@ namespace scene
core::aabbox3d<f32> Box;
IAnimatedMesh* Mesh;
u32 BeginFrameTime;
s32 StartFrame;
s32 EndFrame;
f32 FramesPerSecond;
......
......@@ -2223,6 +2223,12 @@ IImage* CD3D8Driver::createScreenShot()
clientRect.top = clientPoint.y;
clientRect.right = clientRect.left + ScreenSize.Width;
clientRect.bottom = clientRect.top + ScreenSize.Height;
// window can be off-screen partly, we can't take screenshots from that
clientRect.left = core::max_(clientRect.left, 0l);
clientRect.top = core::max_(clientRect.top, 0l);
clientRect.right = core::min_(clientRect.right, (long)displayMode.Width);
clientRect.bottom = core::min_(clientRect.bottom, (long)displayMode.Height );
}
// lock our area of the surface
......@@ -2233,8 +2239,12 @@ IImage* CD3D8Driver::createScreenShot()
return 0;
}
irr::core::dimension2d<u32> shotSize;
shotSize.Width = core::min_( ScreenSize.Width, (u32)(clientRect.right-clientRect.left) );
shotSize.Height = core::min_( ScreenSize.Height, (u32)(clientRect.bottom-clientRect.top) );
// this could throw, but we aren't going to worry about that case very much
IImage* newImage = new CImage(ECF_A8R8G8B8, ScreenSize);
IImage* newImage = new CImage(ECF_A8R8G8B8, shotSize);
// d3d pads the image, so we need to copy the correct number of bytes
u32* dP = (u32*)newImage->lock();
......@@ -2245,26 +2255,26 @@ IImage* CD3D8Driver::createScreenShot()
// set each pixel alpha value to 255.
if(D3DFMT_X8R8G8B8 == displayMode.Format && (0xFF000000 != (*dP & 0xFF000000)))
{
for (u32 y = 0; y < ScreenSize.Height; ++y)
for (u32 y = 0; y < shotSize.Height; ++y)
{
for(u32 x = 0; x < ScreenSize.Width; ++x)
for(u32 x = 0; x < shotSize.Width; ++x)
{
*dP = *((u32*)sP) | 0xFF000000;
dP++;
sP += 4;
}
sP += lockedRect.Pitch - (4 * ScreenSize.Width);
sP += lockedRect.Pitch - (4 * shotSize.Width);
}
}
else
{
for (u32 y = 0; y < ScreenSize.Height; ++y)
for (u32 y = 0; y < shotSize.Height; ++y)
{
memcpy(dP, sP, ScreenSize.Width * 4);
memcpy(dP, sP, shotSize.Width * 4);
sP += lockedRect.Pitch;
dP += ScreenSize.Width;
dP += shotSize.Width;
}
}
......
......@@ -3136,6 +3136,12 @@ IImage* CD3D9Driver::createScreenShot()
clientRect.top = clientPoint.y;
clientRect.right = clientRect.left + ScreenSize.Width;
clientRect.bottom = clientRect.top + ScreenSize.Height;
// window can be off-screen partly, we can't take screenshots from that
clientRect.left = core::max_(clientRect.left, 0l);
clientRect.top = core::max_(clientRect.top, 0l);
clientRect.right = core::min_(clientRect.right, (long)displayMode.Width);
clientRect.bottom = core::min_(clientRect.bottom, (long)displayMode.Height );
}
// lock our area of the surface
......@@ -3146,8 +3152,12 @@ IImage* CD3D9Driver::createScreenShot()
return 0;
}
irr::core::dimension2d<u32> shotSize;
shotSize.Width = core::min_( ScreenSize.Width, (u32)(clientRect.right-clientRect.left) );
shotSize.Height = core::min_( ScreenSize.Height, (u32)(clientRect.bottom-clientRect.top) );
// this could throw, but we aren't going to worry about that case very much
IImage* newImage = new CImage(ECF_A8R8G8B8, ScreenSize);
IImage* newImage = new CImage(ECF_A8R8G8B8, shotSize);
// d3d pads the image, so we need to copy the correct number of bytes
u32* dP = (u32*)newImage->lock();
......@@ -3158,26 +3168,26 @@ IImage* CD3D9Driver::createScreenShot()
// set each pixel alpha value to 255.
if(D3DFMT_X8R8G8B8 == displayMode.Format && (0xFF000000 != (*dP & 0xFF000000)))
{
for (u32 y = 0; y < ScreenSize.Height; ++y)
for (u32 y = 0; y < shotSize.Height; ++y)
{
for(u32 x = 0; x < ScreenSize.Width; ++x)
for(u32 x = 0; x < shotSize.Width; ++x)
{
*dP = *((u32*)sP) | 0xFF000000;
dP++;
sP += 4;
}
sP += lockedRect.Pitch - (4 * ScreenSize.Width);
sP += lockedRect.Pitch - (4 * shotSize.Width);
}
}
else
{
for (u32 y = 0; y < ScreenSize.Height; ++y)
for (u32 y = 0; y < shotSize.Height; ++y)
{
memcpy(dP, sP, ScreenSize.Width * 4);
memcpy(dP, sP, shotSize.Width * 4);
sP += lockedRect.Pitch;
dP += ScreenSize.Width;
dP += shotSize.Width;
}
}
......
......@@ -64,7 +64,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
SelectedText->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
SelectedText->setTextAlignment(EGUIA_UPPERLEFT, EGUIA_CENTER);
if (skin)
SelectedText->setOverrideColor(skin->getColor(EGDC_BUTTON_TEXT));
SelectedText->setOverrideColor(skin->getColor(EGDC_BUTTON_TEXT));
SelectedText->enableOverrideColor(true);
// this element can be tabbed to
......@@ -363,20 +363,23 @@ void CGUIComboBox::draw()
{
HasFocus = currentFocus == this || isMyChild(currentFocus);
LastFocus = currentFocus;
}
SelectedText->setBackgroundColor(skin->getColor(EGDC_HIGH_LIGHT));
if(isEnabled())
{
SelectedText->setDrawBackground(HasFocus);
SelectedText->setOverrideColor(skin->getColor(HasFocus ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT));
}
else
{
SelectedText->setDrawBackground(false);
SelectedText->setOverrideColor(skin->getColor(EGDC_GRAY_TEXT));
}
// set colors each time as skin-colors can be changed
SelectedText->setBackgroundColor(skin->getColor(EGDC_HIGH_LIGHT));
if(isEnabled())
{
SelectedText->setDrawBackground(HasFocus);
SelectedText->setOverrideColor(skin->getColor(HasFocus ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT));
}
else
{
SelectedText->setDrawBackground(false);
SelectedText->setOverrideColor(skin->getColor(EGDC_GRAY_TEXT));
}
ListButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL));
ListButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL));
core::rect<s32> frameRect(AbsoluteRect);
......
......@@ -498,6 +498,7 @@ void CGUIEnvironment::updateHoveredElement(core::position2d<s32> mousePos)
if (lastHovered)
{
event.GUIEvent.Caller = lastHovered;
event.GUIEvent.Element = 0;
event.GUIEvent.EventType = EGET_ELEMENT_LEFT;
lastHovered->OnEvent(event);
}
......
......@@ -280,6 +280,13 @@ void CGUIScrollBar::draw()
return;
video::SColor iconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
if ( iconColor != CurrentIconColor )
{
refreshControls();
}
SliderRect = AbsoluteRect;
// draws the background
......@@ -436,7 +443,7 @@ s32 CGUIScrollBar::getPos() const
//! refreshes the position and text on child buttons
void CGUIScrollBar::refreshControls()
{
video::SColor color(255,255,255,255);
CurrentIconColor = video::SColor(255,255,255,255);
IGUISkin* skin = Environment->getSkin();
IGUISpriteBank* sprites = 0;
......@@ -444,7 +451,7 @@ void CGUIScrollBar::refreshControls()
if (skin)
{
sprites = skin->getSpriteBank();
color = skin->getColor(EGDC_WINDOW_SYMBOL);
CurrentIconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
}
if (Horizontal)
......@@ -459,8 +466,8 @@ void CGUIScrollBar::refreshControls()
if (sprites)
{
UpButton->setSpriteBank(sprites);
UpButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_LEFT), color);
UpButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_LEFT), color);
UpButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_LEFT), CurrentIconColor);
UpButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_LEFT), CurrentIconColor);
}
UpButton->setRelativePosition(core::rect<s32>(0,0, h, h));
UpButton->setAlignment(EGUIA_UPPERLEFT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
......@@ -473,8 +480,8 @@ void CGUIScrollBar::refreshControls()
if (sprites)
{
DownButton->setSpriteBank(sprites);
DownButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_RIGHT), color);
DownButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_RIGHT), color);
DownButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_RIGHT), CurrentIconColor);
DownButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_RIGHT), CurrentIconColor);
}
DownButton->setRelativePosition(core::rect<s32>(RelativeRect.getWidth()-h, 0, RelativeRect.getWidth(), h));
DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
......@@ -491,8 +498,8 @@ void CGUIScrollBar::refreshControls()
if (sprites)
{
UpButton->setSpriteBank(sprites);
UpButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_UP), color);
UpButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_UP), color);
UpButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_UP), CurrentIconColor);
UpButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_UP), CurrentIconColor);
}
UpButton->setRelativePosition(core::rect<s32>(0,0, w, w));
UpButton->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
......@@ -505,8 +512,8 @@ void CGUIScrollBar::refreshControls()
if (sprites)
{
DownButton->setSpriteBank(sprites);
DownButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_DOWN), color);
DownButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_DOWN), color);
DownButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_DOWN), CurrentIconColor);
DownButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_DOWN), CurrentIconColor);
}
DownButton->setRelativePosition(core::rect<s32>(0,RelativeRect.getHeight()-w, w, RelativeRect.getHeight()));
DownButton->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
......@@ -525,6 +532,7 @@ void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeRead
out->addInt ("Max", Max);
out->addInt ("SmallStep", SmallStep);
out->addInt ("LargeStep", LargeStep);
// CurrentIconColor - not serialized as continuiously updated
}
......@@ -539,6 +547,7 @@ void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeRea
setPos(in->getAttributeAsInt("Value"));
setSmallStep(in->getAttributeAsInt("SmallStep"));
setLargeStep(in->getAttributeAsInt("LargeStep"));
// CurrentIconColor - not serialized as continuiously updated
refreshControls();
}
......
......@@ -99,6 +99,7 @@ namespace gui
s32 LargeStep;
s32 DesiredPos;
u32 LastChange;
video::SColor CurrentIconColor;
f32 range () const { return (f32) ( Max - Min ); }
};
......
......@@ -578,12 +578,12 @@ core::rect<s32> CGUISkin::draw3DWindowBackground(IGUIElement* element,
//else
if ( Type == EGST_BURNING_SKIN )
{
const video::SColor c = titleBarColor.getInterpolated( 0xffffffff, 0.8f);
const video::SColor c = titleBarColor.getInterpolated( video::SColor(titleBarColor.getAlpha(),255,255,255), 0.8f);
Driver->draw2DRectangle(rect, titleBarColor, titleBarColor, c, c, clip);
}
else
{
const video::SColor c = titleBarColor.getInterpolated(video::SColor(255,0,0,0), 0.2f);
const video::SColor c = titleBarColor.getInterpolated(video::SColor(titleBarColor.getAlpha(),0,0,0), 0.2f);
Driver->draw2DRectangle(rect, titleBarColor, c, titleBarColor, c, clip);
}
}
......@@ -909,8 +909,9 @@ void CGUISkin::drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon,
if (!SpriteBank)
return;
// TODO: we need another state for disabled elements (can't add now because it's an interface change)
SpriteBank->draw2DSprite(Icons[icon], position, clip,
video::SColor(255,0,0,0), starttime, currenttime, loop, true);
Colors[EGDC_WINDOW_SYMBOL], starttime, currenttime, loop, true);
}
......
......@@ -29,6 +29,7 @@ CGUISpinBox::CGUISpinBox(const wchar_t* text, bool border,IGUIEnvironment* envir
setDebugName("CGUISpinBox");
#endif
CurrentIconColor = video::SColor(255,255,255,255);
s32 ButtonWidth = 16;
IGUISpriteBank *sb = 0;
if (environment && environment->getSkin())
......@@ -52,27 +53,14 @@ CGUISpinBox::CGUISpinBox(const wchar_t* text, bool border,IGUIEnvironment* envir
ButtonSpinUp->setSubElement(true);
ButtonSpinUp->setTabStop(false);
ButtonSpinUp->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_CENTER);
if (sb)
{
IGUISkin *skin = environment->getSkin();
ButtonSpinDown->setSpriteBank(sb);
ButtonSpinDown->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_SMALL_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL));
ButtonSpinDown->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_SMALL_CURSOR_DOWN), skin->getColor(EGDC_WINDOW_SYMBOL));
ButtonSpinUp->setSpriteBank(sb);
ButtonSpinUp->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_SMALL_CURSOR_UP), skin->getColor(EGDC_WINDOW_SYMBOL));
ButtonSpinUp->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_SMALL_CURSOR_UP), skin->getColor(EGDC_WINDOW_SYMBOL));
}
else
{
ButtonSpinDown->setText(L"-");
ButtonSpinUp->setText(L"+");
}
const core::rect<s32> rectEdit(0, 0, rectangle.getWidth() - ButtonWidth - 1, rectangle.getHeight());
EditBox = Environment->addEditBox(text, rectEdit, border, this, -1);
EditBox->grab();
EditBox->setSubElement(true);
EditBox->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
refreshSprites();
}
......@@ -87,6 +75,31 @@ CGUISpinBox::~CGUISpinBox()
EditBox->drop();
}
void CGUISpinBox::refreshSprites()
{
IGUISpriteBank *sb = 0;
if (Environment && Environment->getSkin())
{
sb = Environment->getSkin()->getSpriteBank();
}
if (sb)
{
IGUISkin * skin = Environment->getSkin();
CurrentIconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
ButtonSpinDown->setSpriteBank(sb);
ButtonSpinDown->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_SMALL_CURSOR_DOWN), CurrentIconColor);
ButtonSpinDown->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_SMALL_CURSOR_DOWN), CurrentIconColor);
ButtonSpinUp->setSpriteBank(sb);
ButtonSpinUp->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_SMALL_CURSOR_UP), CurrentIconColor);
ButtonSpinUp->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_SMALL_CURSOR_UP), CurrentIconColor);
}
else
{
ButtonSpinDown->setText(L"-");
ButtonSpinUp->setText(L"+");
}
}
IGUIEditBox* CGUISpinBox::getEditBox() const
{
......@@ -235,6 +248,11 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
void CGUISpinBox::verifyValueRange()
{
// TODO: This should be called in "draw" similar to the way it's done in CGUIWindow.
// But guess I can't in bugfix-release as overloading draw would break binary compitibility.
// So added here to allow users at least to manually force the element to having new skin-colors.
refreshSprites();
f32 val = getValue();
if ( val+core::ROUNDING_ERROR_f32 < RangeMin )
val = RangeMin;
......
......@@ -80,10 +80,12 @@ namespace gui
protected:
virtual void verifyValueRange();
void refreshSprites();
IGUIEditBox * EditBox;
IGUIButton * ButtonSpinUp;
IGUIButton * ButtonSpinDown;
video::SColor CurrentIconColor;
f32 StepSize;
f32 RangeMin;
f32 RangeMax;
......
......@@ -23,7 +23,7 @@ CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border,
bool background)
: IGUIStaticText(environment, parent, id, rectangle),
HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_UPPERLEFT),
Border(border), OverrideColorEnabled(false), WordWrap(false), Background(background),
Border(border), OverrideColorEnabled(false), OverrideBGColorEnabled(false), WordWrap(false), Background(background),
OverrideColor(video::SColor(101,255,255,255)), BGColor(video::SColor(101,210,210,210)),
OverrideFont(0), LastBreakFont(0)
{
......@@ -64,6 +64,9 @@ void CGUIStaticText::draw()
if (Background)
{
if ( !OverrideBGColorEnabled ) // skin-colors can change
BGColor = skin->getColor(gui::EGDC_3D_FACE);
driver->draw2DRectangle(BGColor, frameRect, &AbsoluteClippingRect);
}
......@@ -177,6 +180,7 @@ void CGUIStaticText::setOverrideColor(video::SColor color)
void CGUIStaticText::setBackgroundColor(video::SColor color)
{
BGColor = color;
OverrideBGColorEnabled = true;
Background = true;
}
......@@ -425,9 +429,11 @@ void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeRea
out->addBool ("Border", Border);
out->addBool ("OverrideColorEnabled",OverrideColorEnabled);
out->addBool ("WordWrap", WordWrap);
out->addBool ("OverrideBGColorEnabled",OverrideBGColorEnabled);
out->addBool ("WordWrap", WordWrap);
out->addBool ("Background", Background);
out->addColor ("OverrideColor", OverrideColor);
out->addColor ("BGColor", BGColor);
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
......@@ -441,11 +447,12 @@ void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
IGUIStaticText::deserializeAttributes(in,options);
Border = in->getAttributeAsBool("Border");
OverrideColor = in->getAttributeAsColor("OverrideColor");
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled");
setWordWrap(in->getAttributeAsBool("WordWrap"));
Background = in->getAttributeAsBool("Background");
OverrideColor = in->getAttributeAsColor("OverrideColor");
BGColor = in->getAttributeAsColor("BGColor");
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
......
......@@ -94,6 +94,7 @@ namespace gui
EGUI_ALIGNMENT HAlign, VAlign;
bool Border;
bool OverrideColorEnabled;
bool OverrideBGColorEnabled;
bool WordWrap;
bool Background;
......
......@@ -27,7 +27,7 @@ CGUITab::CGUITab(s32 number, IGUIEnvironment* environment,
IGUIElement* parent, const core::rect<s32>& rectangle,
s32 id)
: IGUITab(environment, parent, id, rectangle), Number(number),
BackColor(0,0,0,0), TextColor(255,0,0,0),
BackColor(0,0,0,0), OverrideTextColorEnabled(false), TextColor(255,0,0,0),
DrawBackground(false)
{
#ifdef _DEBUG
......@@ -54,6 +54,13 @@ void CGUITab::setNumber(s32 n)
Number = n;
}
void CGUITab::refreshSkinColors()
{
if ( !OverrideTextColorEnabled )
{
TextColor = Environment->getSkin()->getColor(EGDC_BUTTON_TEXT);
}
}
//! draws the element and its children
void CGUITab::draw()
......@@ -87,6 +94,7 @@ void CGUITab::setBackgroundColor(video::SColor c)
//! sets the color of the text
void CGUITab::setTextColor(video::SColor c)
{
OverrideTextColorEnabled = true;
TextColor = c;
}
......@@ -120,6 +128,7 @@ void CGUITab::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteO
out->addInt ("TabNumber", Number);
out->addBool ("DrawBackground", DrawBackground);
out->addColor ("BackColor", BackColor);
out->addBool ("OverrideTextColorEnabled", OverrideTextColorEnabled);
out->addColor ("TextColor", TextColor);
}
......@@ -133,7 +142,12 @@ void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrite
setNumber(in->getAttributeAsInt("TabNumber"));
setDrawBackground(in->getAttributeAsBool("DrawBackground"));
setBackgroundColor(in->getAttributeAsColor("BackColor"));
bool override = in->getAttributeAsBool("OverrideTextColorEnabled");
setTextColor(in->getAttributeAsColor("TextColor"));
if ( !override )
{
OverrideTextColorEnabled = false;
}
if (Parent && Parent->getType() == EGUIET_TAB_CONTROL)
{
......@@ -395,18 +409,18 @@ s32 CGUITabControl::calcTabWidth(s32 pos, IGUIFont* font, const wchar_t* text, b
{
if ( !font )
return 0;
s32 len = font->getDimension(text).Width + TabExtraWidth;
if ( TabMaxWidth > 0 && len > TabMaxWidth )
len = TabMaxWidth;
// check if we miss the place to draw the tab-button
if ( withScrollControl && ScrollControl && pos+len > UpButton->getAbsolutePosition().UpperLeftCorner.X - 2 )
{
s32 tabMinWidth = font->getDimension(L"A").Width;
if ( TabExtraWidth > 0 && TabExtraWidth > tabMinWidth )
tabMinWidth = TabExtraWidth;
if ( ScrollControl && pos+tabMinWidth <= UpButton->getAbsolutePosition().UpperLeftCorner.X - 2 )
{
len = UpButton->getAbsolutePosition().UpperLeftCorner.X - 2 - pos;
......@@ -499,7 +513,7 @@ bool CGUITabControl::selectTab(core::position2d<s32> p)
s32 len = calcTabWidth(pos, font, text, true);
if ( ScrollControl && pos+len > UpButton->getAbsolutePosition().UpperLeftCorner.X - 2 )
return false;
frameRect.UpperLeftCorner.X = pos;
frameRect.LowerRightCorner.X = frameRect.UpperLeftCorner.X + len;
......@@ -552,7 +566,7 @@ void CGUITabControl::draw()
bool needLeftScroll = CurrentScrollTabIndex > 0;
bool needRightScroll = false;
// left and right pos of the active tab
s32 left = 0;
s32 right = 0;
......@@ -581,6 +595,9 @@ void CGUITabControl::draw()
pos += len;
if ( text )
Tabs[i]->refreshSkinColors();
if ((s32)i == ActiveTab)
{
left = frameRect.UpperLeftCorner.X;
......@@ -669,7 +686,7 @@ void CGUITabControl::draw()
}
skin->draw3DTabBody(this, Border, FillBackground, AbsoluteRect, &AbsoluteClippingRect, TabHeight, VerticalAlignment);
// enable scrollcontrols on need
if ( UpButton )
UpButton->setEnabled(needLeftScroll);
......@@ -704,7 +721,7 @@ void CGUITabControl::setTabMaxWidth(s32 width )
{
TabMaxWidth = width;
}
//! get the maximal width of a tab
s32 CGUITabControl::getTabMaxWidth() const
{
......
......@@ -65,11 +65,14 @@ namespace gui
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
//! only for internal use by CGUITabControl
void refreshSkinColors();
private:
s32 Number;
video::SColor BackColor;
bool OverrideTextColorEnabled;
video::SColor TextColor;
bool DrawBackground;
};
......@@ -125,16 +128,16 @@ namespace gui
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
//! Get the height of the tabs
virtual s32 getTabHeight() const;
//! set the maximal width of a tab. Per default width is 0 which means "no width restriction".
virtual void setTabMaxWidth(s32 width );
//! get the maximal width of a tab
virtual s32 getTabMaxWidth() const;
//! Set the alignment of the tabs
//! note: EGUIA_CENTER is not an option
virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment );
......
......@@ -78,12 +78,6 @@ void CGUITable::addColumn(const wchar_t* caption, s32 columnIndex)
tabHeader.Width = Font->getDimension(caption).Width + (CellWidthPadding * 2) + ARROW_PAD;
tabHeader.OrderingMode = EGCO_NONE;
IGUISkin* skin = Environment->getSkin();
if (skin)
{
tabHeader.TextColor = skin->getColor(EGDC_BUTTON_TEXT);
}
if ( columnIndex < 0 || columnIndex >= (s32)Columns.size() )
{
Columns.push_back(tabHeader);
......@@ -166,6 +160,7 @@ bool CGUITable::setActiveColumn(s32 idx, bool doOrder )
SEvent event;
event.EventType = EET_GUI_EVENT;
event.GUIEvent.Caller = this;
event.GUIEvent.Element = 0;
event.GUIEvent.EventType = EGET_TABLE_HEADER_CHANGED;
Parent->OnEvent(event);
}
......@@ -195,6 +190,7 @@ bool CGUITable::setActiveColumn(s32 idx, bool doOrder )
SEvent event;
event.EventType = EET_GUI_EVENT;
event.GUIEvent.Caller = this;
event.GUIEvent.Element = 0;
event.GUIEvent.EventType = EGET_TABLE_HEADER_CHANGED;
Parent->OnEvent(event);
}
......@@ -306,6 +302,7 @@ void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const core::stringw&
Rows[rowIndex].Items[columnIndex].Text = text;
breakText( Rows[rowIndex].Items[columnIndex].Text, Rows[rowIndex].Items[columnIndex].BrokenText, Columns[columnIndex].Width );
Rows[rowIndex].Items[columnIndex].Color = color;
Rows[rowIndex].Items[columnIndex].IsOverrideColor = true;
}
}
......@@ -315,6 +312,7 @@ void CGUITable::setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color)
if ( rowIndex < Rows.size() && columnIndex < Columns.size() )
{
Rows[rowIndex].Items[columnIndex].Color = color;
Rows[rowIndex].Items[columnIndex].IsOverrideColor = true;
}
}
......@@ -852,6 +850,7 @@ void CGUITable::selectNew(s32 ypos, bool onlyHover)
SEvent event;
event.EventType = EET_GUI_EVENT;
event.GUIEvent.Caller = this;
event.GUIEvent.Element = 0;
event.GUIEvent.EventType = (Selected != oldSelected) ? EGET_TABLE_CHANGED : EGET_TABLE_SELECTED_AGAIN;
Parent->OnEvent(event);
}
......@@ -950,6 +949,8 @@ void CGUITable::draw()
}
else
{
if ( !Rows[i].Items[j].IsOverrideColor ) // skin-colors can change
Rows[i].Items[j].Color = skin->getColor(EGDC_BUTTON_TEXT);
font->draw(Rows[i].Items[j].BrokenText.c_str(), textRect, IsEnabled ? Rows[i].Items[j].Color : skin->getColor(EGDC_GRAY_TEXT), false, true, &clientClip);
}
......@@ -1092,8 +1093,6 @@ void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrit
label = "Column"; label += i; label += "name";
out->addString(label.c_str(), Columns[i].Name.c_str() );
label = "Column"; label += i; label += "color";
out->addColor(label.c_str(), Columns[i].TextColor );
label = "Column"; label += i; label += "width";
out->addInt(label.c_str(), Columns[i].Width );
label = "Column"; label += i; label += "OrderingMode";
......@@ -1119,6 +1118,8 @@ void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrit
// core::stringw BrokenText; // can be recalculated
label = "Row"; label += i; label += "cell"; label += c; label += "color";
out->addColor(label.c_str(), Rows[i].Items[c].Color );
label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";
out->addColor(label.c_str(), Rows[i].Items[c].IsOverrideColor );
// void *data; // can't be serialized
}
}
......@@ -1162,8 +1163,6 @@ void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWri
label = "Column"; label += i; label += "name";
column.Name = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
label = "Column"; label += i; label += "color";
column.TextColor = in->getAttributeAsColor(label.c_str());
label = "Column"; label += i; label += "width";
column.Width = in->getAttributeAsInt(label.c_str());
label = "Column"; label += i; label += "OrderingMode";
......@@ -1202,6 +1201,9 @@ void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWri
breakText( cell.Text, cell.BrokenText, Columns[c].Width );
label = "Row"; label += i; label += "cell"; label += c; label += "color";
cell.Color = in->getAttributeAsColor(label.c_str());
label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";
cell.IsOverrideColor = in->getAttributeAsBool(label.c_str());
cell.Data = NULL;
Rows[Rows.size()-1].Items.push_back(cell);
......
......@@ -158,9 +158,10 @@ namespace gui
struct Cell
{
Cell() : Data(0) {}
Cell() : IsOverrideColor(false), Data(0) {}
core::stringw Text;
core::stringw BrokenText;
bool IsOverrideColor;
video::SColor Color;
void *Data;
};
......@@ -175,7 +176,6 @@ namespace gui
{
Column() : Width(0), OrderingMode(EGCO_NONE) {}
core::stringw Name;
video::SColor TextColor;
u32 Width;
EGUI_COLUMN_ORDERING OrderingMode;
};
......
......@@ -699,6 +699,7 @@ void CGUITreeView::mouseAction( s32 xpos, s32 ypos, bool onlyHover /*= false*/ )
event.EventType = EET_GUI_EVENT;
event.GUIEvent.Caller = this;
event.GUIEvent.Element = 0;
xpos -= AbsoluteRect.UpperLeftCorner.X;
ypos -= AbsoluteRect.UpperLeftCorner.Y;
......
......@@ -29,15 +29,12 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
if (environment)
skin = environment->getSkin();
IGUISpriteBank* sprites = 0;
video::SColor color(255,255,255,255);
CurrentIconColor = video::SColor(255,255,255,255);
s32 buttonw = 15;
if (skin)
{
buttonw = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
sprites = skin->getSpriteBank();
color = skin->getColor(EGDC_WINDOW_SYMBOL);
}
s32 posx = RelativeRect.getWidth() - buttonw - 4;
......@@ -46,12 +43,6 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
CloseButton->setSubElement(true);
CloseButton->setTabStop(false);
CloseButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
CloseButton->setSpriteBank(sprites);
CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), color);
CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), color);
}
posx -= buttonw + 2;
RestoreButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
......@@ -60,12 +51,6 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
RestoreButton->setSubElement(true);
RestoreButton->setTabStop(false);
RestoreButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
RestoreButton->setSpriteBank(sprites);
RestoreButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_RESTORE), color);
RestoreButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_RESTORE), color);
}
posx -= buttonw + 2;
MinButton = Environment->addButton(core::rect<s32>(posx, 3, posx + buttonw, 3 + buttonw), this, -1,
......@@ -74,12 +59,6 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
MinButton->setSubElement(true);
MinButton->setTabStop(false);
MinButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
if (sprites)
{
MinButton->setSpriteBank(sprites);
MinButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_MINIMIZE), color);
MinButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_MINIMIZE), color);
}
MinButton->grab();
RestoreButton->grab();
......@@ -90,6 +69,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id
setTabStop(true);
setTabOrder(-1);
refreshSprites();
updateClientRect();
}
......@@ -107,6 +87,35 @@ CGUIWindow::~CGUIWindow()
CloseButton->drop();
}
void CGUIWindow::refreshSprites()
{
if (!Environment)
return;
IGUISkin* skin = Environment->getSkin();
if ( !skin )
return;
IGUISpriteBank* sprites = skin->getSpriteBank();
if ( !sprites )
return;
CurrentIconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
if (sprites)
{
CloseButton->setSpriteBank(sprites);
CloseButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_CLOSE), CurrentIconColor);
CloseButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_CLOSE), CurrentIconColor);
RestoreButton->setSpriteBank(sprites);
RestoreButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_RESTORE), CurrentIconColor);
RestoreButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_RESTORE), CurrentIconColor);
MinButton->setSpriteBank(sprites);
MinButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_WINDOW_MINIMIZE), CurrentIconColor);
MinButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_WINDOW_MINIMIZE), CurrentIconColor);
}
}
//! called if an event happened.
bool CGUIWindow::OnEvent(const SEvent& event)
......@@ -223,9 +232,13 @@ void CGUIWindow::draw()
{
IGUISkin* skin = Environment->getSkin();
// update each time because the skin is allowed to change this always.
updateClientRect();
if ( CurrentIconColor != skin->getColor(EGDC_WINDOW_SYMBOL) )
refreshSprites();
core::rect<s32> rect = AbsoluteRect;
// draw body fast
......
......@@ -75,11 +75,13 @@ namespace gui
protected:
void updateClientRect();
void refreshSprites();
IGUIButton* CloseButton;
IGUIButton* MinButton;
IGUIButton* RestoreButton;
core::rect<s32> ClientRect;
video::SColor CurrentIconColor;
core::position2d<s32> DragStart;
bool Dragging, IsDraggable;
......
......@@ -582,6 +582,8 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
HWnd = CreateWindow( ClassName, __TEXT(""), style, windowLeft, windowTop,
realWidth, realHeight, NULL, NULL, hInstance, NULL);
CreationParams.WindowId = HWnd;
CreationParams.WindowSize.Width = realWidth;
CreationParams.WindowSize.Height = realHeight;
ShowWindow(HWnd, SW_SHOW);
UpdateWindow(HWnd);
......
......@@ -203,6 +203,7 @@ bool CMD2MeshFileLoader::loadFile(io::IReadFile* file, CAnimatedMeshMD2* mesh)
if (!file->read(textureCoords, sizeof(SMD2TextureCoordinate)*header.numTexcoords))
{
delete[] textureCoords;
os::Printer::log("MD2 Loader: Error reading TextureCoords.", file->getFileName(), ELL_ERROR);
return false;
}
......@@ -222,6 +223,9 @@ bool CMD2MeshFileLoader::loadFile(io::IReadFile* file, CAnimatedMeshMD2* mesh)
SMD2Triangle *triangles = new SMD2Triangle[header.numTriangles];
if (!file->read(triangles, header.numTriangles *sizeof(SMD2Triangle)))
{
delete[] triangles;
delete[] textureCoords;
os::Printer::log("MD2 Loader: Error reading triangles.", file->getFileName(), ELL_ERROR);
return false;
}
......
......@@ -246,8 +246,6 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
// loading meshes
SMesh* mesh = new SMesh();
if (id!=MY3D_MESH_LIST_ID)
{
os::Printer::log("Can not find MY3D_MESH_LIST_ID, loading failed!", ELL_ERROR);
......@@ -637,6 +635,7 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
}
// creating mesh
SMesh* mesh = new SMesh();
for (u32 num=0; num<MeshBufferEntry.size(); ++num)
{
......
......@@ -174,10 +174,18 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
void CParticleAnimatedMeshSceneNodeEmitter::setAnimatedMeshSceneNode( IAnimatedMeshSceneNode* node )
{
Node = node;
AnimatedMesh = 0;
BaseMesh = 0;
TotalVertices = 0;
VertexPerMeshBufferList.clear();
if ( !node )
{
return;
}
AnimatedMesh = node->getMesh();
BaseMesh = AnimatedMesh->getMesh(0);
TotalVertices = 0;
MBCount = BaseMesh->getMeshBufferCount();
VertexPerMeshBufferList.reallocate(MBCount);
for( u32 i = 0; i < MBCount; ++i )
......
......@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CParticleAttractionAffector.h"
#include "IAttributes.h"
namespace irr
{
......@@ -56,6 +57,27 @@ void CParticleAttractionAffector::affect(u32 now, SParticle* particlearray, u32
}
}
//! Writes attributes of the object.
void CParticleAttractionAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addVector3d("Point", Point);
out->addFloat("Speed", Speed);
out->addBool("AffectX", AffectX);
out->addBool("AffectY", AffectY);
out->addBool("AffectZ", AffectZ);
out->addBool("Attract", Attract);
}
//! Reads attributes of the object.
void CParticleAttractionAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
Point = in->getAttributeAsVector3d("Point");
Speed = in->getAttributeAsFloat("Speed");
AffectX = in->getAttributeAsBool("AffectX");
AffectY = in->getAttributeAsBool("AffectY");
AffectZ = in->getAttributeAsBool("AffectZ");
Attract = in->getAttributeAsBool("Attract");
}
} // end namespace scene
} // end namespace irr
......
......@@ -62,6 +62,12 @@ public:
//! Get whether or not the particles Z position are affected
virtual bool getAffectZ() const { return AffectZ; }
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the object.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
core::vector3df Point;
......
......@@ -109,6 +109,10 @@ void CParticleBoxEmitter::serializeAttributes(io::IAttributes* out, io::SAttribu
b *= 0.5f;
out->addVector3d("Box", b);
out->addVector3d("Direction", Direction);
out->addFloat("MinStartSizeWidth", MinStartSize.Width);
out->addFloat("MinStartSizeHeight", MinStartSize.Height);
out->addFloat("MaxStartSizeWidth", MaxStartSize.Width);
out->addFloat("MaxStartSizeHeight", MaxStartSize.Height);
out->addInt("MinParticlesPerSecond", MinParticlesPerSecond);
out->addInt("MaxParticlesPerSecond", MaxParticlesPerSecond);
out->addColor("MinStartColor", MinStartColor);
......@@ -144,6 +148,11 @@ void CParticleBoxEmitter::deserializeAttributes(io::IAttributes* in, io::SAttrib
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
......
......@@ -4,6 +4,7 @@
#include "CParticleCylinderEmitter.h"
#include "os.h"
#include "IAttributes.h"
namespace irr
{
......@@ -115,6 +116,67 @@ s32 CParticleCylinderEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*&
return 0;
}
//! Writes attributes of the object.
void CParticleCylinderEmitter::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addVector3d("Center", Center);
out->addVector3d("Normal", Normal);
out->addVector3d("Direction", Direction);
out->addFloat("MinStartSizeWidth", MinStartSize.Width);
out->addFloat("MinStartSizeHeight", MinStartSize.Height);
out->addFloat("MaxStartSizeWidth", MaxStartSize.Width);
out->addFloat("MaxStartSizeHeight", MaxStartSize.Height);
out->addInt("MinParticlesPerSecond", MinParticlesPerSecond);
out->addInt("MaxParticlesPerSecond", MaxParticlesPerSecond);
out->addColor("MinStartColor", MinStartColor);
out->addColor("MaxStartColor", MaxStartColor);
out->addInt("MinLifeTime", MinLifeTime);
out->addInt("MaxLifeTime", MaxLifeTime);
out->addFloat("Radius", Radius);
out->addFloat("Length", Length);
out->addInt("MaxAngleDegrees", MaxAngleDegrees);
out->addBool("OutlineOnly", OutlineOnly);
}
//! Reads attributes of the object.
void CParticleCylinderEmitter::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
Center = in->getAttributeAsVector3d("Center");
Normal = in->getAttributeAsVector3d("Normal");
if (Normal.getLength() == 0)
Normal.set(0,1.f,0);
Direction = in->getAttributeAsVector3d("Direction");
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
MinParticlesPerSecond = core::max_(1u, MinParticlesPerSecond);
MaxParticlesPerSecond = core::max_(MaxParticlesPerSecond, 1u);
MaxParticlesPerSecond = core::min_(MaxParticlesPerSecond, 200u);
MinParticlesPerSecond = core::min_(MinParticlesPerSecond, MaxParticlesPerSecond);
MinStartColor = in->getAttributeAsColor("MinStartColor");
MaxStartColor = in->getAttributeAsColor("MaxStartColor");
MinLifeTime = in->getAttributeAsInt("MinLifeTime");
MaxLifeTime = in->getAttributeAsInt("MaxLifeTime");
MinLifeTime = core::max_(0u, MinLifeTime);
MaxLifeTime = core::max_(MaxLifeTime, MinLifeTime);
MinLifeTime = core::min_(MinLifeTime, MaxLifeTime);
Radius = in->getAttributeAsFloat("Radius");
Length = in->getAttributeAsFloat("Length");
MaxAngleDegrees = in->getAttributeAsInt("MaxAngleDegrees");
OutlineOnly = in->getAttributeAsBool("OutlineOnly");
}
} // end namespace scene
} // end namespace irr
......@@ -110,6 +110,12 @@ public:
//! Gets the minimum starting size for particles
virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the object.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
core::array<SParticle> Particles;
......
......@@ -178,6 +178,12 @@ void CParticleMeshEmitter::setMesh(IMesh* mesh)
Mesh = mesh;
TotalVertices = 0;
MBCount = 0;
VertexPerMeshBufferList.clear();
if ( !Mesh )
return;
MBCount = Mesh->getMeshBufferCount();
VertexPerMeshBufferList.reallocate(MBCount);
for( u32 i = 0; i < MBCount; ++i )
......
......@@ -88,6 +88,10 @@ s32 CParticlePointEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& out
void CParticlePointEmitter::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addVector3d("Direction", Direction);
out->addFloat("MinStartSizeWidth", MinStartSize.Width);
out->addFloat("MinStartSizeHeight", MinStartSize.Height);
out->addFloat("MaxStartSizeWidth", MaxStartSize.Width);
out->addFloat("MaxStartSizeHeight", MaxStartSize.Height);
out->addInt("MinParticlesPerSecond", MinParticlesPerSecond);
out->addInt("MaxParticlesPerSecond", MaxParticlesPerSecond);
out->addColor("MinStartColor", MinStartColor);
......@@ -97,7 +101,6 @@ void CParticlePointEmitter::serializeAttributes(io::IAttributes* out, io::SAttri
out->addInt("MaxAngleDegrees", MaxAngleDegrees);
}
//! Reads attributes of the object.
void CParticlePointEmitter::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
......@@ -105,6 +108,11 @@ void CParticlePointEmitter::deserializeAttributes(io::IAttributes* in, io::SAttr
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
......
......@@ -4,6 +4,7 @@
#include "CParticleRingEmitter.h"
#include "os.h"
#include "IAttributes.h"
namespace irr
{
......@@ -106,6 +107,62 @@ s32 CParticleRingEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
return 0;
}
//! Writes attributes of the object.
void CParticleRingEmitter::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addVector3d("Center", Center);
out->addFloat("Radius", Radius);
out->addFloat("RingThickness", RingThickness);
out->addVector3d("Direction", Direction);
out->addFloat("MinStartSizeWidth", MinStartSize.Width);
out->addFloat("MinStartSizeHeight", MinStartSize.Height);
out->addFloat("MaxStartSizeWidth", MaxStartSize.Width);
out->addFloat("MaxStartSizeHeight", MaxStartSize.Height);
out->addInt("MinParticlesPerSecond", MinParticlesPerSecond);
out->addInt("MaxParticlesPerSecond", MaxParticlesPerSecond);
out->addColor("MinStartColor", MinStartColor);
out->addColor("MaxStartColor", MaxStartColor);
out->addInt("MinLifeTime", MinLifeTime);
out->addInt("MaxLifeTime", MaxLifeTime);
out->addInt("MaxAngleDegrees", MaxAngleDegrees);
}
//! Reads attributes of the object.
void CParticleRingEmitter::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
Center = in->getAttributeAsVector3d("Center");
Radius = in->getAttributeAsFloat("Radius");
RingThickness = in->getAttributeAsFloat("RingThickness");
Direction = in->getAttributeAsVector3d("Direction");
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
MinParticlesPerSecond = core::max_(1u, MinParticlesPerSecond);
MaxParticlesPerSecond = core::max_(MaxParticlesPerSecond, 1u);
MaxParticlesPerSecond = core::min_(MaxParticlesPerSecond, 200u);
MinParticlesPerSecond = core::min_(MinParticlesPerSecond, MaxParticlesPerSecond);
MinStartColor = in->getAttributeAsColor("MinStartColor");
MaxStartColor = in->getAttributeAsColor("MaxStartColor");
MinLifeTime = in->getAttributeAsInt("MinLifeTime");
MaxLifeTime = in->getAttributeAsInt("MaxLifeTime");
MinLifeTime = core::max_(0u, MinLifeTime);
MaxLifeTime = core::max_(MaxLifeTime, MinLifeTime);
MinLifeTime = core::min_(MinLifeTime, MaxLifeTime);
MaxAngleDegrees = in->getAttributeAsInt("MaxAngleDegrees");
}
} // end namespace scene
} // end namespace irr
......@@ -97,6 +97,12 @@ public:
//! Get the thickness of the ring
virtual f32 getRingThickness() const { return RingThickness; }
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the object.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
core::array<SParticle> Particles;
......
......@@ -3,6 +3,7 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CParticleRotationAffector.h"
#include "IAttributes.h"
namespace irr
{
......@@ -47,6 +48,19 @@ void CParticleRotationAffector::affect(u32 now, SParticle* particlearray, u32 co
}
}
//! Writes attributes of the object.
void CParticleRotationAffector::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addVector3d("PivotPoint", PivotPoint);
out->addVector3d("Speed", Speed);
}
//! Reads attributes of the object.
void CParticleRotationAffector::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
PivotPoint = in->getAttributeAsVector3d("PivotPoint");
Speed = in->getAttributeAsVector3d("Speed");
}
} // end namespace scene
} // end namespace irr
......
......@@ -35,6 +35,12 @@ public:
//! Get the speed in degrees per second
virtual const core::vector3df& getSpeed() const { return Speed; }
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the object.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
core::vector3df PivotPoint;
......
......@@ -5,6 +5,7 @@
#include "IrrCompileConfig.h"
#include "CParticleSphereEmitter.h"
#include "os.h"
#include "IAttributes.h"
namespace irr
{
......@@ -107,6 +108,60 @@ s32 CParticleSphereEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& ou
return 0;
}
//! Writes attributes of the object.
void CParticleSphereEmitter::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addVector3d("Center", Direction);
out->addFloat("Radius", Radius);
out->addVector3d("Direction", Direction);
out->addFloat("MinStartSizeWidth", MinStartSize.Width);
out->addFloat("MinStartSizeHeight", MinStartSize.Height);
out->addFloat("MaxStartSizeWidth", MaxStartSize.Width);
out->addFloat("MaxStartSizeHeight", MaxStartSize.Height);
out->addInt("MinParticlesPerSecond", MinParticlesPerSecond);
out->addInt("MaxParticlesPerSecond", MaxParticlesPerSecond);
out->addColor("MinStartColor", MinStartColor);
out->addColor("MaxStartColor", MaxStartColor);
out->addInt("MinLifeTime", MinLifeTime);
out->addInt("MaxLifeTime", MaxLifeTime);
out->addInt("MaxAngleDegrees", MaxAngleDegrees);
}
//! Reads attributes of the object.
void CParticleSphereEmitter::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
Center = in->getAttributeAsVector3d("Center");
Radius = in->getAttributeAsFloat("Radius");
Direction = in->getAttributeAsVector3d("Direction");
if (Direction.getLength() == 0)
Direction.set(0,0.01f,0);
MinStartSize.Width = in->getAttributeAsFloat("MinStartSizeWidth");
MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
MinParticlesPerSecond = core::max_(1u, MinParticlesPerSecond);
MaxParticlesPerSecond = core::max_(MaxParticlesPerSecond, 1u);
MaxParticlesPerSecond = core::min_(MaxParticlesPerSecond, 200u);
MinParticlesPerSecond = core::min_(MinParticlesPerSecond, MaxParticlesPerSecond);
MinStartColor = in->getAttributeAsColor("MinStartColor");
MaxStartColor = in->getAttributeAsColor("MaxStartColor");
MinLifeTime = in->getAttributeAsInt("MinLifeTime");
MaxLifeTime = in->getAttributeAsInt("MaxLifeTime");
MinLifeTime = core::max_(0u, MinLifeTime);
MaxLifeTime = core::max_(MaxLifeTime, MinLifeTime);
MinLifeTime = core::min_(MinLifeTime, MaxLifeTime);
MaxAngleDegrees = in->getAttributeAsInt("MaxAngleDegrees");
}
} // end namespace scene
} // end namespace irr
......@@ -91,6 +91,12 @@ public:
//! Get the radius of the sphere for particle emissions
virtual f32 getRadius() const { return Radius; }
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the object.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
private:
core::array<SParticle> Particles;
......
......@@ -607,9 +607,24 @@ void CParticleSystemSceneNode::deserializeAttributes(io::IAttributes* in, io::SA
case EPET_POINT:
Emitter = createPointEmitter();
break;
case EPET_ANIMATED_MESH:
Emitter = createAnimatedMeshSceneNodeEmitter(NULL); // we can't set the node - the user will have to do this
break;
case EPET_BOX:
Emitter = createBoxEmitter();
break;
case EPET_CYLINDER:
Emitter = createCylinderEmitter(core::vector3df(0,0,0), 10.f, core::vector3df(0,1,0), 10.f); // (values here don't matter)
break;
case EPET_MESH:
Emitter = createMeshEmitter(NULL); // we can't set the mesh - the user will have to do this
break;
case EPET_RING:
Emitter = createRingEmitter(core::vector3df(0,0,0), 10.f, 10.f); // (values here don't matter)
break;
case EPET_SPHERE:
Emitter = createSphereEmitter(core::vector3df(0,0,0), 10.f); // (values here don't matter)
break;
default:
break;
}
......@@ -645,12 +660,18 @@ void CParticleSystemSceneNode::deserializeAttributes(io::IAttributes* in, io::SA
switch(atype)
{
case EPAT_ATTRACT:
aff = createAttractionAffector(core::vector3df(0,0,0));
break;
case EPAT_FADE_OUT:
aff = createFadeOutParticleAffector();
break;
case EPAT_GRAVITY:
aff = createGravityAffector();
break;
case EPAT_ROTATE:
aff = createRotationAffector();
break;
case EPAT_SCALE:
aff = createScaleParticleAffector();
break;
......
......@@ -25,7 +25,7 @@ public:
//! constructor
CParticleSystemSceneNode(bool createDefaultEmitter,
ISceneNode* parent, ISceneManager* mgr, s32 id,
ISceneNode* parent, ISceneManager* mgr, s32 id,
const core::vector3df& position,
const core::vector3df& rotation,
const core::vector3df& scale);
......@@ -77,7 +77,7 @@ public:
//! Creates a box particle emitter.
virtual IParticleBoxEmitter* createBoxEmitter(
const core::aabbox3df& box = core::aabbox3d<f32>(-10,0,-10,5,30,10),
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5,
u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0),
......@@ -117,7 +117,7 @@ public:
//! Creates a point particle emitter.
virtual IParticlePointEmitter* createPointEmitter(
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
const core::vector3df& direction = core::vector3df(0.0f,0.03f,0.0f),
u32 minParticlesPerSecond = 5,
u32 maxParticlesPerSecond = 10,
const video::SColor& minStartColor = video::SColor(255,0,0,0),
......
......@@ -7,6 +7,7 @@
#include "ISceneNodeAnimatorCameraFPS.h"
#include "vector2d.h"
#include "position2d.h"
#include "SKeyMap.h"
#include "irrArray.h"
......@@ -21,16 +22,16 @@ namespace scene
{
//! Special scene node animator for FPS cameras
class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS
class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS
{
public:
//! Constructor
CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f,
SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false,
bool invertY=false);
//! Destructor
virtual ~CSceneNodeAnimatorCameraFPS();
......
......@@ -154,6 +154,9 @@ CBillboardTextSceneNode::~CBillboardTextSceneNode()
//! sets the text string
void CBillboardTextSceneNode::setText(const wchar_t* text)
{
if ( !Mesh )
return;
Text = text;
Symbol.clear();
......@@ -325,6 +328,9 @@ void CBillboardTextSceneNode::OnRegisterSceneNode()
//! render
void CBillboardTextSceneNode::render()
{
if ( !Mesh )
return;
video::IVideoDriver* driver = SceneManager->getVideoDriver();
// draw
......@@ -408,6 +414,9 @@ void CBillboardTextSceneNode::setTextColor(video::SColor color)
//! \param overallColor: the color to set
void CBillboardTextSceneNode::setColor(const video::SColor & overallColor)
{
if ( !Mesh )
return;
for ( u32 i = 0; i != Text.size (); ++i )
{
const SSymbolInfo &info = Symbol[i];
......@@ -425,6 +434,9 @@ void CBillboardTextSceneNode::setColor(const video::SColor & overallColor)
//! \param bottomColor: the color to set the bottom vertices
void CBillboardTextSceneNode::setColor(const video::SColor & topColor, const video::SColor & bottomColor)
{
if ( !Mesh )
return;
ColorBottom = bottomColor;
ColorTop = topColor;
for ( u32 i = 0; i != Text.size (); ++i )
......
......@@ -139,14 +139,24 @@ public:
//! Returns the value of an attribute as integer.
int getAttributeValueAsInt(const char_type* name) const
{
return (int)getAttributeValueAsFloat(name);
const SAttribute* attr = getAttributeByName(name);
if (!attr)
return 0;
core::stringc c(attr->Value.c_str());
return core::strtol10(c.c_str());
}
//! Returns the value of an attribute as integer.
int getAttributeValueAsInt(int idx) const
{
return (int)getAttributeValueAsFloat(idx);
const char_type* attrvalue = getAttributeValue(idx);
if (!attrvalue)
return 0;
core::stringc c(attrvalue);
return core::strtol10(c.c_str());
}
......
......@@ -449,6 +449,7 @@
<Unit filename="../../include/IGPUProgrammingServices.h" />
<Unit filename="../../include/IGUIButton.h" />
<Unit filename="../../include/IGUICheckBox.h" />
<Unit filename="../../include/IGUIColorSelectDialog.h" />
<Unit filename="../../include/IGUIComboBox.h" />
<Unit filename="../../include/IGUIContextMenu.h" />
<Unit filename="../../include/IGUIEditBox.h" />
......
......@@ -28,6 +28,7 @@ OBJ = $(Sources:.cpp=.o)
all_linux all_win32: $(OBJ)
$(warning Building...)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $(DESTPATH) $(LDFLAGS)
@$(RM) tests # otherwise it's easy to forget to copy it and run the old binary
clean: clean_linux clean_win32
$(warning Cleaning...)
......
<?xml version="1.0"?>
<root>
<text><![CDATA[simple]]></text>
<text><![CDATA[]]></text>
<text><![CDATA[] ]> ]]></text>
<text><![CDATA[]
]> ]]></text>
<text><![CDATA[
Newlines
and tabs
gogogo]]></text>
<text><![CDATA[&&#@#$%*()@#$%*()#$%*(]]></text>
<text><![CDATA[& & && &&& &a &ü &ä &ö &&#]]></text>
</root>
......@@ -145,7 +145,7 @@ public:
void set()
{
ValInt = 1;
ValInt = 152722522;
ValFloat = 1.f;
ValString = "one";
ValStringW = L"ONE";
......
......@@ -6,12 +6,9 @@
using namespace irr;
using namespace core;
/** Tests for XML handling */
bool testXML(void)
bool simple_xml( irr::io::IFileSystem * fs )
{
IrrlichtDevice *device = createDevice(video::EDT_NULL, dimension2du(400, 200));
io::IXMLReaderUTF8* reader = device->getFileSystem()->createXMLReaderUTF8("media/test.xml");
io::IXMLReaderUTF8* reader = fs->createXMLReaderUTF8("media/test.xml");
if (!reader)
{
logTestString("Could not create XML reader.\n");
......@@ -43,3 +40,128 @@ bool testXML(void)
return retVal;
}
// CDATA should return everything between "![CDATA[" and "]]>" as it's in the file
bool cdata( irr::io::IFileSystem * fs )
{
io::IXMLReaderUTF8* reader = fs->createXMLReaderUTF8("media/cdata.xml");
if (!reader)
{
logTestString("Could not create XML reader.\n");
return false;
}
const core::stringc textNode("text");
core::array< core::stringc > compareStrings;
compareStrings.push_back("simple");
compareStrings.push_back("");
compareStrings.push_back("] ]> ");
compareStrings.push_back("]\n]> ");
compareStrings.push_back("\nNewlines\n\tand tabs\n\t\tgogogo");
compareStrings.push_back("&&#@#$%*()@#$%*()#$%*(");
compareStrings.push_back("& & && &&& &a &ü &ä &ö &&#");
bool result = true;
size_t count = 0;
while(reader->read())
{
if (reader->getNodeType() == io::EXN_ELEMENT)
{
if ( core::stringc(reader->getNodeName()) == textNode )
{
while(reader->read())
{
if (reader->getNodeType() == io::EXN_CDATA)
{
core::stringc data = reader->getNodeData();
core::stringc name = reader->getNodeName();
if ( count == compareStrings.size() )
{
logTestString("too many cdata elements for reading in %s:%d\n", __FILE__, __LINE__);
}
else if ( count < compareStrings.size() )
{
core::stringc cmpString(compareStrings[count]);
// some (unused) variables to ease debugging
// const c8* dataRaw = data.c_str();
// const c8* cmpRaw = cmpString.c_str();
if ( cmpString != data )
{
result = false;
logTestString("cdata read failed for string %d in %s:%d\n", count, __FILE__, __LINE__);
}
}
++count;
}
if ( reader->getNodeType() == io::EXN_ELEMENT_END )
{
break;
}
}
}
}
}
reader->drop();
return result;
}
bool attributeValues(irr::io::IFileSystem * fs)
{
io::IXMLReaderUTF8* reader = fs->createXMLReaderUTF8("media/attributes.xml");
if (!reader)
{
logTestString("Could not create XML reader.\n");
return false;
}
bool result = true;
bool hasNode = false;
while (reader->read())
{
if (io::EXN_ELEMENT == reader->getNodeType() )
{
if ( core::stringc(reader->getNodeName()) == core::stringc("element_position") )
{
hasNode = true;
int id1 = reader->getAttributeValueAsInt("id1");
if ( id1 != 152722522 )
{
logTestString("id1 is %d in %s:%d\n", id1, __FILE__, __LINE__);
result = false;
}
int id2 = reader->getAttributeValueAsInt("id2");
result &= id2 == 3;
int x = reader->getAttributeValueAsInt("x");
result &= x == 301;
int y = reader->getAttributeValueAsInt("y");
result &= y == 118;
}
}
}
if ( !hasNode )
{
logTestString("missing node in xml in %s:%d\n", __FILE__, __LINE__);
return false;
}
reader->drop();
return result;
}
/** Tests for XML handling */
bool testXML(void)
{
IrrlichtDevice *device = createDevice(video::EDT_NULL, dimension2du(400, 200));
bool result = true;
result &= simple_xml(device->getFileSystem());
result &= cdata(device->getFileSystem());
result &= attributeValues(device->getFileSystem()); // TODO: this bug is still open!
device->drop();
return result;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment