diff --git a/scripts/libIrrlicht1.spec b/scripts/libIrrlicht1.spec
index c87d36c2..af5c80a2 100644
--- a/scripts/libIrrlicht1.spec
+++ b/scripts/libIrrlicht1.spec
@@ -1,4 +1,4 @@
-# Copyright (c) 2007 oc2pus
+# Copyright (c) 2007-2011 oc2pus
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@@ -11,7 +11,7 @@
# norootforbuild
Name: libIrrlicht1
-Version: 1.6.0
+Version: 1.8.0
Release: 0.pm.1
Summary: The Irrlicht Engine SDK
License: see readme.txt
diff --git a/source/Irrlicht/BuiltInFont.h b/source/Irrlicht/BuiltInFont.h
index 9da9d0af..ca3e295f 100644
--- a/source/Irrlicht/BuiltInFont.h
+++ b/source/Irrlicht/BuiltInFont.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/C3DSMeshFileLoader.cpp b/source/Irrlicht/C3DSMeshFileLoader.cpp
index 7d63a020..74453b04 100644
--- a/source/Irrlicht/C3DSMeshFileLoader.cpp
+++ b/source/Irrlicht/C3DSMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/C3DSMeshFileLoader.h b/source/Irrlicht/C3DSMeshFileLoader.h
index 20028d46..0f25b522 100644
--- a/source/Irrlicht/C3DSMeshFileLoader.h
+++ b/source/Irrlicht/C3DSMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAnimatedMeshHalfLife.cpp b/source/Irrlicht/CAnimatedMeshHalfLife.cpp
index f1444146..0b81b3ac 100644
--- a/source/Irrlicht/CAnimatedMeshHalfLife.cpp
+++ b/source/Irrlicht/CAnimatedMeshHalfLife.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Fabio Concas / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Fabio Concas / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -850,9 +850,9 @@ void STextureAtlas::addSource ( const c8 * name, video::IImage * image )
/*!
*/
-void STextureAtlas::getScale ( core::vector2df & scale )
+void STextureAtlas::getScale(core::vector2df& scale)
{
- for ( u32 i = atlas.size() - 1; i >= 0; --i)
+ for (s32 i = static_cast
(atlas.size()) - 1; i >= 0; --i)
{
if ( atlas[i].name == "_merged_" )
{
@@ -995,7 +995,6 @@ void STextureAtlas::create ( u32 border, E_TEXTURE_CLAMP texmode)
master->setPixel ( atlas[i].pos.X + atlas[i].width + b, atlas[i].pos.Y + a, col[wrap[texmode][1]] );
}
}
-
}
addSource ( "_merged_", master );
@@ -1119,8 +1118,6 @@ SHalflifeHeader * CAnimatedMeshHalfLife::loadModel( io::IReadFile* file, const i
}
-
-
/*!
*/
f32 CAnimatedMeshHalfLife::SetController( s32 controllerIndex, f32 value )
diff --git a/source/Irrlicht/CAnimatedMeshHalfLife.h b/source/Irrlicht/CAnimatedMeshHalfLife.h
index 4ef7b45c..e781255e 100644
--- a/source/Irrlicht/CAnimatedMeshHalfLife.h
+++ b/source/Irrlicht/CAnimatedMeshHalfLife.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2010 Thomas Alten
+// Copyright (C) 2002-2011 Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAnimatedMeshMD2.cpp b/source/Irrlicht/CAnimatedMeshMD2.cpp
index b821a9d4..16d4b345 100644
--- a/source/Irrlicht/CAnimatedMeshMD2.cpp
+++ b/source/Irrlicht/CAnimatedMeshMD2.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAnimatedMeshMD2.h b/source/Irrlicht/CAnimatedMeshMD2.h
index 861fc9e8..4ddad738 100644
--- a/source/Irrlicht/CAnimatedMeshMD2.h
+++ b/source/Irrlicht/CAnimatedMeshMD2.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAnimatedMeshMD3.cpp b/source/Irrlicht/CAnimatedMeshMD3.cpp
index 6aa4478f..11187620 100644
--- a/source/Irrlicht/CAnimatedMeshMD3.cpp
+++ b/source/Irrlicht/CAnimatedMeshMD3.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Fabio Concas / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Fabio Concas / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAnimatedMeshMD3.h b/source/Irrlicht/CAnimatedMeshMD3.h
index f5a74bd0..40e41b30 100644
--- a/source/Irrlicht/CAnimatedMeshMD3.h
+++ b/source/Irrlicht/CAnimatedMeshMD3.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/source/Irrlicht/CAnimatedMeshSceneNode.cpp
index d033c444..55b12f2d 100644
--- a/source/Irrlicht/CAnimatedMeshSceneNode.cpp
+++ b/source/Irrlicht/CAnimatedMeshSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -32,20 +32,17 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
const core::vector3df& rotation,
const core::vector3df& scale)
: IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0),
- StartFrame(0), EndFrame(0), FramesPerSecond(0.f),
+ StartFrame(0), EndFrame(0), FramesPerSecond(0.025f),
CurrentFrameNr(0.f), LastTimeMs(0),
TransitionTime(0), Transiting(0.f), TransitingBlend(0.f),
JointMode(EJUOR_NONE), JointsUsed(false),
- Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(0),
- LoopCallBack(0), PassCount(0), Shadow(0),
- MD3Special ( 0 )
+ Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(false),
+ LoopCallBack(0), PassCount(0), Shadow(0), MD3Special(0)
{
#ifdef _DEBUG
setDebugName("CAnimatedMeshSceneNode");
#endif
- FramesPerSecond = 25.f/1000.f;
-
setMesh(mesh);
}
@@ -54,7 +51,7 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh,
CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
{
if (MD3Special)
- MD3Special->drop ();
+ MD3Special->drop();
if (Mesh)
Mesh->drop();
@@ -62,10 +59,6 @@ CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
if (Shadow)
Shadow->drop();
- //for (u32 i=0; idrop();
-
if (LoopCallBack)
LoopCallBack->drop();
}
@@ -201,6 +194,10 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame()
}
else
{
+#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
+ return 0;
+#endif
+
// As multiple scene nodes may be sharing the same skinned mesh, we have to
// re-animate it every frame to ensure that this node gets the mesh that it needs.
@@ -559,27 +556,31 @@ u32 CAnimatedMeshSceneNode::getMaterialCount() const
//! Creates shadow volume scene node as child of this node
//! and returns a pointer to it.
-IShadowVolumeSceneNode* CAnimatedMeshSceneNode::addShadowVolumeSceneNode(const IMesh* shadowMesh,
- s32 id, bool zfailmethod, f32 infinity)
+IShadowVolumeSceneNode* CAnimatedMeshSceneNode::addShadowVolumeSceneNode(
+ const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
- if (Shadow)
- return Shadow;
-
if (!shadowMesh)
shadowMesh = Mesh; // if null is given, use the mesh of node
+ if (Shadow)
+ Shadow->drop();
+
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
}
-
//! Returns a pointer to a child node, which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a skinned mesh.
IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
{
+#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
+ os::Printer::log("Compiled without _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_", ELL_WARNING);
+ return 0;
+#endif
+
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
{
os::Printer::log("No mesh, or mesh not of skinned mesh type", ELL_WARNING);
@@ -594,7 +595,7 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
if (number == -1)
{
- os::Printer::log("Joint with specified name not found in skinned mesh.", jointName, ELL_DEBUG);
+ os::Printer::log("Joint with specified name not found in skinned mesh", jointName, ELL_DEBUG);
return 0;
}
@@ -604,14 +605,20 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
return 0;
}
- return getJointNode((u32)number);
+ return JointChildSceneNodes[number];
}
+
//! Returns a pointer to a child node, which has the same transformation as
//! the corresponding joint, if the mesh in this scene node is a skinned mesh.
IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(u32 jointID)
{
+#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
+ os::Printer::log("Compiled without _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_", ELL_WARNING);
+ return 0;
+#endif
+
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
{
os::Printer::log("No mesh, or mesh not of skinned mesh type", ELL_WARNING);
@@ -632,6 +639,10 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(u32 jointID)
//! Gets joint count.
u32 CAnimatedMeshSceneNode::getJointCount() const
{
+#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
+ return 0;
+#endif
+
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return 0;
@@ -656,7 +667,6 @@ ISceneNode* CAnimatedMeshSceneNode::getXJointNode(const c8* jointName)
return getJointNode(jointName);
}
-
//! Removes a child from this scene node.
//! Implemented here, to be able to remove the shadow properly, if there is one,
//! or to remove attached childs.
@@ -673,10 +683,12 @@ bool CAnimatedMeshSceneNode::removeChild(ISceneNode* child)
if (JointsUsed) //stop weird bugs caused while changing parents as the joints are being created
{
for (u32 i=0; igetFrameCount() );
+// setAnimationSpeed(Mesh->getAnimationSpeed());
+ setFrameLoop(0, Mesh->getFrameCount());
}
// returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh,
// or the absolutetransformation if it's a normal scenenode
-const SMD3QuaternionTag* CAnimatedMeshSceneNode::getMD3TagTransformation( const core::stringc & tagname)
+const SMD3QuaternionTag* CAnimatedMeshSceneNode::getMD3TagTransformation(const core::stringc& tagname)
{
- return MD3Special ? MD3Special->AbsoluteTagList.get ( tagname ) : 0;
+ return MD3Special ? MD3Special->AbsoluteTagList.get(tagname) : 0;
}
@@ -887,134 +907,133 @@ void CAnimatedMeshSceneNode::updateAbsolutePosition()
}
}
-
//! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set)
void CAnimatedMeshSceneNode::setJointMode(E_JOINT_UPDATE_ON_RENDER mode)
{
checkJoints();
-
- //if (mode<0) mode=0;
- //if (mode>3) mode=3;
-
JointMode=mode;
}
-
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2)
//! you must call animateJoints(), or the mesh will not animate
void CAnimatedMeshSceneNode::setTransitionTime(f32 time)
{
- if (time != 0.0f)
- {
- checkJoints();
+ const u32 ttime = (u32)core::floor32(time*1000.0f);
+ if (TransitionTime==ttime)
+ return;
+ TransitionTime = ttime;
+ if (ttime != 0)
setJointMode(EJUOR_CONTROL);
- TransitionTime = (u32)core::floor32(time*1000.0f);
- }
+ else
+ setJointMode(EJUOR_NONE);
}
//! render mesh ignoring its transformation. Used with ragdolls. (culling is unaffected)
-void CAnimatedMeshSceneNode::setRenderFromIdentity( bool On )
+void CAnimatedMeshSceneNode::setRenderFromIdentity(bool enable)
{
- RenderFromIdentity=On;
+ RenderFromIdentity=enable;
}
//! updates the joint positions of this mesh
void CAnimatedMeshSceneNode::animateJoints(bool CalculateAbsolutePositions)
{
- checkJoints();
-
+#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
+ return;
+#endif
if (Mesh && Mesh->getMeshType() == EAMT_SKINNED )
{
- if (JointsUsed)
+ checkJoints();
+ const f32 frame = getFrameNr(); //old?
+
+ CSkinnedMesh* skinnedMesh=reinterpret_cast(Mesh);
+
+ skinnedMesh->transferOnlyJointsHintsToMesh( JointChildSceneNodes );
+ skinnedMesh->animateMesh(frame, 1.0f);
+ skinnedMesh->recoverJointsFromMesh( JointChildSceneNodes);
+
+ //-----------------------------------------
+ // Transition
+ //-----------------------------------------
+
+ if (Transiting != 0.f)
{
- f32 frame = getFrameNr(); //old?
-
- CSkinnedMesh* skinnedMesh=reinterpret_cast(Mesh);
-
- skinnedMesh->transferOnlyJointsHintsToMesh( JointChildSceneNodes );
-
- skinnedMesh->animateMesh(frame, 1.0f);
-
- skinnedMesh->recoverJointsFromMesh( JointChildSceneNodes);
-
- //-----------------------------------------
- // Transition
- //-----------------------------------------
-
- if (Transiting != 0.f)
+ // Init additional matrices
+ if (PretransitingSave.size()setPosition(
- core::lerp(
- PretransitingSave[n].getTranslation(),
- JointChildSceneNodes[n]->getPosition(),
- TransitingBlend));
-
- //------Rotation------
-
- //Code is slow, needs to be fixed up
-
- const core::quaternion RotationStart(PretransitingSave[n].getRotationDegrees()*core::DEGTORAD);
- const core::quaternion RotationEnd(JointChildSceneNodes[n]->getRotation()*core::DEGTORAD);
-
- core::quaternion QRotation;
- QRotation.slerp(RotationStart, RotationEnd, TransitingBlend);
-
- core::vector3df tmpVector;
- QRotation.toEuler(tmpVector);
- tmpVector*=core::RADTODEG; //convert from radians back to degrees
- JointChildSceneNodes[n]->setRotation( tmpVector );
-
- //------Scale------
-
- //JointChildSceneNodes[n]->setScale(
- // core::lerp(
- // PretransitingSave[n].getScale(),
- // JointChildSceneNodes[n]->getScale(),
- // TransitingBlend));
- }
+ for(u32 n=PretransitingSave.size(); nsetPosition(
+ core::lerp(
+ PretransitingSave[n].getTranslation(),
+ JointChildSceneNodes[n]->getPosition(),
+ TransitingBlend));
+
+ //------Rotation------
+
+ //Code is slow, needs to be fixed up
+
+ const core::quaternion RotationStart(PretransitingSave[n].getRotationDegrees()*core::DEGTORAD);
+ const core::quaternion RotationEnd(JointChildSceneNodes[n]->getRotation()*core::DEGTORAD);
+
+ core::quaternion QRotation;
+ QRotation.slerp(RotationStart, RotationEnd, TransitingBlend);
+
+ core::vector3df tmpVector;
+ QRotation.toEuler(tmpVector);
+ tmpVector*=core::RADTODEG; //convert from radians back to degrees
+ JointChildSceneNodes[n]->setRotation( tmpVector );
+
+ //------Scale------
+
+ //JointChildSceneNodes[n]->setScale(
+ // core::lerp(
+ // PretransitingSave[n].getScale(),
+ // JointChildSceneNodes[n]->getScale(),
+ // TransitingBlend));
+ }
+ }
+
+ if (CalculateAbsolutePositions)
+ {
+ //---slow---
+ for (u32 n=0;ngetParent()==this)
{
- if (JointChildSceneNodes[n]->getParent()==this)
- {
- JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); //temp, should be an option
- }
+ JointChildSceneNodes[n]->updateAbsolutePositionOfAllChildren(); //temp, should be an option
}
}
}
}
}
-
/*!
*/
void CAnimatedMeshSceneNode::checkJoints()
{
+#ifndef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
+ return;
+#endif
+
if (!Mesh || Mesh->getMeshType() != EAMT_SKINNED)
return;
if (!JointsUsed)
{
- //Create joints for SkinnedMesh
+ for (u32 i=0; icreateJoints(JointChildSceneNodes, this, SceneManager);
+ //Create joints for SkinnedMesh
+ ((CSkinnedMesh*)Mesh)->addJoints(JointChildSceneNodes, this, SceneManager);
((CSkinnedMesh*)Mesh)->recoverJointsFromMesh(JointChildSceneNodes);
JointsUsed=true;
@@ -1022,7 +1041,6 @@ void CAnimatedMeshSceneNode::checkJoints()
}
}
-
/*!
*/
void CAnimatedMeshSceneNode::beginTransition()
@@ -1039,7 +1057,6 @@ void CAnimatedMeshSceneNode::beginTransition()
PretransitingSave.push_back(core::matrix4());
}
-
//Copy the position of joints
for (u32 n=0;ngetRelativeTransformation();
@@ -1054,14 +1071,16 @@ void CAnimatedMeshSceneNode::beginTransition()
*/
ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{
- if (!newParent) newParent = Parent;
- if (!newManager) newManager = SceneManager;
+ if (!newParent)
+ newParent = Parent;
+ if (!newManager)
+ newManager = SceneManager;
- CAnimatedMeshSceneNode * newNode =
+ CAnimatedMeshSceneNode* newNode =
new CAnimatedMeshSceneNode(Mesh, NULL, newManager, ID, RelativeTranslation,
RelativeRotation, RelativeScale);
- if ( newParent )
+ if (newParent)
{
newNode->setParent(newParent); // not in constructor because virtual overload for updateAbsolutePosition won't be called
newNode->drop();
@@ -1097,4 +1116,3 @@ ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager*
} // end namespace scene
} // end namespace irr
-
diff --git a/source/Irrlicht/CAnimatedMeshSceneNode.h b/source/Irrlicht/CAnimatedMeshSceneNode.h
index 34050d17..0e6a8a80 100644
--- a/source/Irrlicht/CAnimatedMeshSceneNode.h
+++ b/source/Irrlicht/CAnimatedMeshSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CAttributeImpl.h b/source/Irrlicht/CAttributeImpl.h
index 49e95476..129d35a5 100644
--- a/source/Irrlicht/CAttributeImpl.h
+++ b/source/Irrlicht/CAttributeImpl.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -1630,7 +1630,7 @@ public:
virtual bool getBool()
{
if (IsStringW)
- return Value.equals_ignore_case(L"true");
+ return ValueW.equals_ignore_case(L"true");
else
return Value.equals_ignore_case("true");
}
diff --git a/source/Irrlicht/CAttributes.cpp b/source/Irrlicht/CAttributes.cpp
index 712d9910..9123caae 100644
--- a/source/Irrlicht/CAttributes.cpp
+++ b/source/Irrlicht/CAttributes.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -230,7 +230,7 @@ void CAttributes::setAttribute(s32 index, const core::array& valu
//! Returns attribute index from name, -1 if not found
-s32 CAttributes::findAttribute(const c8* attributeName)
+s32 CAttributes::findAttribute(const c8* attributeName) const
{
for (u32 i=0; iName == attributeName)
@@ -240,7 +240,7 @@ s32 CAttributes::findAttribute(const c8* attributeName)
}
-IAttribute* CAttributes::getAttributeP(const c8* attributeName)
+IAttribute* CAttributes::getAttributeP(const c8* attributeName) const
{
for (u32 i=0; iName == attributeName)
@@ -294,7 +294,7 @@ void CAttributes::setAttribute(const c8* attributeName, s32 value)
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as integer
//! or 0 if attribute is not set.
-s32 CAttributes::getAttributeAsInt(const c8* attributeName)
+s32 CAttributes::getAttributeAsInt(const c8* attributeName) const
{
IAttribute* att = getAttributeP(attributeName);
if (att)
@@ -614,7 +614,7 @@ bool CAttributes::getAttributeAsBool(s32 index)
//! Gets an attribute as integer value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
-s32 CAttributes::getAttributeAsInt(s32 index)
+s32 CAttributes::getAttributeAsInt(s32 index) const
{
if ((u32)index < Attributes.size())
return Attributes[index]->getInt();
diff --git a/source/Irrlicht/CAttributes.h b/source/Irrlicht/CAttributes.h
index f1e80dfe..818bdf34 100644
--- a/source/Irrlicht/CAttributes.h
+++ b/source/Irrlicht/CAttributes.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -54,7 +54,7 @@ public:
virtual bool existsAttribute(const c8* attributeName);
//! Returns attribute index from name, -1 if not found
- virtual s32 findAttribute(const c8* attributeName);
+ virtual s32 findAttribute(const c8* attributeName) const;
//! Removes all attributes
virtual void clear();
@@ -84,11 +84,11 @@ public:
//! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute()
- virtual s32 getAttributeAsInt(const c8* attributeName);
+ virtual s32 getAttributeAsInt(const c8* attributeName) const;
//! Gets an attribute as integer value
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
- virtual s32 getAttributeAsInt(s32 index);
+ virtual s32 getAttributeAsInt(s32 index) const;
//! Sets an attribute as integer value
virtual void setAttribute(s32 index, s32 value);
@@ -649,7 +649,7 @@ protected:
core::array Attributes;
- IAttribute* getAttributeP(const c8* attributeName);
+ IAttribute* getAttributeP(const c8* attributeName) const;
video::IVideoDriver* Driver;
};
diff --git a/source/Irrlicht/CB3DMeshFileLoader.cpp b/source/Irrlicht/CB3DMeshFileLoader.cpp
index 842e28cc..732ddd83 100644
--- a/source/Irrlicht/CB3DMeshFileLoader.cpp
+++ b/source/Irrlicht/CB3DMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2009 Luke Hoschke
+// Copyright (C) 2006-2011 Luke Hoschke
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -55,6 +55,7 @@ IAnimatedMesh* CB3DMeshFileLoader::createMesh(io::IReadFile* f)
B3DFile = f;
AnimatedMesh = new scene::CSkinnedMesh();
ShowWarning = true; // If true a warning is issued if too many textures are used
+ VerticesStart=0;
if ( load() )
{
@@ -198,6 +199,7 @@ bool CB3DMeshFileLoader::readChunkNODE(CSkinnedMesh::SJoint *inJoint)
}
else if ( strncmp( B3dStack.getLast().name, "MESH", 4 ) == 0 )
{
+ VerticesStart=BaseVertices.size();
if (!readChunkMESH(joint))
return false;
}
@@ -236,12 +238,10 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint)
os::Printer::log("read ChunkMESH");
#endif
- const s32 vertices_Start=BaseVertices.size(); //B3Ds have Vertex ID's local within the mesh I don't want this
-
- s32 brush_id;
- B3DFile->read(&brush_id, sizeof(brush_id));
+ s32 brushID;
+ B3DFile->read(&brushID, sizeof(brushID));
#ifdef __BIG_ENDIAN__
- brush_id = os::Byteswap::byteswap(brush_id);
+ brushID = os::Byteswap::byteswap(brushID);
#endif
NormalsInFile=false;
@@ -266,13 +266,13 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint)
{
scene::SSkinMeshBuffer *meshBuffer = AnimatedMesh->addMeshBuffer();
- if (brush_id!=-1)
+ if (brushID!=-1)
{
- loadTextures(Materials[brush_id]);
- meshBuffer->Material=Materials[brush_id].Material;
+ loadTextures(Materials[brushID]);
+ meshBuffer->Material=Materials[brushID].Material;
}
- if(readChunkTRIS(meshBuffer,AnimatedMesh->getMeshBuffers().size()-1, vertices_Start)==false)
+ if(readChunkTRIS(meshBuffer,AnimatedMesh->getMeshBuffers().size()-1, VerticesStart)==false)
return false;
if (!NormalsInFile)
@@ -293,7 +293,7 @@ bool CB3DMeshFileLoader::readChunkMESH(CSkinnedMesh::SJoint *inJoint)
for ( i = 0; i<(s32)meshBuffer->getVertexCount(); ++i )
{
meshBuffer->getVertex(i)->Normal.normalize();
- BaseVertices[vertices_Start+i].Normal=meshBuffer->getVertex(i)->Normal;
+ BaseVertices[VerticesStart+i].Normal=meshBuffer->getVertex(i)->Normal;
}
}
}
@@ -562,6 +562,7 @@ bool CB3DMeshFileLoader::readChunkBONE(CSkinnedMesh::SJoint *inJoint)
globalVertexID = os::Byteswap::byteswap(globalVertexID);
strength = os::Byteswap::byteswap(strength);
#endif
+ globalVertexID += VerticesStart;
if (AnimatedVertices_VertexID[globalVertexID]==-1)
{
diff --git a/source/Irrlicht/CB3DMeshFileLoader.h b/source/Irrlicht/CB3DMeshFileLoader.h
index bc70dd9f..4e67dfb2 100644
--- a/source/Irrlicht/CB3DMeshFileLoader.h
+++ b/source/Irrlicht/CB3DMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2009 Luke Hoschke
+// Copyright (C) 2006-2011 Luke Hoschke
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -123,6 +123,10 @@ private:
CSkinnedMesh* AnimatedMesh;
io::IReadFile* B3DFile;
+ //B3Ds have Vertex ID's local within the mesh I don't want this
+ // Variable needs to be class member due to recursion in calls
+ u32 VerticesStart;
+
bool NormalsInFile;
bool HasVertexColors;
bool ShowWarning;
diff --git a/source/Irrlicht/CBSPMeshFileLoader.cpp b/source/Irrlicht/CBSPMeshFileLoader.cpp
index 21196ec6..18bf879c 100644
--- a/source/Irrlicht/CBSPMeshFileLoader.cpp
+++ b/source/Irrlicht/CBSPMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBSPMeshFileLoader.h b/source/Irrlicht/CBSPMeshFileLoader.h
index 42c44bf0..13ae121d 100644
--- a/source/Irrlicht/CBSPMeshFileLoader.h
+++ b/source/Irrlicht/CBSPMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBillboardSceneNode.cpp b/source/Irrlicht/CBillboardSceneNode.cpp
index 2980834e..14cf0573 100644
--- a/source/Irrlicht/CBillboardSceneNode.cpp
+++ b/source/Irrlicht/CBillboardSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBillboardSceneNode.h b/source/Irrlicht/CBillboardSceneNode.h
index ae705269..3c559cf7 100644
--- a/source/Irrlicht/CBillboardSceneNode.h
+++ b/source/Irrlicht/CBillboardSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBlit.h b/source/Irrlicht/CBlit.h
index d65b83e1..5bd51d2e 100644
--- a/source/Irrlicht/CBlit.h
+++ b/source/Irrlicht/CBlit.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBoneSceneNode.cpp b/source/Irrlicht/CBoneSceneNode.cpp
index e19bf6d7..1fec6ba9 100644
--- a/source/Irrlicht/CBoneSceneNode.cpp
+++ b/source/Irrlicht/CBoneSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBoneSceneNode.h b/source/Irrlicht/CBoneSceneNode.h
index f6528e70..107660cc 100644
--- a/source/Irrlicht/CBoneSceneNode.h
+++ b/source/Irrlicht/CBoneSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CBurningShader_Raster_Reference.cpp b/source/Irrlicht/CBurningShader_Raster_Reference.cpp
index 8b50b4ee..6aadebfa 100644
--- a/source/Irrlicht/CBurningShader_Raster_Reference.cpp
+++ b/source/Irrlicht/CBurningShader_Raster_Reference.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CCSMLoader.cpp b/source/Irrlicht/CCSMLoader.cpp
index c9f373eb..c3c70aeb 100644
--- a/source/Irrlicht/CCSMLoader.cpp
+++ b/source/Irrlicht/CCSMLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CCSMLoader.h b/source/Irrlicht/CCSMLoader.h
index fc6b0e03..6fc749f8 100644
--- a/source/Irrlicht/CCSMLoader.h
+++ b/source/Irrlicht/CCSMLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CCameraSceneNode.cpp b/source/Irrlicht/CCameraSceneNode.cpp
index 00259edb..2a545e14 100644
--- a/source/Irrlicht/CCameraSceneNode.cpp
+++ b/source/Irrlicht/CCameraSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CCameraSceneNode.h b/source/Irrlicht/CCameraSceneNode.h
index 6beee2dc..dcf68fb2 100644
--- a/source/Irrlicht/CCameraSceneNode.h
+++ b/source/Irrlicht/CCameraSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CColladaFileLoader.cpp b/source/Irrlicht/CColladaFileLoader.cpp
index d1fb19de..a9c6f04f 100644
--- a/source/Irrlicht/CColladaFileLoader.cpp
+++ b/source/Irrlicht/CColladaFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -1568,7 +1568,8 @@ const SColladaMaterial* CColladaFileLoader::findMaterial(const core::stringc& ma
{
// found the effect, instantiate by copying into the material
Materials[mat].Mat = Effects[effect].Mat;
- Materials[mat].Mat.setTexture(0, getTextureFromImage(Effects[effect].Textures[0]));
+ if (Effects[effect].Textures.size())
+ Materials[mat].Mat.setTexture(0, getTextureFromImage(Effects[effect].Textures[0]));
Materials[mat].Transparency = Effects[effect].Transparency;
// and indicate the material is instantiated by removing the effect ref
Materials[mat].InstanceEffectId = "";
diff --git a/source/Irrlicht/CColladaFileLoader.h b/source/Irrlicht/CColladaFileLoader.h
index d38f13ed..944449d7 100644
--- a/source/Irrlicht/CColladaFileLoader.h
+++ b/source/Irrlicht/CColladaFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CColladaMeshWriter.cpp b/source/Irrlicht/CColladaMeshWriter.cpp
index 0e3ba009..e2b5ecdc 100644
--- a/source/Irrlicht/CColladaMeshWriter.cpp
+++ b/source/Irrlicht/CColladaMeshWriter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CColladaMeshWriter.h b/source/Irrlicht/CColladaMeshWriter.h
index 694c73e4..74c0eae6 100644
--- a/source/Irrlicht/CColladaMeshWriter.h
+++ b/source/Irrlicht/CColladaMeshWriter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CColorConverter.cpp b/source/Irrlicht/CColorConverter.cpp
index 3435d77c..de72f189 100644
--- a/source/Irrlicht/CColorConverter.cpp
+++ b/source/Irrlicht/CColorConverter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CColorConverter.h b/source/Irrlicht/CColorConverter.h
index 580b5395..f5862b2c 100644
--- a/source/Irrlicht/CColorConverter.h
+++ b/source/Irrlicht/CColorConverter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CCubeSceneNode.cpp b/source/Irrlicht/CCubeSceneNode.cpp
index c22dc8b7..6d1d97cc 100644
--- a/source/Irrlicht/CCubeSceneNode.cpp
+++ b/source/Irrlicht/CCubeSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -69,8 +69,6 @@ void CCubeSceneNode::render()
// overwrite half transparency
if (DebugDataVisible & scene::EDS_HALF_TRANSPARENCY)
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
- else
- driver->setMaterial(Mesh->getMeshBuffer(0)->getMaterial());
driver->setMaterial(mat);
driver->drawMeshBuffer(Mesh->getMeshBuffer(0));
diff --git a/source/Irrlicht/CCubeSceneNode.h b/source/Irrlicht/CCubeSceneNode.h
index 33aa15ff..956c7bab 100644
--- a/source/Irrlicht/CCubeSceneNode.h
+++ b/source/Irrlicht/CCubeSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8Driver.cpp b/source/Irrlicht/CD3D8Driver.cpp
index c2770107..94ec1bd2 100644
--- a/source/Irrlicht/CD3D8Driver.cpp
+++ b/source/Irrlicht/CD3D8Driver.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -391,6 +391,17 @@ bool CD3D8Driver::initDriver(const core::dimension2d& screenSize,
MaxTextureUnits = core::min_((u32)Caps.MaxSimultaneousTextures, MATERIAL_MAX_TEXTURES);
MaxUserClipPlanes = (u32)Caps.MaxUserClipPlanes;
+ DriverAttributes->setAttribute("MaxTextures", (s32)MaxTextureUnits);
+ DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Caps.MaxSimultaneousTextures);
+ DriverAttributes->setAttribute("MaxAnisotropy", (s32)Caps.MaxAnisotropy);
+ DriverAttributes->setAttribute("MaxUserClipPlanes", (s32)Caps.MaxUserClipPlanes);
+ DriverAttributes->setAttribute("MaxIndices", (s32)Caps.MaxVertexIndex);
+ DriverAttributes->setAttribute("MaxTextureSize", (s32)core::min_(Caps.MaxTextureHeight,Caps.MaxTextureWidth));
+ DriverAttributes->setAttribute("MaxTextureLODBias", 16.f);
+ DriverAttributes->setAttribute("Version", 800);
+ DriverAttributes->setAttribute("ShaderLanguageVersion", (s32)Caps.VertexShaderVersion*100);
+ DriverAttributes->setAttribute("AntiAlias", antiAlias);
+
// set the renderstates
setRenderStates3DMode();
@@ -951,8 +962,8 @@ void CD3D8Driver::draw2D3DVertexPrimitiveList(const void* vertices,
case scene::EPT_LINE_LOOP:
{
pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_LINESTRIP, 0, vertexCount,
- primitiveCount, indexList, indexType, vertices, stride);
- u16 tmpIndices[] = {0, primitiveCount};
+ primitiveCount - 1, indexList, indexType, vertices, stride);
+ u16 tmpIndices[] = {primitiveCount - 1, 0};
pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_LINELIST, 0, vertexCount,
1, tmpIndices, indexType, vertices, stride);
}
@@ -1578,7 +1589,8 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria
if (resetAllRenderstates ||
lastmaterial.TextureLayer[st].BilinearFilter != material.TextureLayer[st].BilinearFilter ||
lastmaterial.TextureLayer[st].TrilinearFilter != material.TextureLayer[st].TrilinearFilter ||
- lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter )
+ lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter ||
+ lastmaterial.UseMipMaps != material.UseMipMaps)
{
if (material.TextureLayer[st].BilinearFilter || material.TextureLayer[st].TrilinearFilter || material.TextureLayer[st].AnisotropicFilter>1)
{
diff --git a/source/Irrlicht/CD3D8Driver.h b/source/Irrlicht/CD3D8Driver.h
index 84be6cf9..5b4d64ae 100644
--- a/source/Irrlicht/CD3D8Driver.h
+++ b/source/Irrlicht/CD3D8Driver.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8MaterialRenderer.h b/source/Irrlicht/CD3D8MaterialRenderer.h
index 24798012..059d592c 100644
--- a/source/Irrlicht/CD3D8MaterialRenderer.h
+++ b/source/Irrlicht/CD3D8MaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -258,7 +258,7 @@ public:
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
+ pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
diff --git a/source/Irrlicht/CD3D8NormalMapRenderer.cpp b/source/Irrlicht/CD3D8NormalMapRenderer.cpp
index 5f03131c..3d79e007 100644
--- a/source/Irrlicht/CD3D8NormalMapRenderer.cpp
+++ b/source/Irrlicht/CD3D8NormalMapRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8NormalMapRenderer.h b/source/Irrlicht/CD3D8NormalMapRenderer.h
index c4eb5265..edc53fdb 100644
--- a/source/Irrlicht/CD3D8NormalMapRenderer.h
+++ b/source/Irrlicht/CD3D8NormalMapRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp b/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp
index abe64a7e..46fd60ac 100644
--- a/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp
+++ b/source/Irrlicht/CD3D8ParallaxMapRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8ParallaxMapRenderer.h b/source/Irrlicht/CD3D8ParallaxMapRenderer.h
index 38f8f52d..0aa379e4 100644
--- a/source/Irrlicht/CD3D8ParallaxMapRenderer.h
+++ b/source/Irrlicht/CD3D8ParallaxMapRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp b/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp
index 00d34b37..6f449838 100644
--- a/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp
+++ b/source/Irrlicht/CD3D8ShaderMaterialRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8ShaderMaterialRenderer.h b/source/Irrlicht/CD3D8ShaderMaterialRenderer.h
index a50573d3..5642d0f2 100644
--- a/source/Irrlicht/CD3D8ShaderMaterialRenderer.h
+++ b/source/Irrlicht/CD3D8ShaderMaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D8Texture.cpp b/source/Irrlicht/CD3D8Texture.cpp
index c0ae62b3..4b281a2f 100644
--- a/source/Irrlicht/CD3D8Texture.cpp
+++ b/source/Irrlicht/CD3D8Texture.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -205,7 +205,7 @@ bool CD3D8Texture::copyTexture(video::IImage* image)
//! lock function
-void* CD3D8Texture::lock(bool readOnly, u32 mipmapLevel)
+void* CD3D8Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel)
{
if (!Texture)
return 0;
@@ -215,7 +215,7 @@ void* CD3D8Texture::lock(bool readOnly, u32 mipmapLevel)
D3DLOCKED_RECT rect;
if(!IsRenderTarget)
{
- hr = Texture->LockRect(mipmapLevel, &rect, 0, readOnly?D3DLOCK_READONLY:0);
+ hr = Texture->LockRect(mipmapLevel, &rect, 0, (mode==ETLM_READ_ONLY)?D3DLOCK_READONLY:0);
if (FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
diff --git a/source/Irrlicht/CD3D8Texture.h b/source/Irrlicht/CD3D8Texture.h
index 25ae8eeb..6a68b41b 100644
--- a/source/Irrlicht/CD3D8Texture.h
+++ b/source/Irrlicht/CD3D8Texture.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -38,7 +38,7 @@ public:
virtual ~CD3D8Texture();
//! lock function
- virtual void* lock(bool readOnly = false, u32 mipmapLevel=0);
+ virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0);
//! unlock function
virtual void unlock();
diff --git a/source/Irrlicht/CD3D9Driver.cpp b/source/Irrlicht/CD3D9Driver.cpp
index 4304539a..3dc43d39 100644
--- a/source/Irrlicht/CD3D9Driver.cpp
+++ b/source/Irrlicht/CD3D9Driver.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -32,7 +32,7 @@ CD3D9Driver::CD3D9Driver(const core::dimension2d& screenSize, HWND window,
D3DLibrary(0), pID3D(0), pID3DDevice(0), PrevRenderTarget(0),
WindowId(0), SceneSourceRect(0),
LastVertexType((video::E_VERTEX_TYPE)-1), VendorID(0),
- MaxTextureUnits(0), MaxUserClipPlanes(0),
+ MaxTextureUnits(0), MaxUserClipPlanes(0), MaxMRTs(1), NumSetMRTs(1),
MaxLightDistance(0.f), LastSetLight(-1), Cached2DModeSignature(0),
ColorFormat(ECF_A8R8G8B8), DeviceLost(false),
Fullscreen(fullscreen), DriverWasReset(true), OcclusionQuerySupport(false),
@@ -430,6 +430,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d& screenSize,
MaxTextureUnits = core::min_((u32)Caps.MaxSimultaneousTextures, MATERIAL_MAX_TEXTURES);
MaxUserClipPlanes = (u32)Caps.MaxUserClipPlanes;
+ MaxMRTs = (s32)Caps.NumSimultaneousRTs;
OcclusionQuerySupport=(pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, NULL) == S_OK);
if (VendorID==0x10DE)//NVidia
@@ -443,6 +444,19 @@ bool CD3D9Driver::initDriver(const core::dimension2d& screenSize,
D3DFMT_X8R8G8B8, 0,D3DRTYPE_SURFACE,
(D3DFORMAT)MAKEFOURCC('A','2','M','1')) == S_OK);
#endif
+
+ DriverAttributes->setAttribute("MaxTextures", (s32)MaxTextureUnits);
+ DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Caps.MaxSimultaneousTextures);
+ DriverAttributes->setAttribute("MaxAnisotropy", (s32)Caps.MaxAnisotropy);
+ DriverAttributes->setAttribute("MaxUserClipPlanes", (s32)Caps.MaxUserClipPlanes);
+ DriverAttributes->setAttribute("MaxMultipleRenderTargets", (s32)Caps.NumSimultaneousRTs);
+ DriverAttributes->setAttribute("MaxIndices", (s32)Caps.MaxVertexIndex);
+ DriverAttributes->setAttribute("MaxTextureSize", (s32)core::min_(Caps.MaxTextureHeight,Caps.MaxTextureWidth));
+ DriverAttributes->setAttribute("MaxTextureLODBias", 16);
+ DriverAttributes->setAttribute("Version", 901);
+ DriverAttributes->setAttribute("ShaderLanguageVersion", (s32)Caps.VertexShaderVersion*100);
+ DriverAttributes->setAttribute("AntiAlias", AntiAliasing);
+
// set the renderstates
setRenderStates3DMode();
@@ -775,6 +789,11 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture,
bool ret = true;
+ for(u32 i = 1; i < NumSetMRTs; i++)
+ {
+ // First texture handled elsewhere
+ pID3DDevice->SetRenderTarget(i, NULL);
+ }
if (tex == 0)
{
if (PrevRenderTarget)
@@ -848,7 +867,7 @@ bool CD3D9Driver::setRenderTarget(const core::array& targe
if (targets.size()==0)
return setRenderTarget(0, clearBackBuffer, clearZBuffer, color);
- u32 maxMultipleRTTs = core::min_(4u, targets.size());
+ u32 maxMultipleRTTs = core::min_(MaxMRTs, targets.size());
for (u32 i = 0; i < maxMultipleRTTs; ++i)
{
@@ -912,6 +931,7 @@ bool CD3D9Driver::setRenderTarget(const core::array& targe
// set new render target
+ // In d3d9 we have at most 4 MRTs, so the following is enough
D3DRENDERSTATETYPE colorWrite[4]={D3DRS_COLORWRITEENABLE, D3DRS_COLORWRITEENABLE1, D3DRS_COLORWRITEENABLE2, D3DRS_COLORWRITEENABLE3};
for (u32 i = 0; i < maxMultipleRTTs; ++i)
{
@@ -930,6 +950,11 @@ bool CD3D9Driver::setRenderTarget(const core::array& targe
pID3DDevice->SetRenderState(colorWrite[i], flag);
}
}
+ for(u32 i = maxMultipleRTTs; i < NumSetMRTs; i++)
+ {
+ pID3DDevice->SetRenderTarget(i, NULL);
+ }
+ NumSetMRTs=maxMultipleRTTs;
CurrentRendertargetSize = tex->getSize();
@@ -961,23 +986,22 @@ void CD3D9Driver::setViewPort(const core::rect& area)
core::rect vp = area;
core::rect rendert(0,0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
vp.clipAgainst(rendert);
-
- D3DVIEWPORT9 viewPort;
- viewPort.X = vp.UpperLeftCorner.X;
- viewPort.Y = vp.UpperLeftCorner.Y;
- viewPort.Width = vp.getWidth();
- viewPort.Height = vp.getHeight();
- viewPort.MinZ = 0.0f;
- viewPort.MaxZ = 1.0f;
-
- HRESULT hr = D3DERR_INVALIDCALL;
if (vp.getHeight()>0 && vp.getWidth()>0)
- hr = pID3DDevice->SetViewport(&viewPort);
+ {
+ D3DVIEWPORT9 viewPort;
+ viewPort.X = vp.UpperLeftCorner.X;
+ viewPort.Y = vp.UpperLeftCorner.Y;
+ viewPort.Width = vp.getWidth();
+ viewPort.Height = vp.getHeight();
+ viewPort.MinZ = 0.0f;
+ viewPort.MaxZ = 1.0f;
- if (FAILED(hr))
- os::Printer::log("Failed setting the viewport.", ELL_WARNING);
-
- ViewPort = vp;
+ HRESULT hr = pID3DDevice->SetViewport(&viewPort);
+ if (FAILED(hr))
+ os::Printer::log("Failed setting the viewport.", ELL_WARNING);
+ else
+ ViewPort = vp;
+ }
}
@@ -998,58 +1022,55 @@ bool CD3D9Driver::updateVertexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
const u32 vertexCount=mb->getVertexCount();
const E_VERTEX_TYPE vType=mb->getVertexType();
const u32 vertexSize = getVertexPitchFromType(vType);
+ const u32 bufSize = vertexSize * vertexCount;
- void* pLockedBuffer = 0;
-
- if (!hwBuffer->vertexBuffer || vertexSize * vertexCount > hwBuffer->vertexBufferSize)
+ if (!hwBuffer->vertexBuffer || (bufSize > hwBuffer->vertexBufferSize))
{
- DWORD flags = 0;
+ if (hwBuffer->vertexBuffer)
+ {
+ hwBuffer->vertexBuffer->Release();
+ hwBuffer->vertexBuffer=0;
+ }
- u32 vertexSize;
DWORD FVF;
-
// Get the vertex sizes and cvf
switch (vType)
{
case EVT_STANDARD:
- vertexSize = sizeof(S3DVertex);
FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX1;
break;
case EVT_2TCOORDS:
- vertexSize = sizeof(S3DVertex2TCoords);
FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX2;
break;
case EVT_TANGENTS:
- vertexSize = sizeof(S3DVertexTangents);
FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX3;
break;
default:
return false;
}
- flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
+ DWORD flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
if(hwBuffer->Mapped_Vertex != scene::EHM_STATIC)
flags |= D3DUSAGE_DYNAMIC;
- pID3DDevice->CreateVertexBuffer(vertexCount * vertexSize, flags, FVF, D3DPOOL_DEFAULT, &hwBuffer->vertexBuffer, NULL);
-
- if(!hwBuffer->vertexBuffer)
+ if (FAILED(pID3DDevice->CreateVertexBuffer(bufSize, flags, FVF, D3DPOOL_DEFAULT, &hwBuffer->vertexBuffer, NULL)))
return false;
+ hwBuffer->vertexBufferSize = bufSize;
flags = 0; // SIO2: Reset flags before Lock
if(hwBuffer->Mapped_Vertex != scene::EHM_STATIC)
flags = D3DLOCK_DISCARD;
- hwBuffer->vertexBuffer->Lock(0, vertexCount * vertexSize, (void**)&pLockedBuffer, flags);
- memcpy(pLockedBuffer, vertices, vertexCount * vertexSize);
+ void* lockedBuffer = 0;
+ hwBuffer->vertexBuffer->Lock(0, bufSize, (void**)&lockedBuffer, flags);
+ memcpy(lockedBuffer, vertices, bufSize);
hwBuffer->vertexBuffer->Unlock();
-
- hwBuffer->vertexBufferSize = vertexCount * vertexSize;
}
else
{
- hwBuffer->vertexBuffer->Lock(0, vertexCount * vertexSize, (void**)&pLockedBuffer, D3DLOCK_DISCARD);
- memcpy(pLockedBuffer, vertices, vertexCount * vertexSize);
+ void* lockedBuffer = 0;
+ hwBuffer->vertexBuffer->Lock(0, bufSize, (void**)&lockedBuffer, D3DLOCK_DISCARD);
+ memcpy(lockedBuffer, vertices, bufSize);
hwBuffer->vertexBuffer->Unlock();
}
@@ -1069,13 +1090,13 @@ bool CD3D9Driver::updateIndexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
D3DFORMAT indexType=D3DFMT_UNKNOWN;
switch (mb->getIndexType())
{
- case (EIT_16BIT):
+ case EIT_16BIT:
{
indexType=D3DFMT_INDEX16;
indexSize = 2;
break;
}
- case (EIT_32BIT):
+ case EIT_32BIT:
{
indexType=D3DFMT_INDEX32;
indexSize = 4;
@@ -1083,37 +1104,41 @@ bool CD3D9Driver::updateIndexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
}
}
- if (!hwBuffer->indexBuffer || indexSize * indexCount > hwBuffer->indexBufferSize)
+ const u32 bufSize = indexSize * indexCount;
+ if (!hwBuffer->indexBuffer || (bufSize > hwBuffer->indexBufferSize))
{
- DWORD flags = 0;
+ if (hwBuffer->indexBuffer)
+ {
+ hwBuffer->indexBuffer->Release();
+ hwBuffer->indexBuffer=0;
+ }
- flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
- if(hwBuffer->Mapped_Index != scene::EHM_STATIC)
+ DWORD flags = D3DUSAGE_WRITEONLY; // SIO2: Default to D3DUSAGE_WRITEONLY
+ if (hwBuffer->Mapped_Index != scene::EHM_STATIC)
flags |= D3DUSAGE_DYNAMIC; // SIO2: Add DYNAMIC flag for dynamic buffer data
- if(FAILED(pID3DDevice->CreateIndexBuffer( indexCount * indexSize, flags, indexType, D3DPOOL_DEFAULT, &hwBuffer->indexBuffer, NULL)))
+ if (FAILED(pID3DDevice->CreateIndexBuffer(bufSize, flags, indexType, D3DPOOL_DEFAULT, &hwBuffer->indexBuffer, NULL)))
return false;
- void* pIndices = 0;
-
flags = 0; // SIO2: Reset flags before Lock
- if(hwBuffer->Mapped_Index != scene::EHM_STATIC)
+ if (hwBuffer->Mapped_Index != scene::EHM_STATIC)
flags = D3DLOCK_DISCARD;
- if(FAILED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&pIndices, flags)))
+ void* lockedBuffer = 0;
+ if (FAILED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&lockedBuffer, flags)))
return false;
- memcpy(pIndices, indices, indexCount * indexSize);
+ memcpy(lockedBuffer, indices, bufSize);
hwBuffer->indexBuffer->Unlock();
- hwBuffer->indexBufferSize = indexCount * indexSize;
+ hwBuffer->indexBufferSize = bufSize;
}
else
{
- void* pIndices = 0;
- if( SUCCEEDED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&pIndices, D3DLOCK_DISCARD)))
+ void* lockedBuffer = 0;
+ if( SUCCEEDED(hwBuffer->indexBuffer->Lock( 0, 0, (void**)&lockedBuffer, D3DLOCK_DISCARD)))
{
- memcpy(pIndices, indices, indexCount * indexSize);
+ memcpy(lockedBuffer, indices, bufSize);
hwBuffer->indexBuffer->Unlock();
}
}
@@ -1133,7 +1158,6 @@ bool CD3D9Driver::updateHardwareBuffer(SHWBufferLink *hwBuffer)
if (hwBuffer->ChangedID_Vertex != hwBuffer->MeshBuffer->getChangedID_Vertex()
|| !((SHWBufferLink_d3d9*)hwBuffer)->vertexBuffer)
{
-
hwBuffer->ChangedID_Vertex = hwBuffer->MeshBuffer->getChangedID_Vertex();
if (!updateVertexHardwareBuffer((SHWBufferLink_d3d9*)hwBuffer))
@@ -1146,7 +1170,6 @@ bool CD3D9Driver::updateHardwareBuffer(SHWBufferLink *hwBuffer)
if (hwBuffer->ChangedID_Index != hwBuffer->MeshBuffer->getChangedID_Index()
|| !((SHWBufferLink_d3d9*)hwBuffer)->indexBuffer)
{
-
hwBuffer->ChangedID_Index = hwBuffer->MeshBuffer->getChangedID_Index();
if (!updateIndexHardwareBuffer((SHWBufferLink_d3d9*)hwBuffer))
@@ -1191,7 +1214,8 @@ CD3D9Driver::SHWBufferLink *CD3D9Driver::createHardwareBuffer(const scene::IMesh
void CD3D9Driver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer)
{
- if (!_HWBuffer) return;
+ if (!_HWBuffer)
+ return;
SHWBufferLink_d3d9 *HWBuffer=(SHWBufferLink_d3d9*)_HWBuffer;
if (HWBuffer->indexBuffer)
@@ -1225,8 +1249,10 @@ void CD3D9Driver::drawHardwareBuffer(SHWBufferLink *_HWBuffer)
const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer;
const E_VERTEX_TYPE vType = mb->getVertexType();
const u32 stride = getVertexPitchFromType(vType);
- if (HWBuffer->vertexBuffer) pID3DDevice->SetStreamSource(0, HWBuffer->vertexBuffer, 0, stride);
- if (HWBuffer->indexBuffer) pID3DDevice->SetIndices(HWBuffer->indexBuffer);
+ if (HWBuffer->vertexBuffer)
+ pID3DDevice->SetStreamSource(0, HWBuffer->vertexBuffer, 0, stride);
+ if (HWBuffer->indexBuffer)
+ pID3DDevice->SetIndices(HWBuffer->indexBuffer);
drawVertexPrimitiveList(0, mb->getVertexCount(), 0, mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType());
@@ -1463,9 +1489,9 @@ void CD3D9Driver::draw2D3DVertexPrimitiveList(const void* vertices,
else
{
pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_LINESTRIP, 0, vertexCount,
- primitiveCount, indexList, indexType, vertices, stride);
+ primitiveCount - 1, indexList, indexType, vertices, stride);
- u16 tmpIndices[] = {0, primitiveCount};
+ u16 tmpIndices[] = {primitiveCount - 1, 0};
pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_LINELIST, 0, vertexCount,
1, tmpIndices, indexType, vertices, stride);
@@ -1552,12 +1578,12 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
s16 indices[6] = {0,1,2,0,2,3};
+ setActiveTexture(0, const_cast(texture));
+
setRenderStates2DMode(useColor[0].getAlpha()<255 || useColor[1].getAlpha()<255 ||
useColor[2].getAlpha()<255 || useColor[3].getAlpha()<255,
true, useAlphaChannelOfTexture);
- setActiveTexture(0, const_cast(texture));
-
setVertexShader(EVT_STANDARD);
if (clipRect)
@@ -2280,7 +2306,8 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria
if (resetAllRenderstates ||
lastmaterial.TextureLayer[st].BilinearFilter != material.TextureLayer[st].BilinearFilter ||
lastmaterial.TextureLayer[st].TrilinearFilter != material.TextureLayer[st].TrilinearFilter ||
- lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter)
+ lastmaterial.TextureLayer[st].AnisotropicFilter != material.TextureLayer[st].AnisotropicFilter ||
+ lastmaterial.UseMipMaps != material.UseMipMaps)
{
if (material.TextureLayer[st].BilinearFilter || material.TextureLayer[st].TrilinearFilter || material.TextureLayer[st].AnisotropicFilter)
{
diff --git a/source/Irrlicht/CD3D9Driver.h b/source/Irrlicht/CD3D9Driver.h
index 4845cc96..d29bf138 100644
--- a/source/Irrlicht/CD3D9Driver.h
+++ b/source/Irrlicht/CD3D9Driver.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -442,6 +442,8 @@ namespace video
u32 MaxTextureUnits;
u32 MaxUserClipPlanes;
+ u32 MaxMRTs;
+ u32 NumSetMRTs;
f32 MaxLightDistance;
s32 LastSetLight;
diff --git a/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp b/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp
index bb8ea807..7c2978e5 100644
--- a/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp
+++ b/source/Irrlicht/CD3D9HLSLMaterialRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9HLSLMaterialRenderer.h b/source/Irrlicht/CD3D9HLSLMaterialRenderer.h
index 91744739..db45033a 100644
--- a/source/Irrlicht/CD3D9HLSLMaterialRenderer.h
+++ b/source/Irrlicht/CD3D9HLSLMaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9MaterialRenderer.h b/source/Irrlicht/CD3D9MaterialRenderer.h
index 284ac8ff..bc87b471 100644
--- a/source/Irrlicht/CD3D9MaterialRenderer.h
+++ b/source/Irrlicht/CD3D9MaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -289,7 +289,7 @@ public:
pID3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
- pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
+ pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
@@ -578,23 +578,22 @@ public:
{
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{
- pID3DDevice->SetTextureStageState (0, D3DTSS_COLOROP, D3DTOP_MODULATE);
- pID3DDevice->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- pID3DDevice->SetTextureStageState (0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
- pID3DDevice->SetTextureStageState (0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+ pID3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
+ pID3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ pID3DDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
+ pID3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pID3DDevice->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
- pID3DDevice->SetTransform( D3DTS_TEXTURE1, &SphereMapMatrixD3D9 );
- pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
- pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
- pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ pID3DDevice->SetTransform(D3DTS_TEXTURE1, &SphereMapMatrixD3D9 );
+ pID3DDevice->SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
+ pID3DDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pID3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
- pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
+ pID3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
@@ -602,9 +601,9 @@ public:
virtual void OnUnsetMaterial()
{
- pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
- pID3DDevice->SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, 1);
- pID3DDevice->SetTransform( D3DTS_TEXTURE1, &UnitMatrixD3D9 );
+ pID3DDevice->SetTextureStageState(1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE);
+ pID3DDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1);
+ pID3DDevice->SetTransform(D3DTS_TEXTURE1, &UnitMatrixD3D9);
}
//! Returns if the material is transparent. The scene managment needs to know this
diff --git a/source/Irrlicht/CD3D9NormalMapRenderer.cpp b/source/Irrlicht/CD3D9NormalMapRenderer.cpp
index c175d931..5ced0b54 100644
--- a/source/Irrlicht/CD3D9NormalMapRenderer.cpp
+++ b/source/Irrlicht/CD3D9NormalMapRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9NormalMapRenderer.h b/source/Irrlicht/CD3D9NormalMapRenderer.h
index 432ec552..103d5b22 100644
--- a/source/Irrlicht/CD3D9NormalMapRenderer.h
+++ b/source/Irrlicht/CD3D9NormalMapRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp b/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp
index 5ca4b622..faf8a443 100644
--- a/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp
+++ b/source/Irrlicht/CD3D9ParallaxMapRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9ParallaxMapRenderer.h b/source/Irrlicht/CD3D9ParallaxMapRenderer.h
index a62373d7..55925680 100644
--- a/source/Irrlicht/CD3D9ParallaxMapRenderer.h
+++ b/source/Irrlicht/CD3D9ParallaxMapRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp b/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp
index 4647c894..81cf5595 100644
--- a/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp
+++ b/source/Irrlicht/CD3D9ShaderMaterialRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9ShaderMaterialRenderer.h b/source/Irrlicht/CD3D9ShaderMaterialRenderer.h
index 66354de5..f04f7f76 100644
--- a/source/Irrlicht/CD3D9ShaderMaterialRenderer.h
+++ b/source/Irrlicht/CD3D9ShaderMaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CD3D9Texture.cpp b/source/Irrlicht/CD3D9Texture.cpp
index ec72c34b..aff46232 100644
--- a/source/Irrlicht/CD3D9Texture.cpp
+++ b/source/Irrlicht/CD3D9Texture.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -383,7 +383,7 @@ bool CD3D9Texture::copyTexture(IImage * image)
//! lock function
-void* CD3D9Texture::lock(bool readOnly, u32 mipmapLevel)
+void* CD3D9Texture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel)
{
if (!Texture)
return 0;
@@ -393,7 +393,7 @@ void* CD3D9Texture::lock(bool readOnly, u32 mipmapLevel)
D3DLOCKED_RECT rect;
if(!IsRenderTarget)
{
- hr = Texture->LockRect(mipmapLevel, &rect, 0, readOnly?D3DLOCK_READONLY:0);
+ hr = Texture->LockRect(mipmapLevel, &rect, 0, (mode==ETLM_READ_ONLY)?D3DLOCK_READONLY:0);
if (FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture.", ELL_ERROR);
@@ -429,7 +429,7 @@ void* CD3D9Texture::lock(bool readOnly, u32 mipmapLevel)
os::Printer::log("Could not lock DIRECT3D9 Texture", "Data copy failed.", ELL_ERROR);
return 0;
}
- hr = RTTSurface->LockRect(&rect, 0, readOnly?D3DLOCK_READONLY:0);
+ hr = RTTSurface->LockRect(&rect, 0, (mode==ETLM_READ_ONLY)?D3DLOCK_READONLY:0);
if(FAILED(hr))
{
os::Printer::log("Could not lock DIRECT3D9 Texture", "LockRect failed.", ELL_ERROR);
diff --git a/source/Irrlicht/CD3D9Texture.h b/source/Irrlicht/CD3D9Texture.h
index 19927f1c..3c8ca4e5 100644
--- a/source/Irrlicht/CD3D9Texture.h
+++ b/source/Irrlicht/CD3D9Texture.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -42,7 +42,7 @@ public:
virtual ~CD3D9Texture();
//! lock function
- virtual void* lock(bool readOnly = false, u32 mipmapLevel=0);
+ virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0);
//! unlock function
virtual void unlock();
diff --git a/source/Irrlicht/CDMFLoader.cpp b/source/Irrlicht/CDMFLoader.cpp
index 260befc9..c8491cb8 100644
--- a/source/Irrlicht/CDMFLoader.cpp
+++ b/source/Irrlicht/CDMFLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CDMFLoader.h b/source/Irrlicht/CDMFLoader.h
index 4727befe..4d0c866f 100644
--- a/source/Irrlicht/CDMFLoader.h
+++ b/source/Irrlicht/CDMFLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CDefaultGUIElementFactory.cpp b/source/Irrlicht/CDefaultGUIElementFactory.cpp
index 07cc11d3..8ea59d13 100644
--- a/source/Irrlicht/CDefaultGUIElementFactory.cpp
+++ b/source/Irrlicht/CDefaultGUIElementFactory.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDefaultGUIElementFactory.h b/source/Irrlicht/CDefaultGUIElementFactory.h
index 5a8b1423..28241d15 100644
--- a/source/Irrlicht/CDefaultGUIElementFactory.h
+++ b/source/Irrlicht/CDefaultGUIElementFactory.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp b/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
index ef913f6a..f3a879fe 100644
--- a/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
+++ b/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h b/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h
index d9f59c1d..6c749830 100644
--- a/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h
+++ b/source/Irrlicht/CDefaultSceneNodeAnimatorFactory.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDefaultSceneNodeFactory.cpp b/source/Irrlicht/CDefaultSceneNodeFactory.cpp
index 48256f21..1debd65d 100644
--- a/source/Irrlicht/CDefaultSceneNodeFactory.cpp
+++ b/source/Irrlicht/CDefaultSceneNodeFactory.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -49,6 +49,7 @@ CDefaultSceneNodeFactory::CDefaultSceneNodeFactory(ISceneManager* mgr)
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_BILLBOARD, "billBoard"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_ANIMATED_MESH, "animatedMesh"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_PARTICLE_SYSTEM, "particleSystem"));
+ SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_VOLUME_LIGHT, "volumeLight"));
// SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_MD3_SCENE_NODE, "md3"));
// legacy, for version <= 1.4.x irr files
@@ -108,6 +109,8 @@ ISceneNode* CDefaultSceneNodeFactory::addSceneNode(ESCENE_NODE_TYPE type, IScene
core::vector3df(), core::vector3df(1,1,1), true);
case ESNT_PARTICLE_SYSTEM:
return Manager->addParticleSystemSceneNode(true, parent);
+ case ESNT_VOLUME_LIGHT:
+ return (ISceneNode*)Manager->addVolumeLightSceneNode(parent);
default:
break;
}
diff --git a/source/Irrlicht/CDefaultSceneNodeFactory.h b/source/Irrlicht/CDefaultSceneNodeFactory.h
index a3bad9c0..079204f5 100644
--- a/source/Irrlicht/CDefaultSceneNodeFactory.h
+++ b/source/Irrlicht/CDefaultSceneNodeFactory.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDepthBuffer.cpp b/source/Irrlicht/CDepthBuffer.cpp
index 994401ab..509810bf 100644
--- a/source/Irrlicht/CDepthBuffer.cpp
+++ b/source/Irrlicht/CDepthBuffer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDepthBuffer.h b/source/Irrlicht/CDepthBuffer.h
index 2db2c842..31f81f18 100644
--- a/source/Irrlicht/CDepthBuffer.h
+++ b/source/Irrlicht/CDepthBuffer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDummyTransformationSceneNode.cpp b/source/Irrlicht/CDummyTransformationSceneNode.cpp
index dc020720..d279a783 100644
--- a/source/Irrlicht/CDummyTransformationSceneNode.cpp
+++ b/source/Irrlicht/CDummyTransformationSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CDummyTransformationSceneNode.h b/source/Irrlicht/CDummyTransformationSceneNode.h
index 379a4857..94650bc5 100644
--- a/source/Irrlicht/CDummyTransformationSceneNode.h
+++ b/source/Irrlicht/CDummyTransformationSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CEmptySceneNode.cpp b/source/Irrlicht/CEmptySceneNode.cpp
index eb583e31..98b4e0ae 100644
--- a/source/Irrlicht/CEmptySceneNode.cpp
+++ b/source/Irrlicht/CEmptySceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CEmptySceneNode.h b/source/Irrlicht/CEmptySceneNode.h
index 9f5c33b0..e15d9026 100644
--- a/source/Irrlicht/CEmptySceneNode.h
+++ b/source/Irrlicht/CEmptySceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CFPSCounter.cpp b/source/Irrlicht/CFPSCounter.cpp
index 2466f75c..ad5b7c59 100644
--- a/source/Irrlicht/CFPSCounter.cpp
+++ b/source/Irrlicht/CFPSCounter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CFPSCounter.h b/source/Irrlicht/CFPSCounter.h
index 358ee6df..1e107423 100644
--- a/source/Irrlicht/CFPSCounter.h
+++ b/source/Irrlicht/CFPSCounter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CFileList.cpp b/source/Irrlicht/CFileList.cpp
index b82dda96..48e19d47 100644
--- a/source/Irrlicht/CFileList.cpp
+++ b/source/Irrlicht/CFileList.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -128,18 +128,19 @@ u32 CFileList::getFileOffset(u32 index) const
s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) const
{
SFileListEntry entry;
+ // we only need FullName to be set for the search
entry.FullName = filename;
entry.IsDirectory = isDirectory;
- // swap
+ // exchange
entry.FullName.replace('\\', '/');
// remove trailing slash
- if (entry.Name.lastChar() == '/')
+ if (entry.FullName.lastChar() == '/')
{
entry.IsDirectory = true;
- entry.Name[ entry.Name.size()-1] = 0;
- entry.Name.validate();
+ entry.FullName[entry.FullName.size()-1] = 0;
+ entry.FullName.validate();
}
if (IgnoreCase)
@@ -151,12 +152,14 @@ s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) cons
return Files.binary_search(entry);
}
+
//! Returns the base path of the file list
const io::path& CFileList::getPath() const
{
return Path;
}
+
} // end namespace irr
} // end namespace io
diff --git a/source/Irrlicht/CFileList.h b/source/Irrlicht/CFileList.h
index ef6e6027..94423fa6 100644
--- a/source/Irrlicht/CFileList.h
+++ b/source/Irrlicht/CFileList.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CFileSystem.cpp b/source/Irrlicht/CFileSystem.cpp
index 42d759dd..0cbaa209 100644
--- a/source/Irrlicht/CFileSystem.cpp
+++ b/source/Irrlicht/CFileSystem.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -21,6 +21,7 @@
#include "CAttributes.h"
#include "CMemoryFile.h"
#include "CLimitReadFile.h"
+#include "irrList.h"
#if defined (_IRR_WINDOWS_API_)
#if !defined ( _WIN32_WCE )
@@ -206,7 +207,11 @@ bool CFileSystem::addFileArchive(const io::path& filename, bool ignoreCase,
// check if the archive was already loaded
for (i = 0; i < FileArchives.size(); ++i)
{
- if (getAbsolutePath(filename) == FileArchives[i]->getFileList()->getPath())
+ // TODO: This should go into a path normalization method
+ // We need to check for directory names with trailing slash and without
+ const core::stringc absPath = getAbsolutePath(filename);
+ const core::stringc arcPath = FileArchives[i]->getFileList()->getPath();
+ if ((absPath == arcPath) || ((absPath+"/") == arcPath))
{
if (password.size())
FileArchives[i]->Password=password;
@@ -588,7 +593,43 @@ io::path& CFileSystem::flattenFilename(io::path& directory, const io::path& root
}
-//! Creates a list of files and directories in the current working directory
+//! Get the relative filename, relative to the given directory
+path CFileSystem::getRelativeFilename(const path& filename, const path& directory) const
+{
+ io::path path, file, ext;
+ core::splitFilename(getAbsolutePath(filename), &path, &file, &ext);
+ io::path path2(getAbsolutePath(directory));
+ core::list list1, list2;
+ path.split(list1, "/\\", 2);
+ path2.split(list2, "/\\", 2);
+ u32 i=0;
+ core::list::ConstIterator it1,it2;
+ it1=list1.begin();
+ it2=list2.begin();
+ for (; idraw(Text.c_str(), rect,
- skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
+ skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
true, true, &AbsoluteClippingRect);
}
diff --git a/source/Irrlicht/CGUIButton.h b/source/Irrlicht/CGUIButton.h
index 2a1119cf..c3a3336e 100644
--- a/source/Irrlicht/CGUIButton.h
+++ b/source/Irrlicht/CGUIButton.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUICheckBox.cpp b/source/Irrlicht/CGUICheckBox.cpp
index f543fe99..92bc5d3c 100644
--- a/source/Irrlicht/CGUICheckBox.cpp
+++ b/source/Irrlicht/CGUICheckBox.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -34,7 +34,7 @@ CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIEleme
//! called if an event happened.
bool CGUICheckBox::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
{
@@ -127,36 +127,42 @@ void CGUICheckBox::draw()
return;
IGUISkin* skin = Environment->getSkin();
-
- core::rect rect = AbsoluteRect;
-
- s32 height = skin->getSize(EGDS_CHECK_BOX_WIDTH);
-
- core::rect checkRect(AbsoluteRect.UpperLeftCorner.X,
- ((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y,
- 0, 0);
-
- checkRect.LowerRightCorner.X = checkRect.UpperLeftCorner.X + height;
- checkRect.LowerRightCorner.Y = checkRect.UpperLeftCorner.Y + height;
-
- skin->draw3DSunkenPane(this, skin->getColor(Pressed || !IsEnabled ? EGDC_3D_FACE : EGDC_ACTIVE_CAPTION),
- false, true, checkRect, &AbsoluteClippingRect);
-
- if (Checked && Environment->getSkin())
- Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(),
- checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect);
-
- if (Text.size())
+ if (skin)
{
- checkRect = AbsoluteRect;
- checkRect.UpperLeftCorner.X += height + 5;
+ const core::rect rect = AbsoluteRect;
+ const s32 height = skin->getSize(EGDS_CHECK_BOX_WIDTH);
- IGUIFont* font = skin->getFont();
- if (font)
- font->draw(Text.c_str(), checkRect,
- skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), false, true, &AbsoluteClippingRect);
+ core::rect checkRect(AbsoluteRect.UpperLeftCorner.X,
+ ((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y,
+ 0, 0);
+
+ checkRect.LowerRightCorner.X = checkRect.UpperLeftCorner.X + height;
+ checkRect.LowerRightCorner.Y = checkRect.UpperLeftCorner.Y + height;
+
+ EGUI_DEFAULT_COLOR col = EGDC_GRAY_EDITABLE;
+ if ( isEnabled() )
+ col = Pressed ? EGDC_FOCUSED_EDITABLE : EGDC_EDITABLE;
+ skin->draw3DSunkenPane(this, skin->getColor(col),
+ false, true, checkRect, &AbsoluteClippingRect);
+
+ if (Checked)
+ {
+ skin->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(),
+ checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect);
+ }
+ if (Text.size())
+ {
+ checkRect = AbsoluteRect;
+ checkRect.UpperLeftCorner.X += height + 5;
+
+ IGUIFont* font = skin->getFont();
+ if (font)
+ {
+ font->draw(Text.c_str(), checkRect,
+ skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), false, true, &AbsoluteClippingRect);
+ }
+ }
}
-
IGUIElement::draw();
}
diff --git a/source/Irrlicht/CGUICheckBox.h b/source/Irrlicht/CGUICheckBox.h
index ced97bf0..9c7a09df 100644
--- a/source/Irrlicht/CGUICheckBox.h
+++ b/source/Irrlicht/CGUICheckBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIColorSelectDialog.cpp b/source/Irrlicht/CGUIColorSelectDialog.cpp
index 2306d57a..8ad64cb8 100644
--- a/source/Irrlicht/CGUIColorSelectDialog.cpp
+++ b/source/Irrlicht/CGUIColorSelectDialog.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -273,7 +273,7 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d & dim,
{
const u32 alpha = (u32) ( (rTest - 0.5f ) * ( 255.f / 0.05f ) );
rgb.setAlpha(alpha);
- }
+ }
else if ( rTest >= 0.95f )
{
const u32 alpha = (u32) ( (rTest - 0.95f ) * ( 255.f / 0.05f ) );
@@ -312,7 +312,7 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d & dim,
//! called if an event happened.
bool CGUIColorSelectDialog::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
{
diff --git a/source/Irrlicht/CGUIColorSelectDialog.h b/source/Irrlicht/CGUIColorSelectDialog.h
index 4920eb64..0edde5cf 100644
--- a/source/Irrlicht/CGUIColorSelectDialog.h
+++ b/source/Irrlicht/CGUIColorSelectDialog.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIComboBox.cpp b/source/Irrlicht/CGUIComboBox.cpp
index 6e113066..3ab01eca 100644
--- a/source/Irrlicht/CGUIComboBox.cpp
+++ b/source/Irrlicht/CGUIComboBox.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -182,7 +182,7 @@ void CGUIComboBox::setSelected(s32 idx)
//! called if an event happened.
bool CGUIComboBox::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
{
@@ -377,8 +377,8 @@ void CGUIComboBox::draw()
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));
+ ListButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL));
+ ListButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_DOWN), skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL));
core::rect frameRect(AbsoluteRect);
diff --git a/source/Irrlicht/CGUIComboBox.h b/source/Irrlicht/CGUIComboBox.h
index f56c552f..1c656d8d 100644
--- a/source/Irrlicht/CGUIComboBox.h
+++ b/source/Irrlicht/CGUIComboBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIContextMenu.cpp b/source/Irrlicht/CGUIContextMenu.cpp
index 935fff4d..dc6618f1 100644
--- a/source/Irrlicht/CGUIContextMenu.cpp
+++ b/source/Irrlicht/CGUIContextMenu.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -276,7 +276,7 @@ void CGUIContextMenu::removeAllItems()
//! called if an event happened.
bool CGUIContextMenu::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
@@ -288,15 +288,24 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
if (event.GUIEvent.Caller == this && !isMyChild(event.GUIEvent.Element) && AllowFocus)
{
// set event parent of submenus
- setEventParent(EventParent ? EventParent : Parent);
+ IGUIElement * p = EventParent ? EventParent : Parent;
+ setEventParent(p);
- if ( CloseHandling & ECMC_HIDE )
+ SEvent event;
+ event.EventType = EET_GUI_EVENT;
+ event.GUIEvent.Caller = this;
+ event.GUIEvent.Element = 0;
+ event.GUIEvent.EventType = EGET_ELEMENT_CLOSED;
+ if ( !p->OnEvent(event) )
{
- setVisible(false);
- }
- if ( CloseHandling & ECMC_REMOVE )
- {
- remove();
+ if ( CloseHandling & ECMC_HIDE )
+ {
+ setVisible(false);
+ }
+ if ( CloseHandling & ECMC_REMOVE )
+ {
+ remove();
+ }
}
return false;
@@ -417,11 +426,16 @@ u32 CGUIContextMenu::sendClick(const core::position2d& p)
//! returns true, if an element was highligted
bool CGUIContextMenu::highlight(const core::position2d& p, bool canOpenSubMenu)
{
+ if (!isEnabled())
+ {
+ return false;
+ }
+
// get number of open submenu
s32 openmenu = -1;
s32 i;
for (i=0; i<(s32)Items.size(); ++i)
- if (Items[i].SubMenu && Items[i].SubMenu->isVisible())
+ if (Items[i].Enabled && Items[i].SubMenu && Items[i].SubMenu->isVisible())
{
openmenu = i;
break;
@@ -430,7 +444,7 @@ bool CGUIContextMenu::highlight(const core::position2d& p, bool canOpenSubM
// delegate highlight operation to submenu
if (openmenu != -1)
{
- if (Items[openmenu].SubMenu->highlight(p, canOpenSubMenu))
+ if (Items[openmenu].Enabled && Items[openmenu].SubMenu->highlight(p, canOpenSubMenu))
{
HighLighted = openmenu;
ChangeTime = os::Timer::getTime();
@@ -440,7 +454,8 @@ bool CGUIContextMenu::highlight(const core::position2d& p, bool canOpenSubM
// highlight myself
for (i=0; i<(s32)Items.size(); ++i)
- if (getHRect(Items[i], AbsoluteRect).isPointInside(p))
+ {
+ if (Items[i].Enabled && getHRect(Items[i], AbsoluteRect).isPointInside(p))
{
HighLighted = i;
ChangeTime = os::Timer::getTime();
@@ -456,6 +471,7 @@ bool CGUIContextMenu::highlight(const core::position2d& p, bool canOpenSubM
}
return true;
}
+ }
HighLighted = openmenu;
return false;
diff --git a/source/Irrlicht/CGUIContextMenu.h b/source/Irrlicht/CGUIContextMenu.h
index e78e64d0..80786231 100644
--- a/source/Irrlicht/CGUIContextMenu.h
+++ b/source/Irrlicht/CGUIContextMenu.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIEditBox.cpp b/source/Irrlicht/CGUIEditBox.cpp
index f5b81b2b..756100c3 100644
--- a/source/Irrlicht/CGUIEditBox.cpp
+++ b/source/Irrlicht/CGUIEditBox.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -207,7 +207,7 @@ void CGUIEditBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ver
//! called if an event happened.
bool CGUIEditBox::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
@@ -290,7 +290,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(sc.c_str());
- if (IsEnabled)
+ if (isEnabled())
{
// delete
core::stringw s;
@@ -306,7 +306,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
}
break;
case KEY_KEY_V:
- if ( !IsEnabled )
+ if ( !isEnabled() )
break;
// paste from the clipboard
@@ -562,7 +562,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
break;
case KEY_BACK:
- if ( !this->IsEnabled )
+ if ( !isEnabled() )
break;
if (Text.size())
@@ -602,7 +602,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
}
break;
case KEY_DELETE:
- if ( !this->IsEnabled )
+ if ( !isEnabled() )
break;
if (Text.size() != 0)
@@ -708,7 +708,10 @@ void CGUIEditBox::draw()
if (Border)
{
- skin->draw3DSunkenPane(this, skin->getColor(EGDC_WINDOW),
+ EGUI_DEFAULT_COLOR col = EGDC_GRAY_EDITABLE;
+ if ( isEnabled() )
+ col = focus ? EGDC_FOCUSED_EDITABLE : EGDC_EDITABLE;
+ skin->draw3DSunkenPane(this, skin->getColor(col),
false, true, FrameRect, &AbsoluteClippingRect);
FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
@@ -757,7 +760,7 @@ void CGUIEditBox::draw()
if (Text.size())
{
- if (!IsEnabled && !OverrideColorEnabled)
+ if (!isEnabled() && !OverrideColorEnabled)
{
OverrideColorEnabled = true;
OverrideColor = skin->getColor(EGDC_GRAY_TEXT);
@@ -1053,7 +1056,7 @@ s32 CGUIEditBox::getCursorPos(s32 x, s32 y)
if (x < CurrentTextRect.UpperLeftCorner.X)
x = CurrentTextRect.UpperLeftCorner.X;
- s32 idx = font->getCharacterFromPos(Text.c_str(), x - CurrentTextRect.UpperLeftCorner.X);
+ s32 idx = txtLine ? font->getCharacterFromPos(txtLine->c_str(), x - CurrentTextRect.UpperLeftCorner.X) : -1;
// click was on or left of the line
if (idx != -1)
@@ -1270,7 +1273,7 @@ s32 CGUIEditBox::getLineFromPos(s32 pos)
void CGUIEditBox::inputChar(wchar_t c)
{
- if (!IsEnabled)
+ if (!isEnabled())
return;
if (c != 0)
diff --git a/source/Irrlicht/CGUIEditBox.h b/source/Irrlicht/CGUIEditBox.h
index 2a400f8e..39ae7498 100644
--- a/source/Irrlicht/CGUIEditBox.h
+++ b/source/Irrlicht/CGUIEditBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIEnvironment.cpp b/source/Irrlicht/CGUIEnvironment.cpp
index af7f0701..feec4bf6 100644
--- a/source/Irrlicht/CGUIEnvironment.cpp
+++ b/source/Irrlicht/CGUIEnvironment.cpp
@@ -1,5 +1,5 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -54,7 +54,7 @@ const wchar_t* IRR_XML_FORMAT_GUI_ELEMENT_ATTR_TYPE = L"type";
//! constructor
CGUIEnvironment::CGUIEnvironment(io::IFileSystem* fs, video::IVideoDriver* driver, IOSOperator* op)
-: IGUIElement(EGUIET_ELEMENT, 0, 0, 0, core::rect(core::position2d(0,0), driver ? core::dimension2d(driver->getScreenSize()) : core::dimension2d(0,0))),
+: IGUIElement(EGUIET_ROOT, 0, 0, 0, core::rect(core::position2d(0,0), driver ? core::dimension2d(driver->getScreenSize()) : core::dimension2d(0,0))),
Driver(driver), Hovered(0), HoveredNoSubelement(0), Focus(0), LastHoveredMousePos(0,0), CurrentSkin(0),
FileSystem(fs), UserReceiver(0), Operator(op)
{
@@ -699,6 +699,7 @@ IGUIElement* CGUIEnvironment::addGUIElement(const c8* elementName, IGUIElement*
for (u32 i=0; iaddGUIElement(elementName, parent);
+
return node;
}
@@ -1481,6 +1482,21 @@ IGUIFont* CGUIEnvironment::addFont(const io::path& name, IGUIFont* font)
return font;
}
+//! remove loaded font
+void CGUIEnvironment::removeFont(IGUIFont* font)
+{
+ if ( !font )
+ return;
+ for ( u32 i=0; idrop();
+ Fonts.erase(i);
+ return;
+ }
+ }
+}
//! returns default font
IGUIFont* CGUIEnvironment::getBuiltInFont() const
diff --git a/source/Irrlicht/CGUIEnvironment.h b/source/Irrlicht/CGUIEnvironment.h
index 16ca8ea6..e7944bb9 100644
--- a/source/Irrlicht/CGUIEnvironment.h
+++ b/source/Irrlicht/CGUIEnvironment.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -80,6 +80,9 @@ public:
//! add an externally loaded font
virtual IGUIFont* addFont(const io::path& name, IGUIFont* font);
+ //! remove loaded font
+ virtual void removeFont(IGUIFont* font);
+
//! returns default font
virtual IGUIFont* getBuiltInFont() const;
diff --git a/source/Irrlicht/CGUIFileOpenDialog.cpp b/source/Irrlicht/CGUIFileOpenDialog.cpp
index 2f22387d..164c9500 100644
--- a/source/Irrlicht/CGUIFileOpenDialog.cpp
+++ b/source/Irrlicht/CGUIFileOpenDialog.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -145,7 +145,7 @@ const io::path& CGUIFileOpenDialog::getDirectoryName()
//! called if an event happened.
bool CGUIFileOpenDialog::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
{
diff --git a/source/Irrlicht/CGUIFileOpenDialog.h b/source/Irrlicht/CGUIFileOpenDialog.h
index 8aa4c7c2..9461c0b7 100644
--- a/source/Irrlicht/CGUIFileOpenDialog.h
+++ b/source/Irrlicht/CGUIFileOpenDialog.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIFont.cpp b/source/Irrlicht/CGUIFont.cpp
index 4919bddb..0e2a5253 100644
--- a/source/Irrlicht/CGUIFont.cpp
+++ b/source/Irrlicht/CGUIFont.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -470,7 +470,7 @@ void CGUIFont::draw(const core::stringw& text, const core::rect& position,
if (!Driver)
return;
- core::dimension2d textDimension; // NOTE: don't make this u32 or the >> later on can fail when the dimension widht is < position width
+ core::dimension2d textDimension; // NOTE: don't make this u32 or the >> later on can fail when the dimension width is < position width
core::position2d offset = position.UpperLeftCorner;
if (hcenter || vcenter || clip)
diff --git a/source/Irrlicht/CGUIFont.h b/source/Irrlicht/CGUIFont.h
index e9a8d30e..73427f3f 100644
--- a/source/Irrlicht/CGUIFont.h
+++ b/source/Irrlicht/CGUIFont.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIImage.cpp b/source/Irrlicht/CGUIImage.cpp
index 0bf3dd89..126a5d4a 100644
--- a/source/Irrlicht/CGUIImage.cpp
+++ b/source/Irrlicht/CGUIImage.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -49,6 +49,11 @@ void CGUIImage::setImage(video::ITexture* image)
Texture->grab();
}
+//! Gets the image texture
+video::ITexture* CGUIImage::getImage() const
+{
+ return Texture;
+}
//! sets the color of the image
void CGUIImage::setColor(video::SColor color)
@@ -56,6 +61,11 @@ void CGUIImage::setColor(video::SColor color)
Color = color;
}
+//! Gets the color of the image
+video::SColor CGUIImage::getColor() const
+{
+ return Color;
+}
//! draws the element and its children
void CGUIImage::draw()
diff --git a/source/Irrlicht/CGUIImage.h b/source/Irrlicht/CGUIImage.h
index f0a9d699..bf81de3f 100644
--- a/source/Irrlicht/CGUIImage.h
+++ b/source/Irrlicht/CGUIImage.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -28,6 +28,9 @@ namespace gui
//! sets an image
virtual void setImage(video::ITexture* image);
+ //! Gets the image texture
+ virtual video::ITexture* getImage() const;
+
//! sets the color of the image
virtual void setColor(video::SColor color);
@@ -40,6 +43,9 @@ namespace gui
//! sets if the image should use its alpha channel to draw itself
virtual void setUseAlphaChannel(bool use);
+ //! Gets the color of the image
+ virtual video::SColor getColor() const;
+
//! Returns true if the image is scaled to fit, false if not
virtual bool isImageScaled() const;
diff --git a/source/Irrlicht/CGUIInOutFader.cpp b/source/Irrlicht/CGUIInOutFader.cpp
index bf513ad2..f5226289 100644
--- a/source/Irrlicht/CGUIInOutFader.cpp
+++ b/source/Irrlicht/CGUIInOutFader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIInOutFader.h b/source/Irrlicht/CGUIInOutFader.h
index 6e9ba3e8..e97d31bf 100644
--- a/source/Irrlicht/CGUIInOutFader.h
+++ b/source/Irrlicht/CGUIInOutFader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIListBox.cpp b/source/Irrlicht/CGUIListBox.cpp
index ac5f3e7a..4d8e07f3 100644
--- a/source/Irrlicht/CGUIListBox.cpp
+++ b/source/Irrlicht/CGUIListBox.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -162,7 +162,7 @@ void CGUIListBox::recalculateItemHeight()
}
TotalItemHeight = ItemHeight * Items.size();
- ScrollBar->setMax(TotalItemHeight - AbsoluteRect.getHeight());
+ ScrollBar->setMax( core::max_(0, TotalItemHeight - AbsoluteRect.getHeight()) );
s32 minItemHeight = ItemHeight > 0 ? ItemHeight : 1;
ScrollBar->setSmallStep ( minItemHeight );
ScrollBar->setLargeStep ( 2*minItemHeight );
@@ -213,7 +213,7 @@ void CGUIListBox::setSelected(const wchar_t *item)
//! called if an event happened.
bool CGUIListBox::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
{
diff --git a/source/Irrlicht/CGUIListBox.h b/source/Irrlicht/CGUIListBox.h
index 2aaa0811..ac1e101b 100644
--- a/source/Irrlicht/CGUIListBox.h
+++ b/source/Irrlicht/CGUIListBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIMenu.cpp b/source/Irrlicht/CGUIMenu.cpp
index 76c37268..ee92a91a 100644
--- a/source/Irrlicht/CGUIMenu.cpp
+++ b/source/Irrlicht/CGUIMenu.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -100,7 +100,7 @@ void CGUIMenu::draw()
//! called if an event happened.
bool CGUIMenu::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
diff --git a/source/Irrlicht/CGUIMenu.h b/source/Irrlicht/CGUIMenu.h
index c7168f76..01509ef3 100644
--- a/source/Irrlicht/CGUIMenu.h
+++ b/source/Irrlicht/CGUIMenu.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIMeshViewer.cpp b/source/Irrlicht/CGUIMeshViewer.cpp
index b7f11919..3a901320 100644
--- a/source/Irrlicht/CGUIMeshViewer.cpp
+++ b/source/Irrlicht/CGUIMeshViewer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIMeshViewer.h b/source/Irrlicht/CGUIMeshViewer.h
index cf6d148c..60e7ad6c 100644
--- a/source/Irrlicht/CGUIMeshViewer.h
+++ b/source/Irrlicht/CGUIMeshViewer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIMessageBox.cpp b/source/Irrlicht/CGUIMessageBox.cpp
index f30acef4..76148a7c 100644
--- a/source/Irrlicht/CGUIMessageBox.cpp
+++ b/source/Irrlicht/CGUIMessageBox.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -254,7 +254,7 @@ void CGUIMessageBox::refreshControls()
//! called if an event happened.
bool CGUIMessageBox::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
SEvent outevent;
outevent.EventType = EET_GUI_EVENT;
diff --git a/source/Irrlicht/CGUIMessageBox.h b/source/Irrlicht/CGUIMessageBox.h
index 3885c8c8..7c43b771 100644
--- a/source/Irrlicht/CGUIMessageBox.h
+++ b/source/Irrlicht/CGUIMessageBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIModalScreen.cpp b/source/Irrlicht/CGUIModalScreen.cpp
index bcdf6452..895471ed 100644
--- a/source/Irrlicht/CGUIModalScreen.cpp
+++ b/source/Irrlicht/CGUIModalScreen.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -77,7 +77,7 @@ bool CGUIModalScreen::isPointInside(const core::position2d& point) const
//! called if an event happened.
bool CGUIModalScreen::OnEvent(const SEvent& event)
{
- if (!IsEnabled || !isVisible() )
+ if (!isEnabled() || !isVisible() )
return IGUIElement::OnEvent(event);
switch(event.EventType)
@@ -88,14 +88,27 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
case EGET_ELEMENT_FOCUSED:
if ( !canTakeFocus(event.GUIEvent.Caller))
{
- Environment->setFocus(this);
+ if ( !Children.empty() )
+ Environment->setFocus(*(Children.begin()));
+ else
+ Environment->setFocus(this);
}
IGUIElement::OnEvent(event);
return false;
case EGET_ELEMENT_FOCUS_LOST:
if ( !canTakeFocus(event.GUIEvent.Element))
{
- MouseDownTime = os::Timer::getTime();
+ if ( isMyChild(event.GUIEvent.Caller) )
+ {
+ if ( !Children.empty() )
+ Environment->setFocus(*(Children.begin()));
+ else
+ Environment->setFocus(this);
+ }
+ else
+ {
+ MouseDownTime = os::Timer::getTime();
+ }
return true;
}
else
@@ -118,7 +131,7 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
break;
}
- IGUIElement::OnEvent(event);
+ IGUIElement::OnEvent(event); // anyone knows why events are passed on here? Causes p.e. problems when this is child of a CGUIWindow.
return true; // absorb everything else
}
diff --git a/source/Irrlicht/CGUIModalScreen.h b/source/Irrlicht/CGUIModalScreen.h
index cac27d6c..c934aa4e 100644
--- a/source/Irrlicht/CGUIModalScreen.h
+++ b/source/Irrlicht/CGUIModalScreen.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIScrollBar.cpp b/source/Irrlicht/CGUIScrollBar.cpp
index b2986cea..b61708a4 100644
--- a/source/Irrlicht/CGUIScrollBar.cpp
+++ b/source/Irrlicht/CGUIScrollBar.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -59,7 +59,7 @@ CGUIScrollBar::~CGUIScrollBar()
//! called if an event happened.
bool CGUIScrollBar::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
@@ -280,7 +280,7 @@ void CGUIScrollBar::draw()
return;
- video::SColor iconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
+ video::SColor iconColor = skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL);
if ( iconColor != CurrentIconColor )
{
refreshControls();
@@ -406,7 +406,9 @@ s32 CGUIScrollBar::getMax() const
//! sets the maximum value of the scrollbar.
void CGUIScrollBar::setMax(s32 max)
{
- Max = core::max_ ( max, Min );
+ Max = max;
+ if ( Min > Max )
+ Min = Max;
bool enable = core::isnotzero ( range() );
UpButton->setEnabled(enable);
@@ -424,7 +426,10 @@ s32 CGUIScrollBar::getMin() const
//! sets the minimum value of the scrollbar.
void CGUIScrollBar::setMin(s32 min)
{
- Min = core::min_ ( min, Max );
+ Min = min;
+ if ( Max < Min )
+ Max = Min;
+
bool enable = core::isnotzero ( range() );
UpButton->setEnabled(enable);
@@ -451,7 +456,7 @@ void CGUIScrollBar::refreshControls()
if (skin)
{
sprites = skin->getSpriteBank();
- CurrentIconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
+ CurrentIconColor = skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL);
}
if (Horizontal)
diff --git a/source/Irrlicht/CGUIScrollBar.h b/source/Irrlicht/CGUIScrollBar.h
index 26a4b6f1..850137a8 100644
--- a/source/Irrlicht/CGUIScrollBar.h
+++ b/source/Irrlicht/CGUIScrollBar.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUISkin.cpp b/source/Irrlicht/CGUISkin.cpp
index 395691d6..db827eea 100644
--- a/source/Irrlicht/CGUISkin.cpp
+++ b/source/Irrlicht/CGUISkin.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -7,6 +7,7 @@
#include "IGUIFont.h"
#include "IGUISpriteBank.h"
+#include "IGUIElement.h"
#include "IVideoDriver.h"
#include "IAttributes.h"
@@ -24,27 +25,32 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
if ((Type == EGST_WINDOWS_CLASSIC) || (Type == EGST_WINDOWS_METALLIC))
{
- Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50);
- Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130);
- Colors[EGDC_3D_FACE] = video::SColor(101,210,210,210);
- Colors[EGDC_3D_HIGH_LIGHT] = video::SColor(101,255,255,255);
- Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210);
- Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115);
- Colors[EGDC_ACTIVE_CAPTION] = video::SColor(255,255,255,255);
- Colors[EGDC_APP_WORKSPACE] = video::SColor(101,100,100,100);
- Colors[EGDC_BUTTON_TEXT] = video::SColor(240,10,10,10);
- Colors[EGDC_GRAY_TEXT] = video::SColor(240,130,130,130);
- Colors[EGDC_HIGH_LIGHT] = video::SColor(101,8,36,107);
- Colors[EGDC_HIGH_LIGHT_TEXT] = video::SColor(240,255,255,255);
- Colors[EGDC_INACTIVE_BORDER] = video::SColor(101,165,165,165);
- Colors[EGDC_INACTIVE_CAPTION] = video::SColor(255,30,30,30);
- Colors[EGDC_TOOLTIP] = video::SColor(200,0,0,0);
- Colors[EGDC_TOOLTIP_BACKGROUND]= video::SColor(200,255,255,225);
- Colors[EGDC_SCROLLBAR] = video::SColor(101,230,230,230);
- Colors[EGDC_WINDOW] = video::SColor(101,255,255,255);
- Colors[EGDC_WINDOW_SYMBOL] = video::SColor(200,10,10,10);
- Colors[EGDC_ICON] = video::SColor(200,255,255,255);
- Colors[EGDC_ICON_HIGH_LIGHT] = video::SColor(200,8,36,107);
+ Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50);
+ Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130);
+ Colors[EGDC_3D_FACE] = video::SColor(101,210,210,210);
+ Colors[EGDC_3D_HIGH_LIGHT] = video::SColor(101,255,255,255);
+ Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210);
+ Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115);
+ Colors[EGDC_ACTIVE_CAPTION] = video::SColor(255,255,255,255);
+ Colors[EGDC_APP_WORKSPACE] = video::SColor(101,100,100,100);
+ Colors[EGDC_BUTTON_TEXT] = video::SColor(240,10,10,10);
+ Colors[EGDC_GRAY_TEXT] = video::SColor(240,130,130,130);
+ Colors[EGDC_HIGH_LIGHT] = video::SColor(101,8,36,107);
+ Colors[EGDC_HIGH_LIGHT_TEXT] = video::SColor(240,255,255,255);
+ Colors[EGDC_INACTIVE_BORDER] = video::SColor(101,165,165,165);
+ Colors[EGDC_INACTIVE_CAPTION] = video::SColor(255,30,30,30);
+ Colors[EGDC_TOOLTIP] = video::SColor(200,0,0,0);
+ Colors[EGDC_TOOLTIP_BACKGROUND] = video::SColor(200,255,255,225);
+ Colors[EGDC_SCROLLBAR] = video::SColor(101,230,230,230);
+ Colors[EGDC_WINDOW] = video::SColor(101,255,255,255);
+ Colors[EGDC_WINDOW_SYMBOL] = video::SColor(200,10,10,10);
+ Colors[EGDC_ICON] = video::SColor(200,255,255,255);
+ Colors[EGDC_ICON_HIGH_LIGHT] = video::SColor(200,8,36,107);
+ Colors[EGDC_GRAY_WINDOW_SYMBOL] = video::SColor(240,100,100,100);
+ Colors[EGDC_EDITABLE] = video::SColor(101,255,255,255);
+ Colors[EGDC_GRAY_EDITABLE] = video::SColor(101,200,200,200);
+ Colors[EGDC_FOCUSED_EDITABLE] = video::SColor(101,230,230,255);
+
Sizes[EGDS_SCROLLBAR_SIZE] = 14;
Sizes[EGDS_MENU_HEIGHT] = 30;
@@ -64,28 +70,32 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
else
{
//0x80a6a8af
- Colors[EGDC_3D_DARK_SHADOW] = 0x60767982;
- //Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background
- Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background
- Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight
- Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc;
- Colors[EGDC_3D_LIGHT] = 0x802e313a;
- Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title
- Colors[EGDC_ACTIVE_CAPTION] = 0xffd0d0d0;
- Colors[EGDC_APP_WORKSPACE] = 0xc0646464; // unused
- Colors[EGDC_BUTTON_TEXT] = 0xd0161616;
- Colors[EGDC_GRAY_TEXT] = 0x3c141414;
- Colors[EGDC_HIGH_LIGHT] = 0x6c606060;
- Colors[EGDC_HIGH_LIGHT_TEXT]= 0xd0e0e0e0;
- Colors[EGDC_INACTIVE_BORDER]= 0xf0a5a5a5;
- Colors[EGDC_INACTIVE_CAPTION]= 0xffd2d2d2;
- Colors[EGDC_TOOLTIP] = 0xf00f2033;
- Colors[EGDC_TOOLTIP_BACKGROUND]=0xc0cbd2d9;
- Colors[EGDC_SCROLLBAR] = 0xf0e0e0e0;
- Colors[EGDC_WINDOW] = 0xf0f0f0f0;
- Colors[EGDC_WINDOW_SYMBOL] = 0xd0161616;
- Colors[EGDC_ICON] = 0xd0161616;
- Colors[EGDC_ICON_HIGH_LIGHT]= 0xd0606060;
+ Colors[EGDC_3D_DARK_SHADOW] = 0x60767982;
+ //Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background
+ Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background
+ Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight
+ Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc;
+ Colors[EGDC_3D_LIGHT] = 0x802e313a;
+ Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title
+ Colors[EGDC_ACTIVE_CAPTION] = 0xffd0d0d0;
+ Colors[EGDC_APP_WORKSPACE] = 0xc0646464; // unused
+ Colors[EGDC_BUTTON_TEXT] = 0xd0161616;
+ Colors[EGDC_GRAY_TEXT] = 0x3c141414;
+ Colors[EGDC_HIGH_LIGHT] = 0x6c606060;
+ Colors[EGDC_HIGH_LIGHT_TEXT] = 0xd0e0e0e0;
+ Colors[EGDC_INACTIVE_BORDER] = 0xf0a5a5a5;
+ Colors[EGDC_INACTIVE_CAPTION] = 0xffd2d2d2;
+ Colors[EGDC_TOOLTIP] = 0xf00f2033;
+ Colors[EGDC_TOOLTIP_BACKGROUND] = 0xc0cbd2d9;
+ Colors[EGDC_SCROLLBAR] = 0xf0e0e0e0;
+ Colors[EGDC_WINDOW] = 0xf0f0f0f0;
+ Colors[EGDC_WINDOW_SYMBOL] = 0xd0161616;
+ Colors[EGDC_ICON] = 0xd0161616;
+ Colors[EGDC_ICON_HIGH_LIGHT] = 0xd0606060;
+ Colors[EGDC_GRAY_WINDOW_SYMBOL] = 0x3c101010;
+ Colors[EGDC_EDITABLE] = 0xf0ffffff;
+ Colors[EGDC_GRAY_EDITABLE] = 0xf0cccccc;
+ Colors[EGDC_FOCUSED_EDITABLE] = 0xf0fffff0;
Sizes[EGDS_SCROLLBAR_SIZE] = 14;
Sizes[EGDS_MENU_HEIGHT] = 48;
@@ -909,9 +919,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)
+ bool gray = element && !element->isEnabled();
SpriteBank->draw2DSprite(Icons[icon], position, clip,
- Colors[EGDC_WINDOW_SYMBOL], starttime, currenttime, loop, true);
+ Colors[gray? EGDC_GRAY_WINDOW_SYMBOL : EGDC_WINDOW_SYMBOL], starttime, currenttime, loop, true);
}
diff --git a/source/Irrlicht/CGUISkin.h b/source/Irrlicht/CGUISkin.h
index 7921fa8e..c9c29fdf 100644
--- a/source/Irrlicht/CGUISkin.h
+++ b/source/Irrlicht/CGUISkin.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUISpinBox.cpp b/source/Irrlicht/CGUISpinBox.cpp
index e31506ac..add98fec 100644
--- a/source/Irrlicht/CGUISpinBox.cpp
+++ b/source/Irrlicht/CGUISpinBox.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2009 Michael Zeilfelder
+// Copyright (C) 2006-2011 Michael Zeilfelder
// This file uses the licence of the Irrlicht Engine.
#include "CGUISpinBox.h"
@@ -86,7 +86,7 @@ void CGUISpinBox::refreshSprites()
if (sb)
{
IGUISkin * skin = Environment->getSkin();
- CurrentIconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
+ CurrentIconColor = skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_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);
@@ -246,13 +246,26 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
}
+void CGUISpinBox::draw()
+{
+ if ( !isVisible() )
+ return;
+
+ IGUISkin* skin = Environment->getSkin();
+ if (!skin)
+ return;
+
+ video::SColor iconColor = skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL);
+ if ( iconColor != CurrentIconColor )
+ {
+ refreshSprites();
+ }
+
+ IGUISpinBox::draw();
+}
+
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;
diff --git a/source/Irrlicht/CGUISpinBox.h b/source/Irrlicht/CGUISpinBox.h
index 28840167..50d98ecd 100644
--- a/source/Irrlicht/CGUISpinBox.h
+++ b/source/Irrlicht/CGUISpinBox.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2009 Michael Zeilfelder
+// Copyright (C) 2006-2011 Michael Zeilfelder
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -62,6 +62,9 @@ namespace gui
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);
+ //! Draws the element and its children.
+ virtual void draw();
+
//! Sets the new caption of the element
virtual void setText(const wchar_t* text);
diff --git a/source/Irrlicht/CGUISpriteBank.cpp b/source/Irrlicht/CGUISpriteBank.cpp
index c6f3819c..5db453bb 100644
--- a/source/Irrlicht/CGUISpriteBank.cpp
+++ b/source/Irrlicht/CGUISpriteBank.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUISpriteBank.h b/source/Irrlicht/CGUISpriteBank.h
index a0b4d225..e57c62c5 100644
--- a/source/Irrlicht/CGUISpriteBank.h
+++ b/source/Irrlicht/CGUISpriteBank.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIStaticText.cpp b/source/Irrlicht/CGUIStaticText.cpp
index a5e086f7..56f78bb9 100644
--- a/source/Irrlicht/CGUIStaticText.cpp
+++ b/source/Irrlicht/CGUIStaticText.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -32,6 +32,7 @@ CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border,
#endif
Text = text;
+ RestrainTextInside = true;
if (environment && environment->getSkin())
{
BGColor = environment->getSkin()->getColor(gui::EGDC_3D_FACE);
@@ -101,8 +102,8 @@ void CGUIStaticText::draw()
}
font->draw(Text.c_str(), frameRect,
- OverrideColorEnabled ? OverrideColor : skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
- HAlign == EGUIA_CENTER, VAlign == EGUIA_CENTER, &AbsoluteClippingRect);
+ OverrideColorEnabled ? OverrideColor : skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
+ HAlign == EGUIA_CENTER, VAlign == EGUIA_CENTER, (RestrainTextInside ? &AbsoluteClippingRect : NULL));
}
else
{
@@ -130,8 +131,8 @@ void CGUIStaticText::draw()
}
font->draw(BrokenText[i].c_str(), r,
- OverrideColorEnabled ? OverrideColor : skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
- HAlign == EGUIA_CENTER, false, &AbsoluteClippingRect);
+ OverrideColorEnabled ? OverrideColor : skin->getColor(isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT),
+ HAlign == EGUIA_CENTER, false, (RestrainTextInside ? &AbsoluteClippingRect : NULL));
r.LowerRightCorner.Y += height;
r.UpperLeftCorner.Y += height;
@@ -199,6 +200,18 @@ void CGUIStaticText::setDrawBorder(bool draw)
}
+void CGUIStaticText::setTextRestrainedInside(bool restrainTextInside)
+{
+ RestrainTextInside = restrainTextInside;
+}
+
+
+bool CGUIStaticText::isTextRestrainedInside() const
+{
+ return RestrainTextInside;
+}
+
+
void CGUIStaticText::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical)
{
HAlign = horizontal;
@@ -296,15 +309,15 @@ void CGUIStaticText::breakText()
if (word.size())
{
// here comes the next whitespace, look if
- // we can break the last word to the next line.
- s32 whitelgth = font->getDimension(whitespace.c_str()).Width;
- s32 worldlgth = font->getDimension(word.c_str()).Width;
+ // we must break the last word to the next line.
+ const s32 whitelgth = font->getDimension(whitespace.c_str()).Width;
+ const s32 wordlgth = font->getDimension(word.c_str()).Width;
- if (length + worldlgth + whitelgth > elWidth)
+ if (length && (length + wordlgth + whitelgth > elWidth))
{
// break to next line
- length = worldlgth;
BrokenText.push_back(line);
+ length = wordlgth;
line = word;
}
else
@@ -312,7 +325,7 @@ void CGUIStaticText::breakText()
// add word to line
line += whitespace;
line += word;
- length += whitelgth + worldlgth;
+ length += whitelgth + wordlgth;
}
word = L"";
@@ -430,10 +443,11 @@ void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeRea
out->addBool ("Border", Border);
out->addBool ("OverrideColorEnabled",OverrideColorEnabled);
out->addBool ("OverrideBGColorEnabled",OverrideBGColorEnabled);
- out->addBool ("WordWrap", WordWrap);
+ out->addBool ("WordWrap", WordWrap);
out->addBool ("Background", Background);
+ out->addBool ("RestrainTextInside", RestrainTextInside);
out->addColor ("OverrideColor", OverrideColor);
- out->addColor ("BGColor", BGColor);
+ out->addColor ("BGColor", BGColor);
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
@@ -451,6 +465,7 @@ void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled");
setWordWrap(in->getAttributeAsBool("WordWrap"));
Background = in->getAttributeAsBool("Background");
+ RestrainTextInside = in->getAttributeAsBool("RestrainTextInside");
OverrideColor = in->getAttributeAsColor("OverrideColor");
BGColor = in->getAttributeAsColor("BGColor");
diff --git a/source/Irrlicht/CGUIStaticText.h b/source/Irrlicht/CGUIStaticText.h
index b2cd8ef5..c22eecd9 100644
--- a/source/Irrlicht/CGUIStaticText.h
+++ b/source/Irrlicht/CGUIStaticText.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -61,6 +61,12 @@ namespace gui
//! Checks if an override color is enabled
virtual bool isOverrideColorEnabled() const;
+ //! Set whether the text in this label should be clipped if it goes outside bounds
+ virtual void setTextRestrainedInside(bool restrainedInside);
+
+ //! Checks if the text in this label should be clipped if it goes outside bounds
+ virtual bool isTextRestrainedInside() const;
+
//! Enables or disables word wrap for using the static text as
//! multiline text control.
virtual void setWordWrap(bool enable);
@@ -97,6 +103,7 @@ namespace gui
bool OverrideBGColorEnabled;
bool WordWrap;
bool Background;
+ bool RestrainTextInside;
video::SColor OverrideColor, BGColor;
gui::IGUIFont* OverrideFont;
diff --git a/source/Irrlicht/CGUITabControl.cpp b/source/Irrlicht/CGUITabControl.cpp
index 380cbb61..2544a8f6 100644
--- a/source/Irrlicht/CGUITabControl.cpp
+++ b/source/Irrlicht/CGUITabControl.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -174,7 +174,6 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
setDebugName("CGUITabControl");
#endif
- video::SColor color(255,255,255,255);
IGUISkin* skin = Environment->getSkin();
IGUISpriteBank* sprites = 0;
@@ -183,7 +182,6 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
if (skin)
{
sprites = skin->getSpriteBank();
- color = skin->getColor(EGDC_WINDOW_SYMBOL);
TabHeight = skin->getSize(gui::EGDS_BUTTON_HEIGHT) + 2;
}
@@ -192,8 +190,6 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
if (UpButton)
{
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->setVisible(false);
UpButton->setSubElement(true);
UpButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
@@ -206,8 +202,6 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
if (DownButton)
{
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->setVisible(false);
DownButton->setSubElement(true);
DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
@@ -216,9 +210,9 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
}
setTabVerticalAlignment(EGUIA_UPPERLEFT);
+ refreshSprites();
}
-
//! destructor
CGUITabControl::~CGUITabControl()
{
@@ -235,6 +229,27 @@ CGUITabControl::~CGUITabControl()
DownButton->drop();
}
+void CGUITabControl::refreshSprites()
+{
+ video::SColor color(255,255,255,255);
+ IGUISkin* skin = Environment->getSkin();
+ if (skin)
+ {
+ color = skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL);
+ }
+
+ if (UpButton)
+ {
+ UpButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_LEFT), color);
+ UpButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_LEFT), color);
+ }
+
+ if (DownButton)
+ {
+ DownButton->setSprite(EGBS_BUTTON_UP, skin->getIcon(EGDI_CURSOR_RIGHT), color);
+ DownButton->setSprite(EGBS_BUTTON_DOWN, skin->getIcon(EGDI_CURSOR_RIGHT), color);
+ }
+}
//! Adds a tab
IGUITab* CGUITabControl::addTab(const wchar_t* caption, s32 id)
@@ -243,25 +258,7 @@ IGUITab* CGUITabControl::addTab(const wchar_t* caption, s32 id)
if (!skin)
return 0;
- core::rect r;
- if ( VerticalAlignment == EGUIA_UPPERLEFT )
- {
- r.UpperLeftCorner.X = 1;
- r.UpperLeftCorner.Y = TabHeight;
-
- r.LowerRightCorner.X = AbsoluteRect.getWidth()-1;
- r.LowerRightCorner.Y = AbsoluteRect.getHeight()-1;
- }
- else
- {
- r.UpperLeftCorner.X = 1;
- r.UpperLeftCorner.Y = 1;
-
- r.LowerRightCorner.X = AbsoluteRect.getWidth()-1;
- r.LowerRightCorner.Y = AbsoluteRect.getHeight()-TabHeight;
- }
-
- CGUITab* tab = new CGUITab(Tabs.size(), Environment, this, r, id);
+ CGUITab* tab = new CGUITab(Tabs.size(), Environment, this, calcTabPos(), id);
tab->setText(caption);
tab->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
@@ -339,7 +336,7 @@ IGUITab* CGUITabControl::getTab(s32 idx) const
//! called if an event happened.
bool CGUITabControl::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
@@ -529,6 +526,40 @@ bool CGUITabControl::selectTab(core::position2d p)
}
+core::rect CGUITabControl::calcTabPos()
+{
+ core::rect r;
+ r.UpperLeftCorner.X = 0;
+ r.LowerRightCorner.X = AbsoluteRect.getWidth();
+ if ( Border )
+ {
+ ++r.UpperLeftCorner.X;
+ --r.LowerRightCorner.X;
+ }
+
+ if ( VerticalAlignment == EGUIA_UPPERLEFT )
+ {
+ r.UpperLeftCorner.Y = TabHeight+2;
+ r.LowerRightCorner.Y = AbsoluteRect.getHeight()-1;
+ if ( Border )
+ {
+ --r.LowerRightCorner.Y;
+ }
+ }
+ else
+ {
+ r.UpperLeftCorner.Y = 0;
+ r.LowerRightCorner.Y = AbsoluteRect.getHeight()-(TabHeight+2);
+ if ( Border )
+ {
+ ++r.UpperLeftCorner.Y;
+ }
+ }
+
+ return r;
+}
+
+
//! draws the element and its children
void CGUITabControl::draw()
{
@@ -692,6 +723,7 @@ void CGUITabControl::draw()
UpButton->setEnabled(needLeftScroll);
if ( DownButton )
DownButton->setEnabled(needRightScroll);
+ refreshSprites();
IGUIElement::draw();
}
@@ -770,7 +802,6 @@ void CGUITabControl::recalculateScrollBar()
bringToFront( DownButton );
}
-
//! Set the alignment of the tabs
void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment )
{
@@ -778,6 +809,12 @@ void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment )
recalculateScrollButtonPlacement();
recalculateScrollBar();
+
+ core::rect r(calcTabPos());
+ for ( u32 i=0; isetRelativePosition(r);
+ }
}
void CGUITabControl::recalculateScrollButtonPlacement()
@@ -857,7 +894,7 @@ bool CGUITabControl::setActiveTab(s32 idx)
}
-bool CGUITabControl::setActiveTab(IGUIElement *tab)
+bool CGUITabControl::setActiveTab(IGUITab *tab)
{
for (s32 i=0; i<(s32)Tabs.size(); ++i)
if (Tabs[i] == tab)
diff --git a/source/Irrlicht/CGUITabControl.h b/source/Irrlicht/CGUITabControl.h
index 78c1845f..15be4368 100644
--- a/source/Irrlicht/CGUITabControl.h
+++ b/source/Irrlicht/CGUITabControl.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -107,7 +107,7 @@ namespace gui
virtual bool setActiveTab(s32 idx);
//! Brings a tab to front.
- virtual bool setActiveTab(IGUIElement *tab);
+ virtual bool setActiveTab(IGUITab *tab);
//! Returns which tab is currently active
virtual s32 getActiveTab() const;
@@ -161,9 +161,11 @@ namespace gui
void scrollRight();
bool needScrollControl( s32 startIndex=0, bool withScrollControl=false );
s32 calcTabWidth(s32 pos, IGUIFont* font, const wchar_t* text, bool withScrollControl );
+ core::rect calcTabPos();
void recalculateScrollButtonPlacement();
void recalculateScrollBar();
+ void refreshSprites();
core::array Tabs;
s32 ActiveTab;
diff --git a/source/Irrlicht/CGUITable.cpp b/source/Irrlicht/CGUITable.cpp
index f24da7ca..84fcc9c6 100644
--- a/source/Irrlicht/CGUITable.cpp
+++ b/source/Irrlicht/CGUITable.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -457,7 +457,7 @@ void CGUITable::checkScrollbars()
{
clientClip.LowerRightCorner.Y -= scrollBarSize;
HorizontalScrollBar->setVisible(true);
- HorizontalScrollBar->setMax(TotalItemWidth - clientClip.getWidth());
+ HorizontalScrollBar->setMax(core::max_(0,TotalItemWidth - clientClip.getWidth()));
}
// needs vertical scroll be visible?
@@ -465,7 +465,7 @@ void CGUITable::checkScrollbars()
{
clientClip.LowerRightCorner.X -= scrollBarSize;
VerticalScrollBar->setVisible(true);
- VerticalScrollBar->setMax(TotalItemHeight - clientClip.getHeight());
+ VerticalScrollBar->setMax(core::max_(0,TotalItemHeight - clientClip.getHeight()));
// check horizontal again because we have now smaller clientClip
if ( !HorizontalScrollBar->isVisible() )
@@ -474,7 +474,7 @@ void CGUITable::checkScrollbars()
{
clientClip.LowerRightCorner.Y -= scrollBarSize;
HorizontalScrollBar->setVisible(true);
- HorizontalScrollBar->setMax(TotalItemWidth - clientClip.getWidth());
+ HorizontalScrollBar->setMax(core::max_(0,TotalItemWidth - clientClip.getWidth()));
}
}
}
@@ -535,7 +535,7 @@ void CGUITable::refreshControls()
//! called if an event happened.
bool CGUITable::OnEvent(const SEvent &event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
@@ -567,7 +567,7 @@ bool CGUITable::OnEvent(const SEvent &event)
break;
case EET_MOUSE_INPUT_EVENT:
{
- if ( !IsEnabled )
+ if ( !isEnabled() )
return false;
core::position2d p(event.MouseInput.X, event.MouseInput.Y);
@@ -945,13 +945,13 @@ void CGUITable::draw()
// draw item text
if ((s32)i == Selected)
{
- font->draw(Rows[i].Items[j].BrokenText.c_str(), textRect, skin->getColor(IsEnabled ? EGDC_HIGH_LIGHT_TEXT : EGDC_GRAY_TEXT), false, true, &clientClip);
+ font->draw(Rows[i].Items[j].BrokenText.c_str(), textRect, skin->getColor(isEnabled() ? EGDC_HIGH_LIGHT_TEXT : EGDC_GRAY_TEXT), false, true, &clientClip);
}
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);
+ font->draw(Rows[i].Items[j].BrokenText.c_str(), textRect, isEnabled() ? Rows[i].Items[j].Color : skin->getColor(EGDC_GRAY_TEXT), false, true, &clientClip);
}
pos += Columns[j].Width;
@@ -987,7 +987,7 @@ void CGUITable::draw()
// draw header column text
columnrect.UpperLeftCorner.X += CellWidthPadding;
- font->draw(text, columnrect, skin->getColor( IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), false, true, &tableRect);
+ font->draw(text, columnrect, skin->getColor( isEnabled() ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), false, true, &tableRect);
// draw icon for active column tab
if ( (s32)i == ActiveTab )
diff --git a/source/Irrlicht/CGUITable.h b/source/Irrlicht/CGUITable.h
index c31ebd4c..7e67dcde 100644
--- a/source/Irrlicht/CGUITable.h
+++ b/source/Irrlicht/CGUITable.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUIToolBar.cpp b/source/Irrlicht/CGUIToolBar.cpp
index d2b9a54a..110d60d1 100644
--- a/source/Irrlicht/CGUIToolBar.cpp
+++ b/source/Irrlicht/CGUIToolBar.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -67,7 +67,7 @@ CGUIToolBar::CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, s32
//! called if an event happened.
bool CGUIToolBar::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
if (event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
@@ -128,11 +128,11 @@ IGUIButton* CGUIToolBar::addButton(s32 id, const wchar_t* text,const wchar_t* to
rectangle.LowerRightCorner.X = rectangle.UpperLeftCorner.X + size.Width + 8;
rectangle.LowerRightCorner.Y = rectangle.UpperLeftCorner.Y + size.Height + 6;
}
-
+
if ( text )
{
IGUISkin* skin = Environment->getSkin();
- IGUIFont * font = skin->getFont(EGDF_BUTTON);
+ IGUIFont * font = skin->getFont(EGDF_BUTTON);
if ( font )
{
core::dimension2d dim = font->getDimension(text);
diff --git a/source/Irrlicht/CGUIToolBar.h b/source/Irrlicht/CGUIToolBar.h
index 3f6eaf96..807c21d5 100644
--- a/source/Irrlicht/CGUIToolBar.h
+++ b/source/Irrlicht/CGUIToolBar.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGUITreeView.cpp b/source/Irrlicht/CGUITreeView.cpp
index 121510f4..ef609e81 100644
--- a/source/Irrlicht/CGUITreeView.cpp
+++ b/source/Irrlicht/CGUITreeView.cpp
@@ -460,6 +460,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
!clip );
ScrollBarV->drop();
+ ScrollBarV->setSubElement(true);
ScrollBarV->setPos( 0 );
ScrollBarV->grab();
}
@@ -471,6 +472,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
!clip );
ScrollBarH->drop();
+ ScrollBarH->setSubElement(true);
ScrollBarH->setPos( 0 );
ScrollBarH->grab();
}
@@ -581,107 +583,109 @@ void CGUITreeView::recalculateItemHeight()
}
if ( ScrollBarV )
- ScrollBarV->setMax( TotalItemHeight - AbsoluteRect.getHeight() );
+ ScrollBarV->setMax( core::max_(0,TotalItemHeight - AbsoluteRect.getHeight()) );
if ( ScrollBarH )
- ScrollBarH->setMax( TotalItemWidth - AbsoluteRect.getWidth() );
+ ScrollBarH->setMax( core::max_(0, TotalItemWidth - AbsoluteRect.getWidth()) );
}
//! called if an event happened.
bool CGUITreeView::OnEvent( const SEvent &event )
{
- switch( event.EventType )
+ if ( isEnabled() )
{
- case EET_GUI_EVENT:
- switch( event.GUIEvent.EventType )
+ switch( event.EventType )
{
- case gui::EGET_SCROLL_BAR_CHANGED:
- if( event.GUIEvent.Caller == ScrollBarV || event.GUIEvent.Caller == ScrollBarH )
+ case EET_GUI_EVENT:
+ switch( event.GUIEvent.EventType )
{
- //s32 pos = ( ( gui::IGUIScrollBar* )event.GUIEvent.Caller )->getPos();
- return true;
- }
- break;
- case gui::EGET_ELEMENT_FOCUS_LOST:
- {
- Selecting = false;
- return false;
- }
- break;
- default:
- break;
- }
- break;
- case EET_MOUSE_INPUT_EVENT:
- {
- core::position2d p( event.MouseInput.X, event.MouseInput.Y );
-
- switch( event.MouseInput.Event )
- {
- case EMIE_MOUSE_WHEEL:
- if ( ScrollBarV )
- ScrollBarV->setPos( ScrollBarV->getPos() + (s32)event.MouseInput.Wheel * -10 );
- return true;
- break;
-
- case EMIE_LMOUSE_PRESSED_DOWN:
-
- if (Environment->hasFocus(this) && !AbsoluteClippingRect.isPointInside(p) )
+ case gui::EGET_SCROLL_BAR_CHANGED:
+ if( event.GUIEvent.Caller == ScrollBarV || event.GUIEvent.Caller == ScrollBarH )
{
- Environment->removeFocus(this);
+ //s32 pos = ( ( gui::IGUIScrollBar* )event.GUIEvent.Caller )->getPos();
+ return true;
+ }
+ break;
+ case gui::EGET_ELEMENT_FOCUS_LOST:
+ {
+ Selecting = false;
return false;
}
-
- if( Environment->hasFocus( this ) &&
- ( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
- ( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
- )
- )
- {
- return true;
- }
-
- Selecting = true;
- Environment->setFocus( this );
- return true;
- break;
-
- case EMIE_LMOUSE_LEFT_UP:
- if( Environment->hasFocus( this ) &&
- ( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
- ( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
- )
- )
- {
- return true;
- }
-
- Selecting = false;
- Environment->removeFocus( this );
- mouseAction( event.MouseInput.X, event.MouseInput.Y );
- return true;
- break;
-
- case EMIE_MOUSE_MOVED:
- if( Selecting )
- {
- if( getAbsolutePosition().isPointInside( p ) )
- {
- mouseAction( event.MouseInput.X, event.MouseInput.Y, true );
- return true;
- }
- }
break;
default:
break;
}
- }
- break;
- default:
- break;
- }
+ break;
+ case EET_MOUSE_INPUT_EVENT:
+ {
+ core::position2d p( event.MouseInput.X, event.MouseInput.Y );
+ switch( event.MouseInput.Event )
+ {
+ case EMIE_MOUSE_WHEEL:
+ if ( ScrollBarV )
+ ScrollBarV->setPos( ScrollBarV->getPos() + (s32)event.MouseInput.Wheel * -10 );
+ return true;
+ break;
+
+ case EMIE_LMOUSE_PRESSED_DOWN:
+
+ if (Environment->hasFocus(this) && !AbsoluteClippingRect.isPointInside(p) )
+ {
+ Environment->removeFocus(this);
+ return false;
+ }
+
+ if( Environment->hasFocus( this ) &&
+ ( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
+ ( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
+ )
+ )
+ {
+ return true;
+ }
+
+ Selecting = true;
+ Environment->setFocus( this );
+ return true;
+ break;
+
+ case EMIE_LMOUSE_LEFT_UP:
+ if( Environment->hasFocus( this ) &&
+ ( ( ScrollBarV && ScrollBarV->getAbsolutePosition().isPointInside( p ) && ScrollBarV->OnEvent( event ) ) ||
+ ( ScrollBarH && ScrollBarH->getAbsolutePosition().isPointInside( p ) && ScrollBarH->OnEvent( event ) )
+ )
+ )
+ {
+ return true;
+ }
+
+ Selecting = false;
+ Environment->removeFocus( this );
+ mouseAction( event.MouseInput.X, event.MouseInput.Y );
+ return true;
+ break;
+
+ case EMIE_MOUSE_MOVED:
+ if( Selecting )
+ {
+ if( getAbsolutePosition().isPointInside( p ) )
+ {
+ mouseAction( event.MouseInput.X, event.MouseInput.Y, true );
+ return true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
return Parent ? Parent->OnEvent( event ) : false;
}
@@ -940,6 +944,10 @@ void CGUITreeView::draw()
if( Font )
{
+ EGUI_DEFAULT_COLOR textCol = EGDC_GRAY_TEXT;
+ if ( isEnabled() )
+ textCol = ( node == Selected ) ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT;
+
s32 iconWidth = 0;
for( s32 n = 0; n < 2; ++n )
{
@@ -966,13 +974,13 @@ void CGUITreeView::draw()
&& ( ( ImageLeftOfIcon && n == 1 )
|| ( !ImageLeftOfIcon && n == 0 ) ) )
{
- IconFont->draw( node->getIcon(), textRect, skin->getColor( ( node == Selected ) ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT ), false, true, &clientClip );
+ IconFont->draw( node->getIcon(), textRect, skin->getColor(textCol), false, true, &clientClip );
iconWidth += IconFont->getDimension( node->getIcon() ).Width + 3;
textRect.UpperLeftCorner.X += IconFont->getDimension( node->getIcon() ).Width + 3;
}
}
- Font->draw( node->getText(), textRect, skin->getColor( ( node == Selected ) ? EGDC_HIGH_LIGHT_TEXT : EGDC_BUTTON_TEXT ), false, true, &clientClip );
+ Font->draw( node->getText(), textRect, skin->getColor(textCol), false, true, &clientClip );
textRect.UpperLeftCorner.X -= iconWidth;
}
diff --git a/source/Irrlicht/CGUIWindow.cpp b/source/Irrlicht/CGUIWindow.cpp
index 5391f9c1..af9c273c 100644
--- a/source/Irrlicht/CGUIWindow.cpp
+++ b/source/Irrlicht/CGUIWindow.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -99,7 +99,7 @@ void CGUIWindow::refreshSprites()
if ( !sprites )
return;
- CurrentIconColor = skin->getColor(EGDC_WINDOW_SYMBOL);
+ CurrentIconColor = skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL);
if (sprites)
{
@@ -120,7 +120,7 @@ void CGUIWindow::refreshSprites()
//! called if an event happened.
bool CGUIWindow::OnEvent(const SEvent& event)
{
- if (IsEnabled)
+ if (isEnabled())
{
switch(event.EventType)
@@ -236,7 +236,7 @@ void CGUIWindow::draw()
// update each time because the skin is allowed to change this always.
updateClientRect();
- if ( CurrentIconColor != skin->getColor(EGDC_WINDOW_SYMBOL) )
+ if ( CurrentIconColor != skin->getColor(isEnabled() ? EGDC_WINDOW_SYMBOL : EGDC_GRAY_WINDOW_SYMBOL) )
refreshSprites();
core::rect rect = AbsoluteRect;
diff --git a/source/Irrlicht/CGUIWindow.h b/source/Irrlicht/CGUIWindow.h
index 009a7fd8..e99c7ddf 100644
--- a/source/Irrlicht/CGUIWindow.h
+++ b/source/Irrlicht/CGUIWindow.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGeometryCreator.cpp b/source/Irrlicht/CGeometryCreator.cpp
index 394b2a57..84682bbb 100644
--- a/source/Irrlicht/CGeometryCreator.cpp
+++ b/source/Irrlicht/CGeometryCreator.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CGeometryCreator.h b/source/Irrlicht/CGeometryCreator.h
index fd648414..55e0a2a7 100644
--- a/source/Irrlicht/CGeometryCreator.h
+++ b/source/Irrlicht/CGeometryCreator.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImage.cpp b/source/Irrlicht/CImage.cpp
index ee8845da..4e8b4e4e 100644
--- a/source/Irrlicht/CImage.cpp
+++ b/source/Irrlicht/CImage.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -52,7 +52,10 @@ void CImage::initData()
Pitch = BytesPerPixel * Size.Width;
if (!Data)
+ {
+ DeleteMemory=true;
Data = new u8[Size.Height * Pitch];
+ }
}
diff --git a/source/Irrlicht/CImage.h b/source/Irrlicht/CImage.h
index 7382ec1a..6645a29e 100644
--- a/source/Irrlicht/CImage.h
+++ b/source/Irrlicht/CImage.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -100,7 +100,7 @@ public:
//! copies this surface into another, scaling it to fit, appyling a box filter
virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false);
- //! fills the surface with black or white
+ //! fills the surface with given color
virtual void fill(const SColor &color);
//! draws a rectangle
diff --git a/source/Irrlicht/CImageLoaderBMP.cpp b/source/Irrlicht/CImageLoaderBMP.cpp
index b12cdc05..4a680944 100644
--- a/source/Irrlicht/CImageLoaderBMP.cpp
+++ b/source/Irrlicht/CImageLoaderBMP.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderBMP.h b/source/Irrlicht/CImageLoaderBMP.h
index b1d34835..352472dd 100644
--- a/source/Irrlicht/CImageLoaderBMP.h
+++ b/source/Irrlicht/CImageLoaderBMP.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderDDS.cpp b/source/Irrlicht/CImageLoaderDDS.cpp
index eb0de066..8cd4c429 100644
--- a/source/Irrlicht/CImageLoaderDDS.cpp
+++ b/source/Irrlicht/CImageLoaderDDS.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Thomas Alten
+// Copyright (C) 2002-2011 Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderDDS.h b/source/Irrlicht/CImageLoaderDDS.h
index a24380f9..c085a2ab 100644
--- a/source/Irrlicht/CImageLoaderDDS.h
+++ b/source/Irrlicht/CImageLoaderDDS.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Thomas Alten
+// Copyright (C) 2002-2011 Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderJPG.cpp b/source/Irrlicht/CImageLoaderJPG.cpp
index cddf8a2a..87faacf2 100644
--- a/source/Irrlicht/CImageLoaderJPG.cpp
+++ b/source/Irrlicht/CImageLoaderJPG.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderJPG.h b/source/Irrlicht/CImageLoaderJPG.h
index f15d173e..57140342 100644
--- a/source/Irrlicht/CImageLoaderJPG.h
+++ b/source/Irrlicht/CImageLoaderJPG.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPCX.cpp b/source/Irrlicht/CImageLoaderPCX.cpp
index 1ebf54e6..1285a048 100644
--- a/source/Irrlicht/CImageLoaderPCX.cpp
+++ b/source/Irrlicht/CImageLoaderPCX.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPCX.h b/source/Irrlicht/CImageLoaderPCX.h
index 985e4901..638a25e1 100644
--- a/source/Irrlicht/CImageLoaderPCX.h
+++ b/source/Irrlicht/CImageLoaderPCX.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPNG.cpp b/source/Irrlicht/CImageLoaderPNG.cpp
index acd85b3f..a47483b2 100644
--- a/source/Irrlicht/CImageLoaderPNG.cpp
+++ b/source/Irrlicht/CImageLoaderPNG.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPNG.h b/source/Irrlicht/CImageLoaderPNG.h
index da3c54f8..7797e4da 100644
--- a/source/Irrlicht/CImageLoaderPNG.h
+++ b/source/Irrlicht/CImageLoaderPNG.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPPM.cpp b/source/Irrlicht/CImageLoaderPPM.cpp
index a5d12745..4424e290 100644
--- a/source/Irrlicht/CImageLoaderPPM.cpp
+++ b/source/Irrlicht/CImageLoaderPPM.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPPM.h b/source/Irrlicht/CImageLoaderPPM.h
index 1086be08..26dfefcf 100644
--- a/source/Irrlicht/CImageLoaderPPM.h
+++ b/source/Irrlicht/CImageLoaderPPM.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPSD.cpp b/source/Irrlicht/CImageLoaderPSD.cpp
index feb5680c..d1773a46 100644
--- a/source/Irrlicht/CImageLoaderPSD.cpp
+++ b/source/Irrlicht/CImageLoaderPSD.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderPSD.h b/source/Irrlicht/CImageLoaderPSD.h
index 31ee679b..de1dccd1 100644
--- a/source/Irrlicht/CImageLoaderPSD.h
+++ b/source/Irrlicht/CImageLoaderPSD.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderRGB.cpp b/source/Irrlicht/CImageLoaderRGB.cpp
index 1462c5aa..4ff2f59d 100644
--- a/source/Irrlicht/CImageLoaderRGB.cpp
+++ b/source/Irrlicht/CImageLoaderRGB.cpp
@@ -1,4 +1,4 @@
-//! Copyright (C) 2009 Gary Conway
+//! Copyright (C) 2009-2011 Gary Conway
//! This file is part of the "Irrlicht Engine".
//! For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderRGB.h b/source/Irrlicht/CImageLoaderRGB.h
index aca38d5d..87197cb7 100644
--- a/source/Irrlicht/CImageLoaderRGB.h
+++ b/source/Irrlicht/CImageLoaderRGB.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Gary Conway
+// Copyright (C) 2009-2011 Gary Conway
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderTGA.cpp b/source/Irrlicht/CImageLoaderTGA.cpp
index 3b4304de..8662febe 100644
--- a/source/Irrlicht/CImageLoaderTGA.cpp
+++ b/source/Irrlicht/CImageLoaderTGA.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderTGA.h b/source/Irrlicht/CImageLoaderTGA.h
index 02700a5e..bc65e4c3 100644
--- a/source/Irrlicht/CImageLoaderTGA.h
+++ b/source/Irrlicht/CImageLoaderTGA.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderWAL.cpp b/source/Irrlicht/CImageLoaderWAL.cpp
index 5b03ab51..ba9903a8 100644
--- a/source/Irrlicht/CImageLoaderWAL.cpp
+++ b/source/Irrlicht/CImageLoaderWAL.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2004 Murphy McCauley
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageLoaderWAL.h b/source/Irrlicht/CImageLoaderWAL.h
index 23924325..fd013c23 100644
--- a/source/Irrlicht/CImageLoaderWAL.h
+++ b/source/Irrlicht/CImageLoaderWAL.h
@@ -1,5 +1,5 @@
// Copyright (C) 2004 Murphy McCauley
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
/*
diff --git a/source/Irrlicht/CImageWriterBMP.cpp b/source/Irrlicht/CImageWriterBMP.cpp
index 730809f3..b97c2de5 100644
--- a/source/Irrlicht/CImageWriterBMP.cpp
+++ b/source/Irrlicht/CImageWriterBMP.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterBMP.h b/source/Irrlicht/CImageWriterBMP.h
index 9a5a79fb..2c99b314 100644
--- a/source/Irrlicht/CImageWriterBMP.h
+++ b/source/Irrlicht/CImageWriterBMP.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterJPG.cpp b/source/Irrlicht/CImageWriterJPG.cpp
index 2c94641b..bbf41826 100644
--- a/source/Irrlicht/CImageWriterJPG.cpp
+++ b/source/Irrlicht/CImageWriterJPG.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterJPG.h b/source/Irrlicht/CImageWriterJPG.h
index ec6e2fac..d580f831 100644
--- a/source/Irrlicht/CImageWriterJPG.h
+++ b/source/Irrlicht/CImageWriterJPG.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPCX.cpp b/source/Irrlicht/CImageWriterPCX.cpp
index 57f73139..86622588 100644
--- a/source/Irrlicht/CImageWriterPCX.cpp
+++ b/source/Irrlicht/CImageWriterPCX.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPCX.h b/source/Irrlicht/CImageWriterPCX.h
index 63233210..b129a174 100644
--- a/source/Irrlicht/CImageWriterPCX.h
+++ b/source/Irrlicht/CImageWriterPCX.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPNG.cpp b/source/Irrlicht/CImageWriterPNG.cpp
index 8edaded1..941fb919 100644
--- a/source/Irrlicht/CImageWriterPNG.cpp
+++ b/source/Irrlicht/CImageWriterPNG.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPNG.h b/source/Irrlicht/CImageWriterPNG.h
index a0e9766a..85b6e38c 100644
--- a/source/Irrlicht/CImageWriterPNG.h
+++ b/source/Irrlicht/CImageWriterPNG.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPPM.cpp b/source/Irrlicht/CImageWriterPPM.cpp
index 7aeb57f0..97d299e4 100644
--- a/source/Irrlicht/CImageWriterPPM.cpp
+++ b/source/Irrlicht/CImageWriterPPM.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPPM.h b/source/Irrlicht/CImageWriterPPM.h
index 03b4804e..595ed606 100644
--- a/source/Irrlicht/CImageWriterPPM.h
+++ b/source/Irrlicht/CImageWriterPPM.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPSD.cpp b/source/Irrlicht/CImageWriterPSD.cpp
index 43ecb918..241ae008 100644
--- a/source/Irrlicht/CImageWriterPSD.cpp
+++ b/source/Irrlicht/CImageWriterPSD.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterPSD.h b/source/Irrlicht/CImageWriterPSD.h
index 5943e5fe..f34148a1 100644
--- a/source/Irrlicht/CImageWriterPSD.h
+++ b/source/Irrlicht/CImageWriterPSD.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CImageWriterTGA.cpp b/source/Irrlicht/CImageWriterTGA.cpp
index 4f4cae63..a684ecdc 100644
--- a/source/Irrlicht/CImageWriterTGA.cpp
+++ b/source/Irrlicht/CImageWriterTGA.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -133,7 +133,7 @@ bool CImageWriterTGA::writeImage(io::IWriteFile *file, IImage *image,u32 param)
if (file->write(&imageFooter, sizeof(imageFooter)) < (s32)sizeof(imageFooter))
return false;
- return imageHeader.ImageHeight < y;
+ return imageHeader.ImageHeight <= y;
}
} // namespace video
diff --git a/source/Irrlicht/CImageWriterTGA.h b/source/Irrlicht/CImageWriterTGA.h
index 924c7da9..285e7ceb 100644
--- a/source/Irrlicht/CImageWriterTGA.h
+++ b/source/Irrlicht/CImageWriterTGA.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceConsole.cpp b/source/Irrlicht/CIrrDeviceConsole.cpp
index 81f1192e..b4181954 100644
--- a/source/Irrlicht/CIrrDeviceConsole.cpp
+++ b/source/Irrlicht/CIrrDeviceConsole.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Gaz Davidson
+// Copyright (C) 2009-2011 Gaz Davidson
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceConsole.h b/source/Irrlicht/CIrrDeviceConsole.h
index c7ec31b9..4cb10dea 100644
--- a/source/Irrlicht/CIrrDeviceConsole.h
+++ b/source/Irrlicht/CIrrDeviceConsole.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Gaz Davidson
+// Copyright (C) 2009-2011 Gaz Davidson
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceFB.cpp b/source/Irrlicht/CIrrDeviceFB.cpp
index ea9c57d7..b680be26 100644
--- a/source/Irrlicht/CIrrDeviceFB.cpp
+++ b/source/Irrlicht/CIrrDeviceFB.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceFB.h b/source/Irrlicht/CIrrDeviceFB.h
index c04f6ac6..cd8d5a61 100644
--- a/source/Irrlicht/CIrrDeviceFB.h
+++ b/source/Irrlicht/CIrrDeviceFB.h
@@ -1,5 +1,5 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp
index 66b6125a..885dc450 100644
--- a/source/Irrlicht/CIrrDeviceLinux.cpp
+++ b/source/Irrlicht/CIrrDeviceLinux.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -140,7 +140,11 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
if (StdHints)
XFree(StdHints);
// Disable cursor (it is drop'ed in stub)
- CursorControl->setVisible(false);
+ if (CursorControl)
+ {
+ CursorControl->setVisible(false);
+ static_cast(CursorControl)->clearCursors();
+ }
if (display)
{
#ifdef _IRR_COMPILE_WITH_OPENGL_
@@ -1038,7 +1042,7 @@ bool CIrrDeviceLinux::run()
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;
irrevent.KeyInput.PressedDown = (event.type == KeyPress);
// mbtowc(&irrevent.KeyInput.Char, buf, sizeof(buf));
- irrevent.KeyInput.Char = ((wchar_t*)(buf))[0];
+ irrevent.KeyInput.Char = (reinterpret_cast(buf))[0];
irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0;
irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0;
postEventFromUser(irrevent);
@@ -1960,7 +1964,7 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co
u32 bytesPerPixel = video::IImage::getBitsPerPixelFromFormat(format) / 8;
u32 bytesLeftGap = sourceRect.UpperLeftCorner.X * bytesPerPixel;
u32 bytesRightGap = tex->getPitch() - sourceRect.LowerRightCorner.X * bytesPerPixel;
- const u8* data = (const u8*)tex->lock(true, 0);
+ const u8* data = (const u8*)tex->lock(video::ETLM_READ_ONLY, 0);
data += sourceRect.UpperLeftCorner.Y*tex->getPitch();
for ( s32 y = 0; y < sourceRect.getHeight(); ++y )
{
@@ -2036,7 +2040,7 @@ Cursor CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture * tex, const co
u32 bytesLeftGap = sourceRect.UpperLeftCorner.X * bytesPerPixel;
u32 bytesRightGap = tex->getPitch() - sourceRect.LowerRightCorner.X * bytesPerPixel;
XcursorPixel* target = image->pixels;
- const u8* data = (const u8*)tex->lock(true, 0);
+ const u8* data = (const u8*)tex->lock(ETLM_READ_ONLY, 0);
data += sourceRect.UpperLeftCorner.Y*tex->getPitch();
for ( s32 y = 0; y < sourceRect.getHeight(); ++y )
{
@@ -2113,6 +2117,12 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
}
CIrrDeviceLinux::CCursorControl::~CCursorControl()
+{
+ // Do not clearCursors here as the display is already closed
+ // TODO (cutealien): droping cursorcontrol earlier might work, not sure about reason why that's done in stub currently.
+}
+
+void CIrrDeviceLinux::CCursorControl::clearCursors()
{
for ( u32 i=0; i < Cursors.size(); ++i )
{
@@ -2123,7 +2133,6 @@ CIrrDeviceLinux::CCursorControl::~CCursorControl()
}
}
-
#ifdef _IRR_COMPILE_WITH_X11_
void CIrrDeviceLinux::CCursorControl::initCursors()
{
diff --git a/source/Irrlicht/CIrrDeviceLinux.h b/source/Irrlicht/CIrrDeviceLinux.h
index c6ea3cda..54b57026 100644
--- a/source/Irrlicht/CIrrDeviceLinux.h
+++ b/source/Irrlicht/CIrrDeviceLinux.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -294,6 +294,7 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_X11_
void update();
+ void clearCursors();
#endif
private:
diff --git a/source/Irrlicht/CIrrDeviceSDL.cpp b/source/Irrlicht/CIrrDeviceSDL.cpp
index 8fd70174..45af2e06 100644
--- a/source/Irrlicht/CIrrDeviceSDL.cpp
+++ b/source/Irrlicht/CIrrDeviceSDL.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceSDL.h b/source/Irrlicht/CIrrDeviceSDL.h
index 31b77d14..acffde08 100644
--- a/source/Irrlicht/CIrrDeviceSDL.h
+++ b/source/Irrlicht/CIrrDeviceSDL.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// This device code is based on the original SDL device implementation
diff --git a/source/Irrlicht/CIrrDeviceStub.cpp b/source/Irrlicht/CIrrDeviceStub.cpp
index c7c16eaf..f074ae21 100644
--- a/source/Irrlicht/CIrrDeviceStub.cpp
+++ b/source/Irrlicht/CIrrDeviceStub.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -22,7 +22,7 @@ CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params),
Close(false)
{
- Timer = new CTimer();
+ Timer = new CTimer(params.UsePerformanceTimer);
if (os::Printer::Logger)
{
os::Printer::Logger->grab();
diff --git a/source/Irrlicht/CIrrDeviceStub.h b/source/Irrlicht/CIrrDeviceStub.h
index 862ddaaf..7814ccc6 100644
--- a/source/Irrlicht/CIrrDeviceStub.h
+++ b/source/Irrlicht/CIrrDeviceStub.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceWin32.cpp b/source/Irrlicht/CIrrDeviceWin32.cpp
index 9878ae61..a2dc0231 100644
--- a/source/Irrlicht/CIrrDeviceWin32.cpp
+++ b/source/Irrlicht/CIrrDeviceWin32.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -594,7 +594,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
// CreationParams.WindowSize.Width = realWidth;
// CreationParams.WindowSize.Height = realHeight;
- ShowWindow(HWnd, SW_SHOW);
+ ShowWindow(HWnd, SW_SHOWNORMAL);
UpdateWindow(HWnd);
// fix ugly ATI driver bugs. Thanks to ariaci
@@ -638,8 +638,11 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
EnvMap.push_back(em);
// set this as active window
- SetActiveWindow(HWnd);
- SetForegroundWindow(HWnd);
+ if ( HWnd )
+ {
+ SetActiveWindow(HWnd);
+ SetForegroundWindow(HWnd);
+ }
// get the codepage used for keyboard input
KEYBOARD_INPUT_HKL = GetKeyboardLayout(0);
@@ -1618,7 +1621,7 @@ HCURSOR CIrrDeviceWin32::TextureToCursor(HWND hwnd, irr::video::ITexture * tex,
u32 bytesPerPixel = video::IImage::getBitsPerPixelFromFormat(format) / 8;
u32 bytesLeftGap = sourceRect.UpperLeftCorner.X * bytesPerPixel;
u32 bytesRightGap = tex->getPitch() - sourceRect.LowerRightCorner.X * bytesPerPixel;
- const u8* data = (const u8*)tex->lock(true, 0);
+ const u8* data = (const u8*)tex->lock(video::ETLM_READ_ONLY, 0);
data += sourceRect.UpperLeftCorner.Y*tex->getPitch();
for ( s32 y = 0; y < sourceRect.getHeight(); ++y )
{
diff --git a/source/Irrlicht/CIrrDeviceWin32.h b/source/Irrlicht/CIrrDeviceWin32.h
index 637e0ecb..fc8a9a01 100644
--- a/source/Irrlicht/CIrrDeviceWin32.h
+++ b/source/Irrlicht/CIrrDeviceWin32.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceWinCE.cpp b/source/Irrlicht/CIrrDeviceWinCE.cpp
index 27a5abcd..d74c484c 100644
--- a/source/Irrlicht/CIrrDeviceWinCE.cpp
+++ b/source/Irrlicht/CIrrDeviceWinCE.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrDeviceWinCE.h b/source/Irrlicht/CIrrDeviceWinCE.h
index d4cad915..afbd2ee1 100644
--- a/source/Irrlicht/CIrrDeviceWinCE.h
+++ b/source/Irrlicht/CIrrDeviceWinCE.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrMeshFileLoader.cpp b/source/Irrlicht/CIrrMeshFileLoader.cpp
index db88ccfe..b2ecb2ce 100644
--- a/source/Irrlicht/CIrrMeshFileLoader.cpp
+++ b/source/Irrlicht/CIrrMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrMeshFileLoader.h b/source/Irrlicht/CIrrMeshFileLoader.h
index 82c29f78..675d36f1 100644
--- a/source/Irrlicht/CIrrMeshFileLoader.h
+++ b/source/Irrlicht/CIrrMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrMeshWriter.cpp b/source/Irrlicht/CIrrMeshWriter.cpp
index 06de87f0..e8f2e6f2 100644
--- a/source/Irrlicht/CIrrMeshWriter.cpp
+++ b/source/Irrlicht/CIrrMeshWriter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CIrrMeshWriter.h b/source/Irrlicht/CIrrMeshWriter.h
index 94cf6f36..2de22490 100644
--- a/source/Irrlicht/CIrrMeshWriter.h
+++ b/source/Irrlicht/CIrrMeshWriter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLMTSMeshFileLoader.cpp b/source/Irrlicht/CLMTSMeshFileLoader.cpp
index fe1c3ee1..849573c6 100644
--- a/source/Irrlicht/CLMTSMeshFileLoader.cpp
+++ b/source/Irrlicht/CLMTSMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// This file was written by Jonas Petersen and modified by Nikolaus Gebhardt.
diff --git a/source/Irrlicht/CLMTSMeshFileLoader.h b/source/Irrlicht/CLMTSMeshFileLoader.h
index e2373cc8..4735bbf2 100644
--- a/source/Irrlicht/CLMTSMeshFileLoader.h
+++ b/source/Irrlicht/CLMTSMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CLWOMeshFileLoader.cpp b/source/Irrlicht/CLWOMeshFileLoader.cpp
index 8a8dbe75..9490fae5 100644
--- a/source/Irrlicht/CLWOMeshFileLoader.cpp
+++ b/source/Irrlicht/CLWOMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2009 Nikolaus Gebhardt
+// Copyright (C) 2007-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLWOMeshFileLoader.h b/source/Irrlicht/CLWOMeshFileLoader.h
index 9f8c99bb..835bac22 100644
--- a/source/Irrlicht/CLWOMeshFileLoader.h
+++ b/source/Irrlicht/CLWOMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLightSceneNode.cpp b/source/Irrlicht/CLightSceneNode.cpp
index 8d9c71c0..a2d452ab 100644
--- a/source/Irrlicht/CLightSceneNode.cpp
+++ b/source/Irrlicht/CLightSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLightSceneNode.h b/source/Irrlicht/CLightSceneNode.h
index 1db890a1..d71d77bd 100644
--- a/source/Irrlicht/CLightSceneNode.h
+++ b/source/Irrlicht/CLightSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLimitReadFile.cpp b/source/Irrlicht/CLimitReadFile.cpp
index 7a309c5a..352dd925 100644
--- a/source/Irrlicht/CLimitReadFile.cpp
+++ b/source/Irrlicht/CLimitReadFile.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLimitReadFile.h b/source/Irrlicht/CLimitReadFile.h
index 42f596fc..57cf17f2 100644
--- a/source/Irrlicht/CLimitReadFile.h
+++ b/source/Irrlicht/CLimitReadFile.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLogger.cpp b/source/Irrlicht/CLogger.cpp
index d9f6cfc0..35df6242 100644
--- a/source/Irrlicht/CLogger.cpp
+++ b/source/Irrlicht/CLogger.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CLogger.h b/source/Irrlicht/CLogger.h
index 9dc29604..c94f6e07 100644
--- a/source/Irrlicht/CLogger.h
+++ b/source/Irrlicht/CLogger.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMD2MeshFileLoader.cpp b/source/Irrlicht/CMD2MeshFileLoader.cpp
index cafaeba4..4c4ac396 100644
--- a/source/Irrlicht/CMD2MeshFileLoader.cpp
+++ b/source/Irrlicht/CMD2MeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMD2MeshFileLoader.h b/source/Irrlicht/CMD2MeshFileLoader.h
index da345b82..66723de4 100644
--- a/source/Irrlicht/CMD2MeshFileLoader.h
+++ b/source/Irrlicht/CMD2MeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMD3MeshFileLoader.cpp b/source/Irrlicht/CMD3MeshFileLoader.cpp
index 959baab0..97549ee9 100644
--- a/source/Irrlicht/CMD3MeshFileLoader.cpp
+++ b/source/Irrlicht/CMD3MeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMD3MeshFileLoader.h b/source/Irrlicht/CMD3MeshFileLoader.h
index fe96c03e..b0b077cd 100644
--- a/source/Irrlicht/CMD3MeshFileLoader.h
+++ b/source/Irrlicht/CMD3MeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMS3DMeshFileLoader.cpp b/source/Irrlicht/CMS3DMeshFileLoader.cpp
index 8b68a1c0..82301b40 100644
--- a/source/Irrlicht/CMS3DMeshFileLoader.cpp
+++ b/source/Irrlicht/CMS3DMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -327,7 +327,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
}
}
- // skip materials
+ // load materials
u16 numMaterials = *(u16*)pPtr;
#ifdef __BIG_ENDIAN__
numMaterials = os::Byteswap::byteswap(numMaterials);
@@ -337,9 +337,6 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
#endif
pPtr += sizeof(u16);
- // MS3DMaterial *materials = (MS3DMaterial*)pPtr;
- // pPtr += sizeof(MS3DMaterial) * numMaterials;
-
if(numMaterials == 0)
{
// if there are no materials, add at least one buffer
@@ -383,16 +380,15 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (TexturePath.trim()!="")
{
TexturePath=stripPathFromString(file->getFileName(),true) + stripPathFromString(TexturePath,false);
- tmpBuffer->Material.setTexture(0, Driver->getTexture(TexturePath) );
+ tmpBuffer->Material.setTexture(0, Driver->getTexture(TexturePath));
}
core::stringc AlphamapPath=(const c8*)material->Alphamap;
if (AlphamapPath.trim()!="")
{
AlphamapPath=stripPathFromString(file->getFileName(),true) + stripPathFromString(AlphamapPath,false);
- tmpBuffer->Material.setTexture(2, Driver->getTexture(AlphamapPath) );
+ tmpBuffer->Material.setTexture(2, Driver->getTexture(AlphamapPath));
}
-
}
// animation time
@@ -408,7 +404,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
if (framesPerSecond<1.f)
framesPerSecond=1.f;
-// calculated inside SkinnedMesh
+// ignore, calculated inside SkinnedMesh
// s32 frameCount = *(int*)pPtr;
#ifdef __BIG_ENDIAN__
// frameCount = os::Byteswap::byteswap(frameCount);
@@ -550,7 +546,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
core::array vertexWeights;
f32 weightFactor=0;
- if ((pHeader->Version == 4) && (pPtr < buffer+fileSize))
+ if (jointCount && (pHeader->Version == 4) && (pPtr < buffer+fileSize))
{
s32 subVersion = *(s32*)pPtr; // comment subVersion, always 1
#ifdef __BIG_ENDIAN__
@@ -729,7 +725,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
w->vertex_id = index;
}
}
- else // new weights from 1.8.x
+ else if (jointCount) // new weights from 1.8.x
{
f32 sum = 1.0f;
s32 boneid = vertices[vertidx].BoneID;
diff --git a/source/Irrlicht/CMS3DMeshFileLoader.h b/source/Irrlicht/CMS3DMeshFileLoader.h
index e8643458..4be71188 100644
--- a/source/Irrlicht/CMS3DMeshFileLoader.h
+++ b/source/Irrlicht/CMS3DMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMY3DHelper.h b/source/Irrlicht/CMY3DHelper.h
index dcbb8c63..03b81138 100644
--- a/source/Irrlicht/CMY3DHelper.h
+++ b/source/Irrlicht/CMY3DHelper.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CMY3DMeshFileLoader.cpp b/source/Irrlicht/CMY3DMeshFileLoader.cpp
index e7c98cd6..ca70d371 100644
--- a/source/Irrlicht/CMY3DMeshFileLoader.cpp
+++ b/source/Irrlicht/CMY3DMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CMY3DMeshFileLoader.h b/source/Irrlicht/CMY3DMeshFileLoader.h
index d255b2e6..78145636 100644
--- a/source/Irrlicht/CMY3DMeshFileLoader.h
+++ b/source/Irrlicht/CMY3DMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/CMemoryFile.cpp b/source/Irrlicht/CMemoryFile.cpp
index 0196d301..596fc45d 100644
--- a/source/Irrlicht/CMemoryFile.cpp
+++ b/source/Irrlicht/CMemoryFile.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2008 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMemoryFile.h b/source/Irrlicht/CMemoryFile.h
index 91098ab5..3fc3826a 100644
--- a/source/Irrlicht/CMemoryFile.h
+++ b/source/Irrlicht/CMemoryFile.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2008 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMeshCache.cpp b/source/Irrlicht/CMeshCache.cpp
index b197c366..7e202a4b 100644
--- a/source/Irrlicht/CMeshCache.cpp
+++ b/source/Irrlicht/CMeshCache.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -32,23 +32,6 @@ void CMeshCache::addMesh(const io::path& filename, IAnimatedMesh* mesh)
}
-//! Removes a mesh from the cache.
-void CMeshCache::removeMesh(const IAnimatedMesh* const mesh)
-{
- if ( !mesh )
- return;
- for (u32 i=0; idrop();
- Meshes.erase(i);
- return;
- }
- }
-}
-
-
//! Removes a mesh from the cache.
void CMeshCache::removeMesh(const IMesh* const mesh)
{
@@ -56,7 +39,7 @@ void CMeshCache::removeMesh(const IMesh* const mesh)
return;
for (u32 i=0; igetMesh(0) == mesh)
+ if (Meshes[i].Mesh == mesh || (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh))
{
Meshes[i].Mesh->drop();
Meshes.erase(i);
@@ -74,23 +57,11 @@ u32 CMeshCache::getMeshCount() const
//! Returns current number of the mesh
-s32 CMeshCache::getMeshIndex(const IAnimatedMesh* const mesh) const
-{
- for (u32 i=0; igetMesh(0) == mesh)
+ if (Meshes[i].Mesh == mesh || (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh))
return (s32)i;
}
@@ -116,6 +87,7 @@ IAnimatedMesh* CMeshCache::getMeshByName(const io::path& name)
return (id != -1) ? Meshes[id].Mesh : 0;
}
+
//! Get the name of a loaded mesh, based on its index.
const io::SNamedPath& CMeshCache::getMeshName(u32 index) const
{
@@ -125,20 +97,6 @@ const io::SNamedPath& CMeshCache::getMeshName(u32 index) const
return Meshes[index].NamedPath;
}
-//! Get the name of a loaded mesh, if there is any.
-const io::SNamedPath& CMeshCache::getMeshName(const IAnimatedMesh* const mesh) const
-{
- if(!mesh)
- return emptyNamedPath;
-
- for (u32 i=0; igetMesh(0) == mesh))
+ if (Meshes[i].Mesh == mesh || (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh))
return Meshes[i].NamedPath;
}
@@ -168,28 +124,13 @@ bool CMeshCache::renameMesh(u32 index, const io::path& name)
return true;
}
-//! Renames a loaded mesh.
-bool CMeshCache::renameMesh(const IAnimatedMesh* const mesh, const io::path& name)
-{
- for (u32 i=0; igetMesh(0) == mesh)
+ if (Meshes[i].Mesh == mesh || (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh))
{
Meshes[i].NamedPath.setPath(name);
Meshes.sort();
diff --git a/source/Irrlicht/CMeshCache.h b/source/Irrlicht/CMeshCache.h
index 74161f29..0f02b0c0 100644
--- a/source/Irrlicht/CMeshCache.h
+++ b/source/Irrlicht/CMeshCache.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -32,11 +32,6 @@ namespace scene
\param mesh: Pointer to a mesh which will now be referenced by this name. */
virtual void addMesh(const io::path& filename, IAnimatedMesh* mesh);
- //! Removes a mesh from the cache.
- /** After loading a mesh with getMesh(), the mesh can be removed from the cache
- using this method, freeing a lot of memory. */
- virtual void removeMesh(const IAnimatedMesh* const mesh);
-
//! Removes a mesh from the cache.
/** After loading a mesh with getMesh(), the mesh can be removed from the cache
using this method, freeing a lot of memory. */
@@ -48,9 +43,6 @@ namespace scene
removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */
virtual u32 getMeshCount() const;
- //! Returns current index number of the mesh, and -1 if it is not in the cache.
- virtual s32 getMeshIndex(const IAnimatedMesh* const mesh) const;
-
//! Returns current index number of the mesh, and -1 if it is not in the cache.
virtual s32 getMeshIndex(const IMesh* const mesh) const;
@@ -70,11 +62,6 @@ namespace scene
\return The name if mesh was found and has a name, else the path is empty. */
virtual const io::SNamedPath& getMeshName(u32 index) const;
- //! Get the name of a loaded mesh, if there is any.
- /** \param mesh Pointer to mesh to query.
- \return The name if mesh was found and has a name, else the path is empty. */
- virtual const io::SNamedPath& getMeshName(const IAnimatedMesh* const mesh) const;
-
//! Get the name of a loaded mesh, if there is any.
/** \param mesh Pointer to mesh to query.
\return The name if mesh was found and has a name, else the path is empty. */
@@ -89,15 +76,6 @@ namespace scene
\return True if mesh was renamed. */
virtual bool renameMesh(u32 index, const io::path& name);
- //! Renames a loaded mesh.
- /** Note that renaming meshes might change the ordering of the
- meshes, and so the index of the meshes as returned by
- getMeshIndex() or taken by some methods will change.
- \param mesh Mesh to be renamed.
- \param name New name for the mesh.
- \return True if mesh was renamed. */
- virtual bool renameMesh(const IAnimatedMesh* const mesh, const io::path& name);
-
//! Renames a loaded mesh.
/** Note that renaming meshes might change the ordering of the
meshes, and so the index of the meshes as returned by
diff --git a/source/Irrlicht/CMeshManipulator.cpp b/source/Irrlicht/CMeshManipulator.cpp
index 066dbf4d..0cc81569 100644
--- a/source/Irrlicht/CMeshManipulator.cpp
+++ b/source/Irrlicht/CMeshManipulator.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMeshManipulator.h b/source/Irrlicht/CMeshManipulator.h
index cb75b8c9..2cf9a2e1 100644
--- a/source/Irrlicht/CMeshManipulator.h
+++ b/source/Irrlicht/CMeshManipulator.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CMeshSceneNode.cpp b/source/Irrlicht/CMeshSceneNode.cpp
index 207666a8..403ff47c 100644
--- a/source/Irrlicht/CMeshSceneNode.cpp
+++ b/source/Irrlicht/CMeshSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -33,7 +33,6 @@ CMeshSceneNode::CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* m
}
-
//! destructor
CMeshSceneNode::~CMeshSceneNode()
{
@@ -42,7 +41,6 @@ CMeshSceneNode::~CMeshSceneNode()
}
-
//! frame
void CMeshSceneNode::OnRegisterSceneNode()
{
@@ -110,7 +108,6 @@ void CMeshSceneNode::OnRegisterSceneNode()
}
-
//! renders the node.
void CMeshSceneNode::render()
{
@@ -232,7 +229,7 @@ void CMeshSceneNode::render()
for (u32 g=0; ggetMeshBufferCount(); ++g)
{
- driver->drawMeshBuffer( Mesh->getMeshBuffer(g) );
+ driver->drawMeshBuffer(Mesh->getMeshBuffer(g));
}
}
}
@@ -255,8 +252,8 @@ video::SMaterial& CMeshSceneNode::getMaterial(u32 i)
{
if (Mesh && ReadOnlyMaterials && igetMeshBufferCount())
{
- tmpReadOnlyMaterial = Mesh->getMeshBuffer(i)->getMaterial();
- return tmpReadOnlyMaterial;
+ ReadOnlyMaterial = Mesh->getMeshBuffer(i)->getMaterial();
+ return ReadOnlyMaterial;
}
if (i >= Materials.size())
@@ -266,7 +263,6 @@ video::SMaterial& CMeshSceneNode::getMaterial(u32 i)
}
-
//! returns amount of materials used by this scene node.
u32 CMeshSceneNode::getMaterialCount() const
{
@@ -277,19 +273,18 @@ u32 CMeshSceneNode::getMaterialCount() const
}
-
//! Sets a new mesh
void CMeshSceneNode::setMesh(IMesh* mesh)
{
- if (!mesh)
- return; // won't set null mesh
+ if (mesh)
+ {
+ mesh->grab();
+ if (Mesh)
+ Mesh->drop();
- mesh->grab();
- if (Mesh)
- Mesh->drop();
-
- Mesh = mesh;
- copyMaterials();
+ Mesh = mesh;
+ copyMaterials();
+ }
}
@@ -322,6 +317,7 @@ void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeRea
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
}
+
//! Reads attributes of the scene node.
void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
@@ -341,9 +337,38 @@ void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
setMesh(newMesh);
}
+ // optional attribute to assign the hint to the whole mesh
+ if (in->existsAttribute("HardwareMappingHint") &&
+ in->existsAttribute("HardwareMappingBufferType"))
+ {
+ scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;
+ scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;
+
+ core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");
+ if (smapping.equals_ignore_case("static"))
+ mapping = scene::EHM_STATIC;
+ else if (smapping.equals_ignore_case("dynamic"))
+ mapping = scene::EHM_DYNAMIC;
+ else if (smapping.equals_ignore_case("stream"))
+ mapping = scene::EHM_STREAM;
+
+ core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");
+ if (sbufferType.equals_ignore_case("vertex"))
+ bufferType = scene::EBT_VERTEX;
+ else if (sbufferType.equals_ignore_case("index"))
+ bufferType = scene::EBT_INDEX;
+ else if (sbufferType.equals_ignore_case("vertexindex"))
+ bufferType = scene::EBT_VERTEX_AND_INDEX;
+
+ IMesh* mesh = getMesh();
+ if (mesh)
+ mesh->setHardwareMappingHint(mapping, bufferType);
+ }
+
IMeshSceneNode::deserializeAttributes(in, options);
}
+
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */
@@ -352,6 +377,7 @@ void CMeshSceneNode::setReadOnlyMaterials(bool readonly)
ReadOnlyMaterials = readonly;
}
+
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
bool CMeshSceneNode::isReadOnlyMaterials() const
{
@@ -362,8 +388,10 @@ bool CMeshSceneNode::isReadOnlyMaterials() const
//! Creates a clone of this scene node and its children.
ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{
- if (!newParent) newParent = Parent;
- if (!newManager) newManager = SceneManager;
+ if (!newParent)
+ newParent = Parent;
+ if (!newManager)
+ newManager = SceneManager;
CMeshSceneNode* nb = new CMeshSceneNode(Mesh, newParent,
newManager, ID, RelativeTranslation, RelativeRotation, RelativeScale);
@@ -372,13 +400,12 @@ ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
nb->ReadOnlyMaterials = ReadOnlyMaterials;
nb->Materials = Materials;
- if ( newParent )
+ if (newParent)
nb->drop();
return nb;
}
-
} // end namespace scene
} // end namespace irr
diff --git a/source/Irrlicht/CMeshSceneNode.h b/source/Irrlicht/CMeshSceneNode.h
index f96ecb1a..94439edd 100644
--- a/source/Irrlicht/CMeshSceneNode.h
+++ b/source/Irrlicht/CMeshSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -77,7 +77,7 @@ namespace scene
core::array Materials;
core::aabbox3d Box;
- video::SMaterial tmpReadOnlyMaterial;
+ video::SMaterial ReadOnlyMaterial;
IMesh* Mesh;
diff --git a/source/Irrlicht/CMetaTriangleSelector.cpp b/source/Irrlicht/CMetaTriangleSelector.cpp
index b8c93490..d7fd366e 100644
--- a/source/Irrlicht/CMetaTriangleSelector.cpp
+++ b/source/Irrlicht/CMetaTriangleSelector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -135,7 +135,7 @@ void CMetaTriangleSelector::removeAllTriangleSelectors()
//! Return the scene node associated with a given triangle.
-const ISceneNode* CMetaTriangleSelector::getSceneNodeForTriangle(u32 triangleIndex) const
+ISceneNode* CMetaTriangleSelector::getSceneNodeForTriangle(u32 triangleIndex) const
{
u32 totalTriangles = 0;
diff --git a/source/Irrlicht/CMetaTriangleSelector.h b/source/Irrlicht/CMetaTriangleSelector.h
index 04cb8558..8b6aee32 100644
--- a/source/Irrlicht/CMetaTriangleSelector.h
+++ b/source/Irrlicht/CMetaTriangleSelector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -33,17 +33,17 @@ public:
//! Gets all triangles which lie within a specific bounding box.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
- s32& outTriangleCount, const core::aabbox3d& box,
+ s32& outTriangleCount, const core::aabbox3d& box,
const core::matrix4* transform=0) const;
//! Gets all triangles which have or may have contact with a 3d line.
virtual void getTriangles(core::triangle3df* triangles, s32 arraySize,
- s32& outTriangleCount, const core::line3d& line,
+ s32& outTriangleCount, const core::line3d& line,
const core::matrix4* transform=0) const;
//! Adds a triangle selector to the collection of triangle selectors
//! in this metaTriangleSelector.
- virtual void addTriangleSelector(ITriangleSelector* toAdd);
+ virtual void addTriangleSelector(ITriangleSelector* toAdd);
//! Removes a specific triangle selector which was added before from the collection.
virtual bool removeTriangleSelector(ITriangleSelector* toRemove);
@@ -52,7 +52,7 @@ public:
virtual void removeAllTriangleSelectors();
//! Return the scene node associated with a given triangle.
- virtual const ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const;
+ virtual ISceneNode* getSceneNodeForTriangle(u32 triangleIndex) const;
private:
diff --git a/source/Irrlicht/CMountPointReader.cpp b/source/Irrlicht/CMountPointReader.cpp
index ff9653e7..f85cbe75 100644
--- a/source/Irrlicht/CMountPointReader.cpp
+++ b/source/Irrlicht/CMountPointReader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -27,15 +27,20 @@ CArchiveLoaderMount::CArchiveLoaderMount( io::IFileSystem* fs)
//! returns true if the file maybe is able to be loaded by this class
bool CArchiveLoaderMount::isALoadableFileFormat(const io::path& filename) const
{
- bool ret = false;
io::path fname(filename);
deletePathFromFilename(fname);
if (!fname.size())
+ return true;
+ IFileList* list = FileSystem->createFileList();
+ bool ret = false;
+ if (list)
{
- ret = true;
+ // check if name is found as directory
+ if (list->findFile(filename, true))
+ ret=true;
+ list->drop();
}
-
return ret;
}
@@ -58,11 +63,11 @@ IFileArchive* CArchiveLoaderMount::createArchive(const io::path& filename, bool
EFileSystemType current = FileSystem->setFileListSystem(FILESYSTEM_NATIVE);
- io::path save = FileSystem->getWorkingDirectory();
+ const io::path save = FileSystem->getWorkingDirectory();
io::path fullPath = FileSystem->getAbsolutePath(filename);
FileSystem->flattenFilename(fullPath);
- if ( FileSystem->changeWorkingDirectoryTo ( fullPath ) )
+ if (FileSystem->changeWorkingDirectoryTo(fullPath))
{
archive = new CMountPointReader(FileSystem, fullPath, ignoreCase, ignorePaths);
}
@@ -88,7 +93,7 @@ CMountPointReader::CMountPointReader(IFileSystem * parent, const io::path& basen
if (Path.lastChar() != '/' )
Path.append('/');
- const io::path work = Parent->getWorkingDirectory();
+ const io::path& work = Parent->getWorkingDirectory();
Parent->changeWorkingDirectoryTo(basename);
buildDirectory();
diff --git a/source/Irrlicht/CMountPointReader.h b/source/Irrlicht/CMountPointReader.h
index 044b233f..31cedf5c 100644
--- a/source/Irrlicht/CMountPointReader.h
+++ b/source/Irrlicht/CMountPointReader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CNPKReader.cpp b/source/Irrlicht/CNPKReader.cpp
index 5412b396..ed7bb144 100644
--- a/source/Irrlicht/CNPKReader.cpp
+++ b/source/Irrlicht/CNPKReader.cpp
@@ -1,5 +1,5 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
-// Copyright (C) 2009 Christian Stehno
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
+// Copyright (C) 2009-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// Based on the NPK reader from Irrlicht
diff --git a/source/Irrlicht/CNPKReader.h b/source/Irrlicht/CNPKReader.h
index c7222e04..a35cec23 100644
--- a/source/Irrlicht/CNPKReader.h
+++ b/source/Irrlicht/CNPKReader.h
@@ -1,5 +1,5 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
-// Copyright (C) 2009 Christian Stehno
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
+// Copyright (C) 2009-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CNullDriver.cpp b/source/Irrlicht/CNullDriver.cpp
index 96dd322e..db114043 100644
--- a/source/Irrlicht/CNullDriver.cpp
+++ b/source/Irrlicht/CNullDriver.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -79,7 +79,6 @@ IImageWriter* createImageWriterPNG();
//! creates a writer which is able to save ppm images
IImageWriter* createImageWriterPPM();
-
//! constructor
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d& screenSize)
: FileSystem(io), MeshManipulator(0), ViewPort(0,0,0,0), ScreenSize(screenSize),
@@ -90,6 +89,22 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d& scre
setDebugName("CNullDriver");
#endif
+ DriverAttributes = new io::CAttributes();
+ DriverAttributes->addInt("MaxTextures", _IRR_MATERIAL_MAX_TEXTURES_);
+ DriverAttributes->addInt("MaxSupportedTextures", _IRR_MATERIAL_MAX_TEXTURES_);
+ DriverAttributes->addInt("MaxLights", getMaximalDynamicLightAmount());
+ DriverAttributes->addInt("MaxAnisotropy", 1);
+// DriverAttributes->addInt("MaxUserClipPlanes", 0);
+// DriverAttributes->addInt("MaxAuxBuffers", 0);
+ DriverAttributes->addInt("MaxMultipleRenderTargets", 1);
+ DriverAttributes->addInt("MaxIndices", -1);
+ DriverAttributes->addInt("MaxTextureSize", -1);
+// DriverAttributes->addInt("MaxGeometryVerticesOut", 0);
+// DriverAttributes->addFloat("MaxTextureLODBias", 0.f);
+ DriverAttributes->addInt("Version", 1);
+// DriverAttributes->addInt("ShaderLanguageVersion", 0);
+// DriverAttributes->addInt("AntiAlias", 0);
+
setFog();
setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true);
@@ -175,6 +190,7 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d& scre
InitMaterial2D.Lighting=false;
InitMaterial2D.ZWriteEnable=false;
InitMaterial2D.ZBuffer=video::ECFN_NEVER;
+ InitMaterial2D.UseMipMaps=false;
for (u32 i=0; i& scre
//! destructor
CNullDriver::~CNullDriver()
{
+ if (DriverAttributes)
+ DriverAttributes->drop();
+
if (FileSystem)
FileSystem->drop();
@@ -313,6 +332,13 @@ bool CNullDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
}
+//! Get attributes of the actual video driver
+const io::IAttributes& CNullDriver::getDriverAttributes() const
+{
+ return *DriverAttributes;
+}
+
+
//! sets transformation
void CNullDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat)
{
@@ -408,7 +434,7 @@ ITexture* CNullDriver::getTexture(const io::path& filename)
// Now try to open the file using the complete path.
io::IReadFile* file = FileSystem->createAndOpenFile(absolutePath);
- if(!file)
+ if (!file)
{
// Try to open it using the raw filename.
file = FileSystem->createAndOpenFile(filename);
@@ -463,10 +489,10 @@ ITexture* CNullDriver::getTexture(io::IReadFile* file)
addTexture(texture);
texture->drop(); // drop it because we created it, one grab too much
}
- }
- if (!texture)
- os::Printer::log("Could not load texture", file->getFileName(), ELL_WARNING);
+ if (!texture)
+ os::Printer::log("Could not load texture", file->getFileName(), ELL_WARNING);
+ }
return texture;
}
@@ -1060,7 +1086,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
if (texture->getColorFormat() == ECF_A1R5G5B5)
{
- u16 *p = (u16*)texture->lock(true);
+ u16 *p = (u16*)texture->lock(ETLM_READ_ONLY);
if (!p)
{
@@ -1076,7 +1102,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
}
else
{
- u32 *p = (u32*)texture->lock(true);
+ u32 *p = (u32*)texture->lock(ETLM_READ_ONLY);
if (!p)
{
@@ -1414,9 +1440,9 @@ IImage* CNullDriver::createImage(IImage* imageToCopy, const core::position2d& pos, const core::dimension2d& size)
{
- if (pos==core::position2di(0,0) && size == texture->getSize())
+ if ((pos==core::position2di(0,0)) && (size == texture->getSize()))
{
- IImage* image = new CImage(texture->getColorFormat(), size, texture->lock(true), false);
+ IImage* image = new CImage(texture->getColorFormat(), size, texture->lock(ETLM_READ_ONLY), false);
texture->unlock();
return image;
}
@@ -1431,14 +1457,17 @@ IImage* CNullDriver::createImage(ITexture* texture, const core::position2d&
core::clamp(static_cast(size.Height), 0u, texture->getSize().Height)));
if (!clamped.isValid())
return 0;
- void* src = texture->lock(true);
+ u8* src = static_cast(texture->lock(ETLM_READ_ONLY));
if (!src)
return 0;
IImage* image = new CImage(texture->getColorFormat(), clamped.getSize());
- void* dst = image->lock();
- for (u32 i=clamped.UpperLeftCorner.X; i(image->lock());
+ src += clamped.UpperLeftCorner.Y * texture->getPitch() + image->getBytesPerPixel() * clamped.UpperLeftCorner.X;
+ for (u32 i=0; igetColorFormat(), clamped.getWidth(), dst, image->getColorFormat());
+ src += texture->getPitch();
+ dst += image->getPitch();
}
image->unlock();
texture->unlock();
@@ -1789,6 +1818,7 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
attr->addBool("FrontfaceCulling", material.FrontfaceCulling);
attr->addBool("FogEnable", material.FogEnable);
attr->addBool("NormalizeNormals", material.NormalizeNormals);
+ attr->addBool("UseMipMaps", material.UseMipMaps);
attr->addInt("AntiAliasing", material.AntiAliasing);
attr->addInt("ColorMask", material.ColorMask);
@@ -1853,6 +1883,11 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
outMaterial.FrontfaceCulling = attr->getAttributeAsBool("FrontfaceCulling");
outMaterial.FogEnable = attr->getAttributeAsBool("FogEnable");
outMaterial.NormalizeNormals = attr->getAttributeAsBool("NormalizeNormals");
+ if (attr->existsAttribute("UseMipMaps")) // legacy
+ outMaterial.UseMipMaps = attr->getAttributeAsBool("UseMipMaps");
+ else
+ outMaterial.UseMipMaps = true;
+
// default 0 is ok
outMaterial.AntiAliasing = attr->getAttributeAsInt("AntiAliasing");
if (attr->existsAttribute("ColorMask"))
diff --git a/source/Irrlicht/CNullDriver.h b/source/Irrlicht/CNullDriver.h
index 1ed66de5..add1e820 100644
--- a/source/Irrlicht/CNullDriver.h
+++ b/source/Irrlicht/CNullDriver.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -57,6 +57,9 @@ namespace video
//! queries the features of the driver, returns true if feature is available
virtual bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const;
+ //! Get attributes of the actual video driver
+ const io::IAttributes& getDriverAttributes() const;
+
//! sets transformation
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat);
@@ -717,7 +720,7 @@ namespace video
{
SDummyTexture(const io::path& name) : ITexture(name), size(0,0) {};
- virtual void* lock(bool readOnly = false, u32 mipmapLevel=0) { return 0; };
+ virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) { return 0; };
virtual void unlock(){}
virtual const core::dimension2d& getOriginalSize() const { return size; }
virtual const core::dimension2d& getSize() const { return size; }
@@ -816,6 +819,8 @@ namespace video
SColor FogColor;
SExposedVideoData ExposedData;
+ io::IAttributes* DriverAttributes;
+
SOverrideMaterial OverrideMaterial;
SMaterial OverrideMaterial2D;
SMaterial InitMaterial2D;
diff --git a/source/Irrlicht/COBJMeshFileLoader.cpp b/source/Irrlicht/COBJMeshFileLoader.cpp
index b40d40dc..e1b3353d 100644
--- a/source/Irrlicht/COBJMeshFileLoader.cpp
+++ b/source/Irrlicht/COBJMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COBJMeshFileLoader.h b/source/Irrlicht/COBJMeshFileLoader.h
index 56ba0024..790e6b37 100644
--- a/source/Irrlicht/COBJMeshFileLoader.h
+++ b/source/Irrlicht/COBJMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COBJMeshWriter.cpp b/source/Irrlicht/COBJMeshWriter.cpp
index 607c3d3b..8f445854 100644
--- a/source/Irrlicht/COBJMeshWriter.cpp
+++ b/source/Irrlicht/COBJMeshWriter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2009 Christian Stehno
+// Copyright (C) 2008-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COBJMeshWriter.h b/source/Irrlicht/COBJMeshWriter.h
index e4bf5870..e04300cc 100644
--- a/source/Irrlicht/COBJMeshWriter.h
+++ b/source/Irrlicht/COBJMeshWriter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2009 Christian Stehno
+// Copyright (C) 2008-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COCTLoader.cpp b/source/Irrlicht/COCTLoader.cpp
index 149adf78..ca5a8bbd 100644
--- a/source/Irrlicht/COCTLoader.cpp
+++ b/source/Irrlicht/COCTLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/COCTLoader.h b/source/Irrlicht/COCTLoader.h
index 5620e7df..a7b8d7d2 100644
--- a/source/Irrlicht/COCTLoader.h
+++ b/source/Irrlicht/COCTLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
//
diff --git a/source/Irrlicht/COSOperator.cpp b/source/Irrlicht/COSOperator.cpp
index 33ea328f..8351e5dc 100644
--- a/source/Irrlicht/COSOperator.cpp
+++ b/source/Irrlicht/COSOperator.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COSOperator.h b/source/Irrlicht/COSOperator.h
index e8201275..ec039d70 100644
--- a/source/Irrlicht/COSOperator.h
+++ b/source/Irrlicht/COSOperator.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COctreeSceneNode.cpp b/source/Irrlicht/COctreeSceneNode.cpp
index fbf4cfd3..940c16ae 100644
--- a/source/Irrlicht/COctreeSceneNode.cpp
+++ b/source/Irrlicht/COctreeSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COctreeSceneNode.h b/source/Irrlicht/COctreeSceneNode.h
index 8b64d2a1..a1ad5cf8 100644
--- a/source/Irrlicht/COctreeSceneNode.h
+++ b/source/Irrlicht/COctreeSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COctreeTriangleSelector.cpp b/source/Irrlicht/COctreeTriangleSelector.cpp
index fcc0c0bd..aedc1a66 100644
--- a/source/Irrlicht/COctreeTriangleSelector.cpp
+++ b/source/Irrlicht/COctreeTriangleSelector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -14,7 +14,7 @@ namespace scene
//! constructor
COctreeTriangleSelector::COctreeTriangleSelector(const IMesh* mesh,
- const ISceneNode* node, s32 minimalPolysPerNode)
+ ISceneNode* node, s32 minimalPolysPerNode)
: CTriangleSelector(mesh, node), Root(0), NodeCount(0),
MinimalPolysPerNode(minimalPolysPerNode)
{
diff --git a/source/Irrlicht/COctreeTriangleSelector.h b/source/Irrlicht/COctreeTriangleSelector.h
index ae03fd90..aa7719c9 100644
--- a/source/Irrlicht/COctreeTriangleSelector.h
+++ b/source/Irrlicht/COctreeTriangleSelector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -20,7 +20,7 @@ class COctreeTriangleSelector : public CTriangleSelector
public:
//! Constructs a selector based on a mesh
- COctreeTriangleSelector(const IMesh* mesh, const ISceneNode* node, s32 minimalPolysPerNode);
+ COctreeTriangleSelector(const IMesh* mesh, ISceneNode* node, s32 minimalPolysPerNode);
virtual ~COctreeTriangleSelector();
diff --git a/source/Irrlicht/COgreMeshFileLoader.cpp b/source/Irrlicht/COgreMeshFileLoader.cpp
index b9cf7162..3a96a30a 100644
--- a/source/Irrlicht/COgreMeshFileLoader.cpp
+++ b/source/Irrlicht/COgreMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// orginally written by Christian Stehno, modified by Nikolaus Gebhardt
@@ -200,7 +200,7 @@ bool COgreMeshFileLoader::readChunk(io::IReadFile* file)
bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent, OgreMesh& mesh)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Object Chunk");
+ os::Printer::log("Read Object Chunk", ELL_DEBUG);
#endif
readBool(file, parent, mesh.SkeletalAnimation);
bool skeleton_loaded=false;
@@ -221,7 +221,7 @@ bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent
case COGRE_MESH_BOUNDS:
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Mesh Bounds");
+ os::Printer::log("Read Mesh Bounds", ELL_DEBUG);
#endif
readVector(file, data, mesh.BBoxMinEdge);
readVector(file, data, mesh.BBoxMaxEdge);
@@ -231,7 +231,7 @@ bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent
case COGRE_SKELETON_LINK:
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Skeleton link");
+ os::Printer::log("Read Skeleton link", ELL_DEBUG);
#endif
core::stringc name;
readString(file, data, name);
@@ -256,7 +256,7 @@ bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent
break;
default:
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Skipping", core::stringc(data.header.id));
+ os::Printer::log("Skipping", core::stringc(data.header.id), ELL_DEBUG);
#endif
// ignore chunk
file->seek(data.header.length-data.read, true);
@@ -274,7 +274,7 @@ bool COgreMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData& parent
bool COgreMeshFileLoader::readGeometry(io::IReadFile* file, ChunkData& parent, OgreGeometry& geometry)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Geometry");
+ os::Printer::log("Read Geometry", ELL_DEBUG);
#endif
readInt(file, parent, &geometry.NumVertex);
while(parent.read < parent.header.length)
@@ -293,13 +293,15 @@ bool COgreMeshFileLoader::readGeometry(io::IReadFile* file, ChunkData& parent, O
default:
// ignore chunk
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Skipping", core::stringc(data.header.id));
+ os::Printer::log("Skipping", core::stringc(data.header.id), ELL_DEBUG);
#endif
file->seek(data.header.length-data.read, true);
data.read += data.header.length-data.read;
}
parent.read += data.read;
}
+ if (parent.read != parent.header.length)
+ os::Printer::log("Incorrect geometry length. File might be corrupted.");
return true;
}
@@ -307,7 +309,7 @@ bool COgreMeshFileLoader::readGeometry(io::IReadFile* file, ChunkData& parent, O
bool COgreMeshFileLoader::readVertexDeclaration(io::IReadFile* file, ChunkData& parent, OgreGeometry& geometry)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Vertex Declaration");
+ os::Printer::log("Read Vertex Declaration", ELL_DEBUG);
#endif
NumUV = 0;
while(parent.read < parent.header.length)
@@ -340,6 +342,8 @@ bool COgreMeshFileLoader::readVertexDeclaration(io::IReadFile* file, ChunkData&
}
parent.read += data.read;
}
+ if (parent.read != parent.header.length)
+ os::Printer::log("Incorrect vertex declaration length. File might be corrupted.");
return true;
}
@@ -347,7 +351,7 @@ bool COgreMeshFileLoader::readVertexDeclaration(io::IReadFile* file, ChunkData&
bool COgreMeshFileLoader::readVertexBuffer(io::IReadFile* file, ChunkData& parent, OgreGeometry& geometry)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Vertex Buffer");
+ os::Printer::log("Read Vertex Buffer", ELL_DEBUG);
#endif
OgreVertexBuffer buf;
readShort(file, parent, &buf.BindIndex);
@@ -364,6 +368,8 @@ bool COgreMeshFileLoader::readVertexBuffer(io::IReadFile* file, ChunkData& paren
geometry.Buffers.push_back(buf);
parent.read += data.read;
+ if (parent.read != parent.header.length)
+ os::Printer::log("Incorrect vertex buffer length. File might be corrupted.");
return true;
}
@@ -371,11 +377,11 @@ bool COgreMeshFileLoader::readVertexBuffer(io::IReadFile* file, ChunkData& paren
bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, OgreSubMesh& subMesh)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Submesh");
+ os::Printer::log("Read Submesh", ELL_DEBUG);
#endif
readString(file, parent, subMesh.Material);
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("using material", subMesh.Material);
+ os::Printer::log("using material", subMesh.Material, ELL_DEBUG);
#endif
readBool(file, parent, subMesh.SharedVertices);
@@ -410,7 +416,7 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
case COGRE_SUBMESH_OPERATION:
readShort(file, data, &subMesh.Operation);
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Submesh Operation",core::stringc(subMesh.Operation));
+ os::Printer::log("Read Submesh Operation",core::stringc(subMesh.Operation), ELL_DEBUG);
#endif
if (subMesh.Operation != 4)
os::Printer::log("Primitive type != trilist not yet implemented", ELL_WARNING);
@@ -418,7 +424,7 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
case COGRE_SUBMESH_TEXTURE_ALIAS:
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Submesh Texture Alias");
+ os::Printer::log("Read Submesh Texture Alias", ELL_DEBUG);
#endif
core::stringc texture, alias;
readString(file, data, texture);
@@ -436,7 +442,7 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
break;
default:
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Skipping", core::stringc(data.header.id));
+ os::Printer::log("Skipping", core::stringc(data.header.id), ELL_DEBUG);
#endif
parent.read=parent.header.length;
file->seek(-(long)sizeof(ChunkHeader), true);
@@ -444,6 +450,11 @@ bool COgreMeshFileLoader::readSubMesh(io::IReadFile* file, ChunkData& parent, Og
}
parent.read += data.read;
}
+ if (parent.read != parent.header.length)
+ os::Printer::log("Incorrect submesh length. File might be corrupted.");
+#ifdef IRR_OGRE_LOADER_DEBUG
+ os::Printer::log("Done with submesh", ELL_DEBUG);
+#endif
return true;
}
@@ -1071,7 +1082,7 @@ void COgreMeshFileLoader::readPass(io::IReadFile* file, OgreTechnique& technique
else if (token=="texture_unit")
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Texture unit");
+ os::Printer::log("Read Texture unit", ELL_DEBUG);
#endif
getMaterialToken(file, token); //open brace
getMaterialToken(file, token);
@@ -1081,7 +1092,7 @@ void COgreMeshFileLoader::readPass(io::IReadFile* file, OgreTechnique& technique
{
getMaterialToken(file, pass.Texture.Filename);
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Read Texture", pass.Texture.Filename.c_str());
+ os::Printer::log("Read Texture", pass.Texture.Filename.c_str(), ELL_DEBUG);
#endif
getMaterialToken(file, pass.Texture.CoordsType, true);
getMaterialToken(file, pass.Texture.MipMaps, true);
@@ -1217,7 +1228,7 @@ void COgreMeshFileLoader::readTechnique(io::IReadFile* file, OgreMaterial& mat)
void COgreMeshFileLoader::loadMaterials(io::IReadFile* meshFile)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Load Materials");
+ os::Printer::log("Load Materials", ELL_DEBUG);
#endif
core::stringc token;
io::IReadFile* file = 0;
@@ -1268,7 +1279,7 @@ void COgreMeshFileLoader::loadMaterials(io::IReadFile* meshFile)
getMaterialToken(file, mat.Name);
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Load Material", mat.Name.c_str());
+ os::Printer::log("Load Material", mat.Name.c_str(), ELL_DEBUG);
#endif
getMaterialToken(file, token); //open brace
getMaterialToken(file, token);
@@ -1300,7 +1311,7 @@ void COgreMeshFileLoader::loadMaterials(io::IReadFile* meshFile)
file->drop();
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Finished loading Materials");
+ os::Printer::log("Finished loading Materials", ELL_DEBUG);
#endif
}
@@ -1308,7 +1319,7 @@ void COgreMeshFileLoader::loadMaterials(io::IReadFile* meshFile)
bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stringc& name)
{
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Load Skeleton", name);
+ os::Printer::log("Load Skeleton", name, ELL_DEBUG);
#endif
io::IReadFile* file = 0;
io::path filename;
@@ -1363,9 +1374,9 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri
readVector(file, data, bone.Position);
readQuaternion(file, data, bone.Orientation);
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Bone", bone.Name+" ("+core::stringc(bone.Handle)+")");
- os::Printer::log("Position", core::stringc(bone.Position.X)+" "+core::stringc(bone.Position.Y)+" "+core::stringc(bone.Position.Z));
- os::Printer::log("Rotation quat", core::stringc(bone.Orientation.W)+" "+core::stringc(bone.Orientation.X)+" "+core::stringc(bone.Orientation.Y)+" "+core::stringc(bone.Orientation.Z));
+ os::Printer::log("Bone", bone.Name+" ("+core::stringc(bone.Handle)+")", ELL_DEBUG);
+ os::Printer::log("Position", core::stringc(bone.Position.X)+" "+core::stringc(bone.Position.Y)+" "+core::stringc(bone.Position.Z), ELL_DEBUG);
+ os::Printer::log("Rotation quat", core::stringc(bone.Orientation.W)+" "+core::stringc(bone.Orientation.X)+" "+core::stringc(bone.Orientation.Y)+" "+core::stringc(bone.Orientation.Z), ELL_DEBUG);
// core::vector3df rot;
// bone.Orientation.toEuler(rot);
// rot *= core::RADTODEG;
@@ -1399,14 +1410,14 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri
readString(file, data, anim.Name);
readFloat(file, data, &anim.Length);
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Animation", anim.Name);
- os::Printer::log("Length", core::stringc(anim.Length));
+ os::Printer::log("Animation", anim.Name, ELL_DEBUG);
+ os::Printer::log("Length", core::stringc(anim.Length), ELL_DEBUG);
#endif
}
break;
case COGRE_ANIMATION_TRACK:
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("for Bone ", core::stringc(bone));
+ os::Printer::log("for Bone ", core::stringc(bone), ELL_DEBUG);
#endif
readShort(file, data, &bone); // store current bone
break;
@@ -1430,7 +1441,7 @@ bool COgreMeshFileLoader::loadSkeleton(io::IReadFile* meshFile, const core::stri
break;
case COGRE_ANIMATION_LINK:
#ifdef IRR_OGRE_LOADER_DEBUG
- os::Printer::log("Animation link");
+ os::Printer::log("Animation link", ELL_DEBUG);
#endif
break;
default:
diff --git a/source/Irrlicht/COgreMeshFileLoader.h b/source/Irrlicht/COgreMeshFileLoader.h
index 95394873..127582a0 100644
--- a/source/Irrlicht/COgreMeshFileLoader.h
+++ b/source/Irrlicht/COgreMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// orginally written by Christian Stehno, modified by Nikolaus Gebhardt
diff --git a/source/Irrlicht/COpenGLDriver.cpp b/source/Irrlicht/COpenGLDriver.cpp
index 8be9def4..3ff3748a 100644
--- a/source/Irrlicht/COpenGLDriver.cpp
+++ b/source/Irrlicht/COpenGLDriver.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -158,7 +158,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
GLuint PixelFormat;
- for (u32 i=0; i<5; ++i)
+ for (u32 i=0; i<6; ++i)
{
if (i == 1)
{
@@ -235,8 +235,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
return false;
}
-#ifdef _DEBUG
- core::stringc wglExtensions;
+ io::path wglExtensions;
#ifdef WGL_ARB_extensions_string
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
if (irrGetExtensionsString)
@@ -246,12 +245,16 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
if (irrGetExtensionsString)
wglExtensions = irrGetExtensionsString(HDc);
#endif
+ const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
+ const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
+ (wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
+#ifdef _DEBUG
os::Printer::log("WGL_extensions", wglExtensions);
#endif
#ifdef WGL_ARB_pixel_format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
- if (wglChoosePixelFormat_ARB)
+ if (pixel_format_supported && multi_sample_supported && wglChoosePixelFormat_ARB)
{
// This value determines the number of samples used for antialiasing
// My experience is that 8 does not show a big
@@ -649,6 +652,20 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d& screenSize,
}
else
os::Printer::log("GLSL not available.", ELL_INFORMATION);
+ DriverAttributes->setAttribute("MaxTextures", MaxTextureUnits);
+ DriverAttributes->setAttribute("MaxSupportedTextures", MaxSupportedTextures);
+// DriverAttributes->setAttribute("MaxLights", MaxLights);
+ DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
+ DriverAttributes->setAttribute("MaxUserClipPlanes", MaxUserClipPlanes);
+ DriverAttributes->setAttribute("MaxAuxBuffers", MaxAuxBuffers);
+ DriverAttributes->setAttribute("MaxMultipleRenderTargets", MaxMultipleRenderTargets);
+ DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
+ DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
+ DriverAttributes->setAttribute("MaxGeometryVerticesOut", (s32)MaxGeometryVerticesOut);
+ DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias);
+ DriverAttributes->setAttribute("Version", Version);
+ DriverAttributes->setAttribute("ShaderLanguageVersion", ShaderLanguageVersion);
+ DriverAttributes->setAttribute("AntiAlias", AntiAlias);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -822,7 +839,8 @@ void COpenGLDriver::clearBuffers(bool backBuffer, bool zBuffer, bool stencilBuff
if (stencilBuffer)
mask |= GL_STENCIL_BUFFER_BIT;
- glClear(mask);
+ if (mask)
+ glClear(mask);
}
@@ -877,42 +895,41 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri
break;
case ETS_PROJECTION:
{
- GLfloat glmat[16];
- createGLMatrix(glmat, mat);
- // flip z to compensate OpenGLs right-hand coordinate system
- glmat[12] *= -1.0f;
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(glmat);
+ glLoadMatrixf(mat.pointer());
+ // we have to update the clip planes to the latest view matrix
+ for (u32 i=0; i= MATERIAL_MAX_TEXTURES)
- break;
-
- const bool isRTT = Material.getTexture(i) && Material.getTexture(i)->isRenderTarget();
-
- if (MultiTextureExtension)
- extGlActiveTexture(GL_TEXTURE0_ARB + i);
-
- glMatrixMode(GL_TEXTURE);
- if (!isRTT && mat.isIdentity() )
- glLoadIdentity();
- else
{
- GLfloat glmat[16];
- if (isRTT)
- createGLTextureMatrix(glmat, mat * TextureFlipMatrix);
- else
- createGLTextureMatrix(glmat, mat);
+ const u32 i = state - ETS_TEXTURE_0;
+ if (i >= MATERIAL_MAX_TEXTURES)
+ break;
- glLoadMatrixf(glmat);
+ const bool isRTT = Material.getTexture(i) && Material.getTexture(i)->isRenderTarget();
+
+ if (MultiTextureExtension)
+ extGlActiveTexture(GL_TEXTURE0_ARB + i);
+
+ glMatrixMode(GL_TEXTURE);
+ if (!isRTT && mat.isIdentity() )
+ glLoadIdentity();
+ else
+ {
+ GLfloat glmat[16];
+ if (isRTT)
+ createGLTextureMatrix(glmat, mat * TextureFlipMatrix);
+ else
+ createGLTextureMatrix(glmat, mat);
+ glLoadMatrixf(glmat);
+ }
+ break;
}
- break;
- }
}
}
@@ -1819,8 +1836,6 @@ void COpenGLDriver::draw2DImageBatch(const video::ITexture* texture,
const u32 drawCount = core::min_(positions.size(), sourceRects.size());
- // texcoords need to be flipped horizontally for RTTs
- const bool isRTT = texture->isRenderTarget();
const core::dimension2d& ss = texture->getOriginalSize();
const f32 invW = 1.f / static_cast(ss.Width);
const f32 invH = 1.f / static_cast(ss.Height);
@@ -1921,9 +1936,9 @@ void COpenGLDriver::draw2DImageBatch(const video::ITexture* texture,
const core::rect tcoords(
sourcePos.X * invW,
- (isRTT?(sourcePos.Y + sourceSize.Height):sourcePos.Y) * invH,
+ sourcePos.Y * invH,
(sourcePos.X + sourceSize.Width) * invW,
- (isRTT?sourcePos.Y:(sourcePos.Y + sourceSize.Height)) * invH);
+ (sourcePos.Y + sourceSize.Height) * invH);
const core::rect poss(targetPos, sourceSize);
@@ -2040,16 +2055,14 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture,
// ok, we've clipped everything.
// now draw it.
- // texcoords need to be flipped horizontally for RTTs
- const bool isRTT = texture->isRenderTarget();
const core::dimension2d& ss = texture->getOriginalSize();
const f32 invW = 1.f / static_cast(ss.Width);
const f32 invH = 1.f / static_cast(ss.Height);
const core::rect tcoords(
sourcePos.X * invW,
- (isRTT?(sourcePos.Y + sourceSize.Height):sourcePos.Y) * invH,
+ sourcePos.Y * invH,
(sourcePos.X + sourceSize.Width) * invW,
- (isRTT?sourcePos.Y:(sourcePos.Y + sourceSize.Height)) * invH);
+ (sourcePos.Y + sourceSize.Height) * invH);
const core::rect poss(targetPos, sourceSize);
@@ -2085,16 +2098,14 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture, const core::rect
if (!texture)
return;
- // texcoords need to be flipped horizontally for RTTs
- const bool isRTT = texture->isRenderTarget();
const core::dimension2d& ss = texture->getOriginalSize();
const f32 invW = 1.f / static_cast(ss.Width);
const f32 invH = 1.f / static_cast(ss.Height);
const core::rect tcoords(
sourceRect.UpperLeftCorner.X * invW,
- (isRTT?sourceRect.LowerRightCorner.Y:sourceRect.UpperLeftCorner.Y) * invH,
+ sourceRect.UpperLeftCorner.Y * invH,
sourceRect.LowerRightCorner.X * invW,
- (isRTT?sourceRect.UpperLeftCorner.Y:sourceRect.LowerRightCorner.Y) *invH);
+ sourceRect.LowerRightCorner.Y *invH);
const video::SColor temp[4] =
{
@@ -2182,8 +2193,6 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture,
const core::dimension2d& ss = texture->getOriginalSize();
core::position2d targetPos(pos);
- // texcoords need to be flipped horizontally for RTTs
- const bool isRTT = texture->isRenderTarget();
const f32 invW = 1.f / static_cast(ss.Width);
const f32 invH = 1.f / static_cast(ss.Height);
@@ -2195,9 +2204,9 @@ void COpenGLDriver::draw2DImage(const video::ITexture* texture,
const core::rect tcoords(
sourceRects[currentIndex].UpperLeftCorner.X * invW,
- (isRTT?sourceRects[currentIndex].LowerRightCorner.Y:sourceRects[currentIndex].UpperLeftCorner.Y) * invH,
+ sourceRects[currentIndex].UpperLeftCorner.Y * invH,
sourceRects[currentIndex].LowerRightCorner.X * invW,
- (isRTT?sourceRects[currentIndex].UpperLeftCorner.Y:sourceRects[currentIndex].LowerRightCorner.Y) * invH);
+ sourceRects[currentIndex].LowerRightCorner.Y * invH);
const core::rect poss(targetPos, sourceRects[currentIndex].getSize());
@@ -2339,6 +2348,7 @@ bool COpenGLDriver::setActiveTexture(u32 stage, const video::ITexture* texture)
if (texture->getDriverType() != EDT_OPENGL)
{
glDisable(GL_TEXTURE_2D);
+ CurrentTexture[stage]=0;
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
return false;
}
@@ -2460,17 +2470,14 @@ void COpenGLDriver::setRenderStates3DMode()
// Reset Texture Stages
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// switch back the matrices
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf((Matrices[ETS_VIEW] * Matrices[ETS_WORLD]).pointer());
- GLfloat glmat[16];
- createGLMatrix(glmat, Matrices[ETS_PROJECTION]);
- glmat[12] *= -1.0f;
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(glmat);
+ glLoadMatrixf(Matrices[ETS_PROJECTION].pointer());
ResetRenderStates = true;
}
@@ -2607,6 +2614,8 @@ void COpenGLDriver::setWrapMode(const SMaterial& material)
// Has to be checked always because it depends on the textures
for (u32 u=0; u0)
@@ -2724,6 +2733,8 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
// Filtering has to be set for each texture layer
for (u32 i=0; i0)
@@ -2978,14 +2989,14 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
glMatrixMode(GL_PROJECTION);
const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize();
- core::matrix4 m;
- m.buildProjectionMatrixOrthoLH(f32(renderTargetSize.Width), f32(-(s32)(renderTargetSize.Height)), -1.0, 1.0);
+ core::matrix4 m(core::matrix4::EM4CONST_NOTHING);
+ m.buildProjectionMatrixOrthoLH(f32(renderTargetSize.Width), f32(-(s32)(renderTargetSize.Height)), -1.0f, 1.0f);
m.setTranslation(core::vector3df(-1,1,0));
glLoadMatrixf(m.pointer());
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef(0.375, 0.375, 0.0);
+ glTranslatef(0.375f, 0.375f, 0.0f);
// Make sure we set first texture matrix
if (MultiTextureExtension)
@@ -2997,8 +3008,8 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
{
setBasicRenderStates(InitMaterial2D, LastMaterial, true);
LastMaterial = InitMaterial2D;
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
if (OverrideMaterial2DEnabled)
{
@@ -3030,7 +3041,11 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
+ Material.setTexture(0, const_cast(CurrentTexture[0]));
setTransform(ETS_TEXTURE_0, core::IdentityMatrix);
+ // Due to the transformation change, the previous line would call a reset each frame
+ // but we can safely reset the variable as it was false before
+ Transformation3DChanged=false;
if (alphaChannel)
{
@@ -3297,16 +3312,20 @@ void COpenGLDriver::setAmbientLight(const SColorf& color)
// method just a bit.
void COpenGLDriver::setViewPort(const core::rect& area)
{
+ if (area == ViewPort)
+ return;
core::rect vp = area;
core::rect rendert(0,0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
vp.clipAgainst(rendert);
if (vp.getHeight()>0 && vp.getWidth()>0)
+ {
glViewport(vp.UpperLeftCorner.X,
getCurrentRenderTargetSize().Height - vp.UpperLeftCorner.Y - vp.getHeight(),
vp.getWidth(), vp.getHeight());
- ViewPort = vp;
+ ViewPort = vp;
+ }
}
@@ -3353,6 +3372,10 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
decr = GL_DECR_WRAP_EXT;
}
#endif
+#ifdef GL_NV_depth_clamp
+ if (FeatureAvailable[IRR_NV_depth_clamp])
+ glEnable(GL_DEPTH_CLAMP_NV);
+#endif
// The first parts are not correctly working, yet.
#if 0
@@ -3360,10 +3383,6 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
if (FeatureAvailable[IRR_EXT_stencil_two_side])
{
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
-#ifdef GL_NV_depth_clamp
- if (FeatureAvailable[IRR_NV_depth_clamp])
- glEnable(GL_DEPTH_CLAMP_NV);
-#endif
glDisable(GL_CULL_FACE);
if (zfail)
{
@@ -3388,10 +3407,6 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);
glDrawArrays(GL_TRIANGLES,0,count);
-#ifdef GL_NV_depth_clamp
- if (FeatureAvailable[IRR_NV_depth_clamp])
- glDisable(GL_DEPTH_CLAMP_NV);
-#endif
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
}
else
@@ -3409,7 +3424,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
extGlStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, decr);
extGlStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, incr);
}
- extGlStencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, 0, ~0);
+ extGlStencilFuncSeparate(GL_ALWAYS, GL_ALWAYS, 0, ~0);
glStencilMask(~0);
glDrawArrays(GL_TRIANGLES,0,count);
}
@@ -3438,6 +3453,10 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3
glDrawArrays(GL_TRIANGLES,0,count);
}
}
+#ifdef GL_NV_depth_clamp
+ if (FeatureAvailable[IRR_NV_depth_clamp])
+ glDisable(GL_DEPTH_CLAMP_NV);
+#endif
glDisableClientState(GL_VERTEX_ARRAY); //not stored on stack
glPopAttrib();
@@ -3751,7 +3770,12 @@ bool COpenGLDriver::setRenderTarget(video::E_RENDER_TARGET target, bool clearTar
if (ERT_RENDER_TEXTURE == target)
{
- os::Printer::log("Fatal Error: For render textures call setRenderTarget with the actual texture as first parameter.", ELL_ERROR);
+ os::Printer::log("For render textures call setRenderTarget with the actual texture as first parameter.", ELL_ERROR);
+ return false;
+ }
+ if (ERT_MULTI_RENDER_TEXTURES == target)
+ {
+ os::Printer::log("For multiple render textures call setRenderTarget with the texture array as first parameter.", ELL_ERROR);
return false;
}
@@ -3801,34 +3825,55 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff
return false;
}
+#if defined(GL_EXT_framebuffer_object)
+ if (CurrentTarget==ERT_MULTI_RENDER_TEXTURES)
+ {
+ for (u32 i=0; iunbindRTT();
+ }
- setActiveTexture(0, 0);
- ResetRenderStates=true;
- if (RenderTargetTexture!=0)
- {
- RenderTargetTexture->unbindRTT();
- }
-
- if (texture)
- {
- // we want to set a new target. so do this.
- glViewport(0, 0, texture->getSize().Width, texture->getSize().Height);
- RenderTargetTexture = static_cast(texture);
- RenderTargetTexture->bindRTT();
- CurrentRendertargetSize = texture->getSize();
- CurrentTarget=ERT_RENDER_TEXTURE;
- }
- else
- {
- glViewport(0,0,ScreenSize.Width,ScreenSize.Height);
- RenderTargetTexture = 0;
- CurrentRendertargetSize = core::dimension2d(0,0);
- CurrentTarget=ERT_FRAME_BUFFER;
- glDrawBuffer(Doublebuffer?GL_BACK_LEFT:GL_FRONT_LEFT);
+ if (texture)
+ {
+ // we want to set a new target. so do this.
+ glViewport(0, 0, texture->getSize().Width, texture->getSize().Height);
+ RenderTargetTexture = static_cast(texture);
+ RenderTargetTexture->bindRTT();
+ CurrentRendertargetSize = texture->getSize();
+ CurrentTarget=ERT_RENDER_TEXTURE;
+ }
+ else
+ {
+ glViewport(0,0,ScreenSize.Width,ScreenSize.Height);
+ RenderTargetTexture = 0;
+ CurrentRendertargetSize = core::dimension2d(0,0);
+ CurrentTarget=ERT_FRAME_BUFFER;
+ glDrawBuffer(Doublebuffer?GL_BACK_LEFT:GL_FRONT_LEFT);
+ }
+ // we need to update the matrices due to the rendersize change.
+ Transformation3DChanged=true;
}
clearBuffers(clearBackBuffer, clearZBuffer, false, color);
+
return true;
}
@@ -3837,8 +3882,21 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff
bool COpenGLDriver::setRenderTarget(const core::array& targets,
bool clearBackBuffer, bool clearZBuffer, SColor color)
{
+ // if simply disabling the MRT via array call
if (targets.size()==0)
return setRenderTarget(0, clearBackBuffer, clearZBuffer, color);
+ // if disabling old MRT, but enabling new one as well
+ if ((MRTargets.size()!=0) && (targets != MRTargets))
+ setRenderTarget(0, clearBackBuffer, clearZBuffer, color);
+ // if no change, simply clear buffers
+ else if (targets == MRTargets)
+ {
+ clearBuffers(clearBackBuffer, clearZBuffer, false, color);
+ return true;
+ }
+
+ // copy to storage for correct disabling
+ MRTargets=targets;
u32 maxMultipleRTTs = core::min_(static_cast(MaxMultipleRenderTargets), targets.size());
@@ -3901,7 +3959,7 @@ bool COpenGLDriver::setRenderTarget(const core::array& tar
if (targets[i].TargetType==ERT_RENDER_TEXTURE)
{
setRenderTarget(targets[i].RenderTexture, false, false, 0x0);
- break;
+ break; // bind only first RTT
}
}
// init other main buffer, if necessary
@@ -3930,7 +3988,7 @@ bool COpenGLDriver::setRenderTarget(const core::array& tar
}
if (FeatureAvailable[IRR_AMD_draw_buffers_blend] || FeatureAvailable[IRR_ARB_draw_buffers_blend])
{
- extGlBlendFuncIndexed(i, targets[i].BlendFuncSrc, targets[i].BlendFuncDst);
+ extGlBlendFuncIndexed(i, getGLBlend(targets[i].BlendFuncSrc), getGLBlend(targets[i].BlendFuncDst));
}
if (targets[i].TargetType==ERT_RENDER_TEXTURE)
{
@@ -3938,7 +3996,8 @@ bool COpenGLDriver::setRenderTarget(const core::array& tar
#ifdef GL_EXT_framebuffer_object
// attach texture to FrameBuffer Object on Color [i]
attachment = GL_COLOR_ATTACHMENT0_EXT+i;
- extGlFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, static_cast(targets[i].RenderTexture)->getOpenGLTextureName(), 0);
+ if ((i != 0) && (targets[i].RenderTexture != RenderTargetTexture))
+ extGlFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, static_cast(targets[i].RenderTexture)->getOpenGLTextureName(), 0);
#endif
MRTs[i]=attachment;
}
@@ -4135,6 +4194,7 @@ core::dimension2du COpenGLDriver::getMaxTextureSize() const
return core::dimension2du(MaxTextureSize, MaxTextureSize);
}
+
//! Convert E_PRIMITIVE_TYPE to OpenGL equivalent
GLenum COpenGLDriver::primitiveTypeToGL(scene::E_PRIMITIVE_TYPE type) const
{
@@ -4170,6 +4230,28 @@ GLenum COpenGLDriver::primitiveTypeToGL(scene::E_PRIMITIVE_TYPE type) const
return GL_TRIANGLES;
}
+
+GLenum COpenGLDriver::getGLBlend (E_BLEND_FACTOR factor) const
+{
+ u32 r = 0;
+ switch (factor)
+ {
+ case EBF_ZERO: r = GL_ZERO; break;
+ case EBF_ONE: r = GL_ONE; break;
+ case EBF_DST_COLOR: r = GL_DST_COLOR; break;
+ case EBF_ONE_MINUS_DST_COLOR: r = GL_ONE_MINUS_DST_COLOR; break;
+ case EBF_SRC_COLOR: r = GL_SRC_COLOR; break;
+ case EBF_ONE_MINUS_SRC_COLOR: r = GL_ONE_MINUS_SRC_COLOR; break;
+ case EBF_SRC_ALPHA: r = GL_SRC_ALPHA; break;
+ case EBF_ONE_MINUS_SRC_ALPHA: r = GL_ONE_MINUS_SRC_ALPHA; break;
+ case EBF_DST_ALPHA: r = GL_DST_ALPHA; break;
+ case EBF_ONE_MINUS_DST_ALPHA: r = GL_ONE_MINUS_DST_ALPHA; break;
+ case EBF_SRC_ALPHA_SATURATE: r = GL_SRC_ALPHA_SATURATE; break;
+ }
+ return r;
+}
+
+
} // end namespace
} // end namespace
diff --git a/source/Irrlicht/COpenGLDriver.h b/source/Irrlicht/COpenGLDriver.h
index 3b378685..f45e7f38 100644
--- a/source/Irrlicht/COpenGLDriver.h
+++ b/source/Irrlicht/COpenGLDriver.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
@@ -378,6 +378,9 @@ namespace video
//! Convert E_PRIMITIVE_TYPE to OpenGL equivalent
GLenum primitiveTypeToGL(scene::E_PRIMITIVE_TYPE type) const;
+ //! Convert E_BLEND_FACTOR to OpenGL equivalent
+ GLenum getGLBlend(E_BLEND_FACTOR factor) const;
+
private:
//! clears the zbuffer and color buffer
@@ -446,6 +449,7 @@ namespace video
SMaterial Material, LastMaterial;
COpenGLTexture* RenderTargetTexture;
+ core::array MRTargets;
const ITexture* CurrentTexture[MATERIAL_MAX_TEXTURES];
core::array DepthTextures;
struct SUserClipPlane
diff --git a/source/Irrlicht/COpenGLExtensionHandler.cpp b/source/Irrlicht/COpenGLExtensionHandler.cpp
index c018946a..61b5d900 100644
--- a/source/Irrlicht/COpenGLExtensionHandler.cpp
+++ b/source/Irrlicht/COpenGLExtensionHandler.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -19,8 +19,8 @@ namespace video
COpenGLExtensionHandler::COpenGLExtensionHandler() :
StencilBuffer(false), MultiTextureExtension(false),
TextureCompressionExtension(false),
- MaxTextureUnits(1), MaxLights(1), MaxAnisotropy(1),
- MaxUserClipPlanes(0), MaxAuxBuffers(0),
+ MaxSupportedTextures(1), MaxTextureUnits(1), MaxLights(1),
+ MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0),
MaxMultipleRenderTargets(1), MaxIndices(65535),
MaxTextureSize(1), MaxGeometryVerticesOut(0),
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
@@ -606,7 +606,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
if (Version>102 || FeatureAvailable[IRR_ARB_multitexture])
{
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &num);
- MaxTextureUnits=static_cast(num);
+ MaxSupportedTextures=static_cast(num);
}
#endif
glGetIntegerv(GL_MAX_LIGHTS, &num);
@@ -651,7 +651,11 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
MaxMultipleRenderTargets = static_cast(num);
}
-#elif defined(GL_ATI_draw_buffers)
+#endif
+#if defined(GL_ATI_draw_buffers)
+#ifdef GL_ARB_draw_buffers
+ else
+#endif
if (FeatureAvailable[IRR_ATI_draw_buffers])
{
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ATI, &num);
@@ -689,12 +693,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
}
else
#endif
+ MaxTextureUnits = core::min_(MaxSupportedTextures, static_cast(MATERIAL_MAX_TEXTURES));
if (MaxTextureUnits < 2)
{
MultiTextureExtension = false;
os::Printer::log("Warning: OpenGL device only has one texture unit. Disabling multitexturing.", ELL_WARNING);
}
- MaxTextureUnits = core::min_(MaxTextureUnits,static_cast(MATERIAL_MAX_TEXTURES));
#ifdef GL_ARB_occlusion_query
if (FeatureAvailable[IRR_ARB_occlusion_query])
diff --git a/source/Irrlicht/COpenGLExtensionHandler.h b/source/Irrlicht/COpenGLExtensionHandler.h
index 1a5a1564..b5612b5b 100644
--- a/source/Irrlicht/COpenGLExtensionHandler.h
+++ b/source/Irrlicht/COpenGLExtensionHandler.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
@@ -82,11 +82,16 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_3DFX_multisample",
"GL_3DFX_tbuffer",
"GL_3DFX_texture_compression_FXT1",
+ "GL_AMD_conservative_depth",
+ "GL_AMD_debug_output",
+ "GL_AMD_depth_clamp_separate",
"GL_AMD_draw_buffers_blend",
+ "GL_AMD_name_gen_delete",
"GL_AMD_performance_monitor",
"GL_AMD_seamless_cubemap_per_texture",
"GL_AMD_shader_stencil_export",
"GL_AMD_texture_texture4",
+ "GL_AMD_transform_feedback3_lines_triangles",
"GL_AMD_vertex_shader_tesselator",
"GL_APPLE_aux_depth_stencil",
"GL_APPLE_client_storage",
@@ -105,9 +110,11 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_APPLE_vertex_program_evaluators",
"GL_APPLE_ycbcr_422",
"GL_ARB_blend_func_extended",
+ "GL_ARB_cl_event",
"GL_ARB_color_buffer_float",
"GL_ARB_compatibility",
"GL_ARB_copy_buffer",
+ "GL_ARB_debug_output",
"GL_ARB_depth_buffer_float",
"GL_ARB_depth_clamp",
"GL_ARB_depth_texture",
@@ -116,13 +123,17 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_ARB_draw_elements_base_vertex",
"GL_ARB_draw_indirect",
"GL_ARB_draw_instanced",
+ "GL_ARB_ES2_compatibility",
+ "GL_ARB_explicit_attrib_location",
"GL_ARB_fragment_coord_conventions",
"GL_ARB_fragment_program",
"GL_ARB_fragment_program_shadow",
"GL_ARB_fragment_shader",
"GL_ARB_framebuffer_object",
"GL_ARB_framebuffer_sRGB",
+ "GL_ARB_get_program_binary",
"GL_ARB_geometry_shader4",
+ "GL_ARB_gpu_shader5",
"GL_ARB_gpu_shader_fp64",
"GL_ARB_half_float_pixel",
"GL_ARB_half_float_vertex",
@@ -133,14 +144,19 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_ARB_multisample",
"GL_ARB_multitexture",
"GL_ARB_occlusion_query",
+ "GL_ARB_occlusion_query2",
"GL_ARB_pixel_buffer_object",
"GL_ARB_point_parameters",
"GL_ARB_point_sprite",
"GL_ARB_provoking_vertex",
+ "GL_ARB_robustness",
"GL_ARB_sample_shading",
"GL_ARB_sampler_objects",
"GL_ARB_seamless_cube_map",
+ "GL_ARB_separate_shader_objects",
"GL_ARB_shader_objects",
+ "GL_ARB_shader_precision",
+ "GL_ARB_shader_stencil_export",
"GL_ARB_shader_subroutine",
"GL_ARB_shader_texture_lod",
"GL_ARB_shading_language_100",
@@ -151,7 +167,9 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_ARB_tessellation_shader",
"GL_ARB_texture_border_clamp",
"GL_ARB_texture_buffer_object",
+ "GL_ARB_texture_buffer_object_rgb32",
"GL_ARB_texture_compression",
+ "GL_ARB_texture_compression_bptc",
"GL_ARB_texture_compression_rgtc",
"GL_ARB_texture_cube_map",
"GL_ARB_texture_cube_map_array",
@@ -167,6 +185,8 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_ARB_texture_query_lod",
"GL_ARB_texture_rectangle",
"GL_ARB_texture_rg",
+ "GL_ARB_texture_rgb10_a2ui",
+ "GL_ARB_texture_swizzle",
"GL_ARB_timer_query",
"GL_ARB_transform_feedback2",
"GL_ARB_transform_feedback3",
@@ -174,11 +194,13 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_ARB_uniform_buffer_object",
"GL_ARB_vertex_array_bgra",
"GL_ARB_vertex_array_object",
+ "GL_ARB_vertex_attrib_64bit",
"GL_ARB_vertex_blend",
"GL_ARB_vertex_buffer_object",
"GL_ARB_vertex_program",
"GL_ARB_vertex_shader",
"GL_ARB_vertex_type_2_10_10_10_rev",
+ "GL_ARB_viewport_array",
"GL_ARB_window_pos",
"GL_ATI_draw_buffers",
"GL_ATI_element_array",
@@ -250,6 +272,7 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_EXT_secondary_color",
"GL_EXT_separate_shader_objects",
"GL_EXT_separate_specular_color",
+ "GL_EXT_shader_image_load_store",
"GL_EXT_shadow_funcs",
"GL_EXT_shared_texture_palette",
"GL_EXT_stencil_clear_tag",
@@ -281,6 +304,7 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_EXT_transform_feedback",
"GL_EXT_vertex_array",
"GL_EXT_vertex_array_bgra",
+ "GL_EXT_vertex_attrib_64bit",
"GL_EXT_vertex_shader",
"GL_EXT_vertex_weighting",
"GL_FfdMaskSGIX",
@@ -325,8 +349,11 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_NV_geometry_program4",
"GL_NV_geometry_shader4",
"GL_NV_gpu_program4",
+ "GL_NV_gpu_program5",
+ "GL_NV_gpu_shader5",
"GL_NV_half_float",
"GL_NV_light_max_exponent",
+ "GL_NV_multisample_coverage",
"GL_NV_multisample_filter_hint",
"GL_NV_occlusion_query",
"GL_NV_packed_depth_stencil",
@@ -339,6 +366,8 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_NV_register_combiners",
"GL_NV_register_combiners2",
"GL_NV_shader_buffer_load",
+ "GL_NV_shader_buffer_store",
+ "GL_NV_tessellation_program5",
"GL_NV_texgen_emboss",
"GL_NV_texgen_reflection",
"GL_NV_texture_barrier",
@@ -351,8 +380,10 @@ static const char* const OpenGLFeatureStrings[] = {
"GL_NV_texture_shader3",
"GL_NV_transform_feedback",
"GL_NV_transform_feedback2",
+ "GL_NV_vdpau_interop",
"GL_NV_vertex_array_range",
"GL_NV_vertex_array_range2",
+ "GL_NV_vertex_attrib_integer_64bit",
"GL_NV_vertex_buffer_unified_memory",
"GL_NV_vertex_program",
"GL_NV_vertex_program1_1",
@@ -450,11 +481,16 @@ class COpenGLExtensionHandler
IRR_3DFX_multisample = 0,
IRR_3DFX_tbuffer,
IRR_3DFX_texture_compression_FXT1,
+ IRR_AMD_conservative_depth,
+ IRR_AMD_debug_output,
+ IRR_AMD_depth_clamp_separate,
IRR_AMD_draw_buffers_blend,
+ IRR_AMD_name_gen_delete,
IRR_AMD_performance_monitor,
IRR_AMD_seamless_cubemap_per_texture,
IRR_AMD_shader_stencil_export,
IRR_AMD_texture_texture4,
+ IRR_AMD_transform_feedback3_lines_triangles,
IRR_AMD_vertex_shader_tesselator,
IRR_APPLE_aux_depth_stencil,
IRR_APPLE_client_storage,
@@ -473,9 +509,11 @@ class COpenGLExtensionHandler
IRR_APPLE_vertex_program_evaluators,
IRR_APPLE_ycbcr_422,
IRR_ARB_blend_func_extended,
+ IRR_ARB_cl_event,
IRR_ARB_color_buffer_float,
IRR_ARB_compatibility,
IRR_ARB_copy_buffer,
+ IRR_ARB_debug_output,
IRR_ARB_depth_buffer_float,
IRR_ARB_depth_clamp,
IRR_ARB_depth_texture,
@@ -484,6 +522,8 @@ class COpenGLExtensionHandler
IRR_ARB_draw_elements_base_vertex,
IRR_ARB_draw_indirect,
IRR_ARB_draw_instanced,
+ IRR_ARB_ES2_compatibility,
+ IRR_ARB_explicit_attrib_location,
IRR_ARB_fragment_coord_conventions,
IRR_ARB_fragment_program,
IRR_ARB_fragment_program_shadow,
@@ -491,6 +531,8 @@ class COpenGLExtensionHandler
IRR_ARB_framebuffer_object,
IRR_ARB_framebuffer_sRGB,
IRR_ARB_geometry_shader4,
+ IRR_ARB_get_program_binary,
+ IRR_ARB_gpu_shader5,
IRR_ARB_gpu_shader_fp64,
IRR_ARB_half_float_pixel,
IRR_ARB_half_float_vertex,
@@ -501,14 +543,19 @@ class COpenGLExtensionHandler
IRR_ARB_multisample,
IRR_ARB_multitexture,
IRR_ARB_occlusion_query,
+ IRR_ARB_occlusion_query2,
IRR_ARB_pixel_buffer_object,
IRR_ARB_point_parameters,
IRR_ARB_point_sprite,
IRR_ARB_provoking_vertex,
+ IRR_ARB_robustness,
IRR_ARB_sample_shading,
IRR_ARB_sampler_objects,
IRR_ARB_seamless_cube_map,
+ IRR_ARB_separate_shader_objects,
IRR_ARB_shader_objects,
+ IRR_ARB_shader_precision,
+ IRR_ARB_shader_stencil_export,
IRR_ARB_shader_subroutine,
IRR_ARB_shader_texture_lod,
IRR_ARB_shading_language_100,
@@ -519,7 +566,9 @@ class COpenGLExtensionHandler
IRR_ARB_tessellation_shader,
IRR_ARB_texture_border_clamp,
IRR_ARB_texture_buffer_object,
+ IRR_ARB_texture_buffer_object_rgb32,
IRR_ARB_texture_compression,
+ IRR_ARB_texture_compression_bptc,
IRR_ARB_texture_compression_rgtc,
IRR_ARB_texture_cube_map,
IRR_ARB_texture_cube_map_array,
@@ -535,6 +584,8 @@ class COpenGLExtensionHandler
IRR_ARB_texture_query_lod,
IRR_ARB_texture_rectangle,
IRR_ARB_texture_rg,
+ IRR_ARB_texture_rgb10_a2ui,
+ IRR_ARB_texture_swizzle,
IRR_ARB_timer_query,
IRR_ARB_transform_feedback2,
IRR_ARB_transform_feedback3,
@@ -542,11 +593,13 @@ class COpenGLExtensionHandler
IRR_ARB_uniform_buffer_object,
IRR_ARB_vertex_array_bgra,
IRR_ARB_vertex_array_object,
+ IRR_ARB_vertex_attrib_64bit,
IRR_ARB_vertex_blend,
IRR_ARB_vertex_buffer_object,
IRR_ARB_vertex_program,
IRR_ARB_vertex_shader,
IRR_ARB_vertex_type_2_10_10_10_rev,
+ IRR_ARB_viewport_array,
IRR_ARB_window_pos,
IRR_ATI_draw_buffers,
IRR_ATI_element_array,
@@ -618,6 +671,7 @@ class COpenGLExtensionHandler
IRR_EXT_secondary_color,
IRR_EXT_separate_shader_objects,
IRR_EXT_separate_specular_color,
+ IRR_EXT_shader_image_load_store,
IRR_EXT_shadow_funcs,
IRR_EXT_shared_texture_palette,
IRR_EXT_stencil_clear_tag,
@@ -649,6 +703,7 @@ class COpenGLExtensionHandler
IRR_EXT_transform_feedback,
IRR_EXT_vertex_array,
IRR_EXT_vertex_array_bgra,
+ IRR_EXT_vertex_attrib_64bit,
IRR_EXT_vertex_shader,
IRR_EXT_vertex_weighting,
IRR_FfdMaskSGIX,
@@ -693,8 +748,11 @@ class COpenGLExtensionHandler
IRR_NV_geometry_program4,
IRR_NV_geometry_shader4,
IRR_NV_gpu_program4,
+ IRR_NV_gpu_program5,
+ IRR_NV_gpu_shader5,
IRR_NV_half_float,
IRR_NV_light_max_exponent,
+ IRR_NV_multisample_coverage,
IRR_NV_multisample_filter_hint,
IRR_NV_occlusion_query,
IRR_NV_packed_depth_stencil,
@@ -707,6 +765,8 @@ class COpenGLExtensionHandler
IRR_NV_register_combiners,
IRR_NV_register_combiners2,
IRR_NV_shader_buffer_load,
+ IRR_NV_shader_buffer_store,
+ IRR_NV_tessellation_program5,
IRR_NV_texgen_emboss,
IRR_NV_texgen_reflection,
IRR_NV_texture_barrier,
@@ -719,8 +779,10 @@ class COpenGLExtensionHandler
IRR_NV_texture_shader3,
IRR_NV_transform_feedback,
IRR_NV_transform_feedback2,
+ IRR_NV_vdpau_interop,
IRR_NV_vertex_array_range,
IRR_NV_vertex_array_range2,
+ IRR_NV_vertex_attrib_integer_64bit,
IRR_NV_vertex_buffer_unified_memory,
IRR_NV_vertex_program,
IRR_NV_vertex_program1_1,
@@ -836,6 +898,8 @@ class COpenGLExtensionHandler
// Some non-boolean properties
//! Maxmimum texture layers supported by the fixed pipeline
+ u8 MaxSupportedTextures;
+ //! Maxmimum texture layers supported by the engine
u8 MaxTextureUnits;
//! Maximum hardware lights supported
u8 MaxLights;
diff --git a/source/Irrlicht/COpenGLMaterialRenderer.h b/source/Irrlicht/COpenGLMaterialRenderer.h
index f8d2f0d5..fe73aeb1 100644
--- a/source/Irrlicht/COpenGLMaterialRenderer.h
+++ b/source/Irrlicht/COpenGLMaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -93,7 +93,7 @@ public:
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, (f32) modulate );
#endif
- glBlendFunc( getGLBlend(srcFact), getGLBlend(dstFact) );
+ glBlendFunc( Driver->getGLBlend(srcFact), Driver->getGLBlend(dstFact) );
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.f);
glEnable(GL_BLEND);
@@ -165,29 +165,6 @@ public:
{
return true;
}
-
- private:
-
- u32 getGLBlend ( E_BLEND_FACTOR factor ) const
- {
- u32 r = 0;
- switch ( factor )
- {
- case EBF_ZERO: r = GL_ZERO; break;
- case EBF_ONE: r = GL_ONE; break;
- case EBF_DST_COLOR: r = GL_DST_COLOR; break;
- case EBF_ONE_MINUS_DST_COLOR: r = GL_ONE_MINUS_DST_COLOR; break;
- case EBF_SRC_COLOR: r = GL_SRC_COLOR; break;
- case EBF_ONE_MINUS_SRC_COLOR: r = GL_ONE_MINUS_SRC_COLOR; break;
- case EBF_SRC_ALPHA: r = GL_SRC_ALPHA; break;
- case EBF_ONE_MINUS_SRC_ALPHA: r = GL_ONE_MINUS_SRC_ALPHA; break;
- case EBF_DST_ALPHA: r = GL_DST_ALPHA; break;
- case EBF_ONE_MINUS_DST_ALPHA: r = GL_ONE_MINUS_DST_ALPHA; break;
- case EBF_SRC_ALPHA_SATURATE: r = GL_SRC_ALPHA_SATURATE; break;
- }
- return r;
- }
-
};
@@ -316,7 +293,7 @@ public:
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
#endif
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
}
@@ -710,6 +687,21 @@ public:
if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
{
+#ifdef GL_ARB_texture_env_combine
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB);
+#else
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PREVIOUS_ARB);
+#endif
if (Driver->queryFeature(EVDF_MULTITEXTURE))
{
Driver->extGlActiveTexture(GL_TEXTURE1_ARB);
@@ -718,11 +710,15 @@ public:
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PREVIOUS_ARB);
#else
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PREVIOUS_ARB);
#endif
}
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
@@ -730,7 +726,7 @@ public:
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
}
diff --git a/source/Irrlicht/COpenGLNormalMapRenderer.cpp b/source/Irrlicht/COpenGLNormalMapRenderer.cpp
index c4201255..0de05a6f 100644
--- a/source/Irrlicht/COpenGLNormalMapRenderer.cpp
+++ b/source/Irrlicht/COpenGLNormalMapRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLNormalMapRenderer.h b/source/Irrlicht/COpenGLNormalMapRenderer.h
index 4b50954b..726d6bff 100644
--- a/source/Irrlicht/COpenGLNormalMapRenderer.h
+++ b/source/Irrlicht/COpenGLNormalMapRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp
index 3c3b0e71..d561a8ca 100644
--- a/source/Irrlicht/COpenGLParallaxMapRenderer.cpp
+++ b/source/Irrlicht/COpenGLParallaxMapRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLParallaxMapRenderer.h b/source/Irrlicht/COpenGLParallaxMapRenderer.h
index 3424c3fe..3dad6085 100644
--- a/source/Irrlicht/COpenGLParallaxMapRenderer.h
+++ b/source/Irrlicht/COpenGLParallaxMapRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
index 024b2078..4bac925e 100644
--- a/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
+++ b/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLSLMaterialRenderer.h b/source/Irrlicht/COpenGLSLMaterialRenderer.h
index be122c80..fc3498a2 100644
--- a/source/Irrlicht/COpenGLSLMaterialRenderer.h
+++ b/source/Irrlicht/COpenGLSLMaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
index 279642b7..99c73dba 100644
--- a/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
+++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLShaderMaterialRenderer.h b/source/Irrlicht/COpenGLShaderMaterialRenderer.h
index bf182451..5f229c62 100644
--- a/source/Irrlicht/COpenGLShaderMaterialRenderer.h
+++ b/source/Irrlicht/COpenGLShaderMaterialRenderer.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/COpenGLTexture.cpp b/source/Irrlicht/COpenGLTexture.cpp
index b565c91c..8c7fb47a 100644
--- a/source/Irrlicht/COpenGLTexture.cpp
+++ b/source/Irrlicht/COpenGLTexture.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -24,7 +24,7 @@ namespace video
COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mipmapData, COpenGLDriver* driver)
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
- PixelType(GL_UNSIGNED_BYTE),
+ PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0),
IsRenderTarget(false), AutomaticMipmapUpdate(false),
ReadOnlyLock(false), KeepImage(true)
{
@@ -61,7 +61,7 @@ COpenGLTexture::COpenGLTexture(IImage* origImage, const io::path& name, void* mi
COpenGLTexture::COpenGLTexture(const io::path& name, COpenGLDriver* driver)
: ITexture(name), ColorFormat(ECF_A8R8G8B8), Driver(driver), Image(0), MipImage(0),
TextureName(0), InternalFormat(GL_RGBA), PixelFormat(GL_BGRA_EXT),
- PixelType(GL_UNSIGNED_BYTE),
+ PixelType(GL_UNSIGNED_BYTE), MipLevelStored(0),
HasMipMaps(true), IsRenderTarget(false), AutomaticMipmapUpdate(false),
ReadOnlyLock(false), KeepImage(true)
{
@@ -354,11 +354,11 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
//! lock function
-void* COpenGLTexture::lock(bool readOnly, u32 mipmapLevel)
+void* COpenGLTexture::lock(E_TEXTURE_LOCK_MODE mode, u32 mipmapLevel)
{
// store info about which image is locked
IImage* image = (mipmapLevel==0)?Image:MipImage;
- ReadOnlyLock |= readOnly;
+ ReadOnlyLock |= (mode==ETLM_READ_ONLY);
MipLevelStored = mipmapLevel;
// if data not available or might have changed on GPU download it
@@ -390,48 +390,51 @@ void* COpenGLTexture::lock(bool readOnly, u32 mipmapLevel)
if (!image)
return 0;
- u8* pixels = static_cast(image->lock());
- if (!pixels)
- return 0;
-
- // we need to keep the correct texture bound later on
- GLint tmpTexture;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &tmpTexture);
- glBindTexture(GL_TEXTURE_2D, TextureName);
-
- // allows to read pixels in top-to-bottom order
-#ifdef GL_MESA_pack_invert
- if (Driver->queryOpenGLFeature(COpenGLExtensionHandler::IRR_MESA_pack_invert))
- glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE);
-#endif
-
- // download GPU data as ARGB8 to pixels;
- glGetTexImage(GL_TEXTURE_2D, mipmapLevel, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels);
-
-#ifdef GL_MESA_pack_invert
- if (Driver->queryOpenGLFeature(COpenGLExtensionHandler::IRR_MESA_pack_invert))
- glPixelStorei(GL_PACK_INVERT_MESA, GL_FALSE);
- else
-#endif
+ if (mode != ETLM_WRITE_ONLY)
{
- // opengl images are horizontally flipped, so we have to fix that here.
- const s32 pitch=image->getPitch();
- u8* p2 = pixels + (image->getDimension().Height - 1) * pitch;
- u8* tmpBuffer = new u8[pitch];
- for (u32 i=0; i < image->getDimension().Height; i += 2)
- {
- memcpy(tmpBuffer, pixels, pitch);
- memcpy(pixels, p2, pitch);
- memcpy(p2, tmpBuffer, pitch);
- pixels += pitch;
- p2 -= pitch;
- }
- delete [] tmpBuffer;
- }
- image->unlock();
+ u8* pixels = static_cast(image->lock());
+ if (!pixels)
+ return 0;
- //reset old bound texture
- glBindTexture(GL_TEXTURE_2D, tmpTexture);
+ // we need to keep the correct texture bound later on
+ GLint tmpTexture;
+ glGetIntegerv(GL_TEXTURE_BINDING_2D, &tmpTexture);
+ glBindTexture(GL_TEXTURE_2D, TextureName);
+
+ // allows to read pixels in top-to-bottom order
+ #ifdef GL_MESA_pack_invert
+ if (Driver->queryOpenGLFeature(COpenGLExtensionHandler::IRR_MESA_pack_invert))
+ glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE);
+ #endif
+
+ // download GPU data as ARGB8 to pixels;
+ glGetTexImage(GL_TEXTURE_2D, mipmapLevel, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels);
+
+ #ifdef GL_MESA_pack_invert
+ if (Driver->queryOpenGLFeature(COpenGLExtensionHandler::IRR_MESA_pack_invert))
+ glPixelStorei(GL_PACK_INVERT_MESA, GL_FALSE);
+ else
+ #endif
+ {
+ // opengl images are horizontally flipped, so we have to fix that here.
+ const s32 pitch=image->getPitch();
+ u8* p2 = pixels + (image->getDimension().Height - 1) * pitch;
+ u8* tmpBuffer = new u8[pitch];
+ for (u32 i=0; i < image->getDimension().Height; i += 2)
+ {
+ memcpy(tmpBuffer, pixels, pitch);
+ memcpy(pixels, p2, pitch);
+ memcpy(p2, tmpBuffer, pitch);
+ pixels += pitch;
+ p2 -= pitch;
+ }
+ delete [] tmpBuffer;
+ }
+ image->unlock();
+
+ //reset old bound texture
+ glBindTexture(GL_TEXTURE_2D, tmpTexture);
+ }
}
return image->lock();
}
@@ -605,7 +608,7 @@ static bool checkFBOStatus(COpenGLDriver* Driver);
//! RTT ColorFrameBuffer constructor
COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d& size,
const io::path& name, COpenGLDriver* driver,
- const ECOLOR_FORMAT format)
+ ECOLOR_FORMAT format)
: COpenGLTexture(name, driver), DepthTexture(0), ColorFrameBuffer(0)
{
#ifdef _DEBUG
@@ -615,6 +618,9 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d& size,
ImageSize = size;
TextureSize = size;
+ if (ECF_UNKNOWN == format)
+ format = getBestColorFormat(driver->getColorFormat());
+
GLint FilteringType;
InternalFormat = getOpenGLFormatAndParametersFromColorFormat(format, FilteringType, PixelFormat, PixelType);
@@ -624,7 +630,7 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d& size,
#ifdef GL_EXT_framebuffer_object
// generate frame buffer
Driver->extGlGenFramebuffers(1, &ColorFrameBuffer);
- Driver->extGlBindFramebuffer(GL_FRAMEBUFFER_EXT, ColorFrameBuffer);
+ bindRTT();
// generate color texture
glGenTextures(1, &TextureName);
@@ -669,6 +675,7 @@ void COpenGLFBOTexture::bindRTT()
#ifdef GL_EXT_framebuffer_object
if (ColorFrameBuffer != 0)
Driver->extGlBindFramebuffer(GL_FRAMEBUFFER_EXT, ColorFrameBuffer);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
#endif
}
@@ -691,7 +698,7 @@ COpenGLFBODepthTexture::COpenGLFBODepthTexture(
const io::path& name,
COpenGLDriver* driver,
bool useStencil)
- : COpenGLFBOTexture(size, name, driver), DepthRenderBuffer(0),
+ : COpenGLTexture(name, driver), DepthRenderBuffer(0),
StencilRenderBuffer(0), UseStencil(useStencil)
{
#ifdef _DEBUG
@@ -727,19 +734,14 @@ COpenGLFBODepthTexture::COpenGLFBODepthTexture(
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, ImageSize.Width,
ImageSize.Height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
- // we 're in trouble! the code below does not complete
- // the FBO currently... stencil buffer is only
- // supported with EXT_packed_depth_stencil extension
- // (above)
-
-// // generate stencil texture
-// glGenTextures(1, &StencilRenderBuffer);
-// glBindTexture(GL_TEXTURE_2D, StencilRenderBuffer);
-// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-// glTexImage2D(GL_TEXTURE_2D, 0, GL_STENCIL_INDEX, ImageSize.Width,
-// ImageSize.Height, 0, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, 0);
-// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ // generate stencil texture
+ glGenTextures(1, &StencilRenderBuffer);
+ glBindTexture(GL_TEXTURE_2D, StencilRenderBuffer);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_STENCIL_INDEX, ImageSize.Width,
+ ImageSize.Height, 0, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, 0);
}
}
#ifdef GL_EXT_framebuffer_object
@@ -883,6 +885,7 @@ bool checkFBOStatus(COpenGLDriver* Driver)
}
#endif
os::Printer::log("FBO error", ELL_ERROR);
+ _IRR_DEBUG_BREAK_IF(true);
return false;
}
diff --git a/source/Irrlicht/COpenGLTexture.h b/source/Irrlicht/COpenGLTexture.h
index 47ac6481..acd823c0 100644
--- a/source/Irrlicht/COpenGLTexture.h
+++ b/source/Irrlicht/COpenGLTexture.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -57,7 +57,7 @@ public:
virtual ~COpenGLTexture();
//! lock function
- virtual void* lock(bool readOnly=false, u32 mipmapLevel=0);
+ virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0);
//! unlock function
virtual void unlock();
@@ -172,7 +172,7 @@ protected:
//! OpenGL FBO depth texture.
-class COpenGLFBODepthTexture : public COpenGLFBOTexture
+class COpenGLFBODepthTexture : public COpenGLTexture
{
public:
//! FrameBufferObject depth constructor
diff --git a/source/Irrlicht/CPLYMeshFileLoader.cpp b/source/Irrlicht/CPLYMeshFileLoader.cpp
index 9cff36b3..75cd75fa 100644
--- a/source/Irrlicht/CPLYMeshFileLoader.cpp
+++ b/source/Irrlicht/CPLYMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Gaz Davidson
+// Copyright (C) 2009-2011 Gaz Davidson
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CPLYMeshFileLoader.h b/source/Irrlicht/CPLYMeshFileLoader.h
index 5f452445..b26b37f1 100644
--- a/source/Irrlicht/CPLYMeshFileLoader.h
+++ b/source/Irrlicht/CPLYMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Gaz Davidson
+// Copyright (C) 2009-2011 Gaz Davidson
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CPLYMeshWriter.cpp b/source/Irrlicht/CPLYMeshWriter.cpp
index a6e8617c..df3cef68 100644
--- a/source/Irrlicht/CPLYMeshWriter.cpp
+++ b/source/Irrlicht/CPLYMeshWriter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2009 Christian Stehno
+// Copyright (C) 2008-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CPLYMeshWriter.h b/source/Irrlicht/CPLYMeshWriter.h
index 1e23eed8..a2bb17d3 100644
--- a/source/Irrlicht/CPLYMeshWriter.h
+++ b/source/Irrlicht/CPLYMeshWriter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Gaz Davidson
+// Copyright (C) 2009-2011 Gaz Davidson
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CPakReader.cpp b/source/Irrlicht/CPakReader.cpp
index d8ac68c4..05bbaf0d 100644
--- a/source/Irrlicht/CPakReader.cpp
+++ b/source/Irrlicht/CPakReader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// Code contributed by skreamz
diff --git a/source/Irrlicht/CPakReader.h b/source/Irrlicht/CPakReader.h
index 00d282af..b8e0b69e 100644
--- a/source/Irrlicht/CPakReader.h
+++ b/source/Irrlicht/CPakReader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp b/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
index 1d1f9d77..67f6b015 100644
--- a/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
+++ b/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -44,7 +44,7 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
Time += timeSinceLastCall;
const u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- const f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ const f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
const f32 everyWhatMillisecond = 1000.0f / perSecond;
if(Time > everyWhatMillisecond)
@@ -80,19 +80,20 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
if( MaxAngleDegrees )
{
core::vector3df tgt = p.vector;
- tgt.rotateXYBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
- tgt.rotateYZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
- tgt.rotateXZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
+ tgt.rotateXYBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateYZBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateXZBy(os::Randomizer::frand() * MaxAngleDegrees);
p.vector = tgt;
}
- if(MaxLifeTime - MinLifeTime == 0)
- p.endTime = now + MinLifeTime;
- else
- p.endTime = now + MinLifeTime + (os::Randomizer::rand() % (MaxLifeTime - MinLifeTime));
+ p.endTime = now + MinLifeTime;
+ if (MaxLifeTime != MinLifeTime)
+ p.endTime += os::Randomizer::rand() % (MaxLifeTime - MinLifeTime);
- p.color = MinStartColor.getInterpolated(
- MaxStartColor, (os::Randomizer::rand() % 100) / 100.0f);
+ if (MinStartColor==MaxStartColor)
+ p.color=MinStartColor;
+ else
+ p.color = MinStartColor.getInterpolated(MaxStartColor, os::Randomizer::frand());
p.startColor = p.color;
p.startVector = p.vector;
@@ -100,8 +101,7 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
if (MinStartSize==MaxStartSize)
p.startSize = MinStartSize;
else
- p.startSize = MinStartSize.getInterpolated(
- MaxStartSize, (os::Randomizer::rand() % 100) / 100.0f);
+ p.startSize = MinStartSize.getInterpolated(MaxStartSize, os::Randomizer::frand());
p.size = p.startSize;
Particles.push_back(p);
@@ -133,19 +133,20 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
if( MaxAngleDegrees )
{
core::vector3df tgt = Direction;
- tgt.rotateXYBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
- tgt.rotateYZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
- tgt.rotateXZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
+ tgt.rotateXYBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateYZBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateXZBy(os::Randomizer::frand() * MaxAngleDegrees);
p.vector = tgt;
}
- if(MaxLifeTime - MinLifeTime == 0)
- p.endTime = now + MinLifeTime;
- else
- p.endTime = now + MinLifeTime + (os::Randomizer::rand() % (MaxLifeTime - MinLifeTime));
+ p.endTime = now + MinLifeTime;
+ if (MaxLifeTime != MinLifeTime)
+ p.endTime += os::Randomizer::rand() % (MaxLifeTime - MinLifeTime);
- p.color = MinStartColor.getInterpolated(
- MaxStartColor, (os::Randomizer::rand() % 100) / 100.0f);
+ if (MinStartColor==MaxStartColor)
+ p.color=MinStartColor;
+ else
+ p.color = MinStartColor.getInterpolated(MaxStartColor, os::Randomizer::frand());
p.startColor = p.color;
p.startVector = p.vector;
@@ -153,8 +154,7 @@ s32 CParticleAnimatedMeshSceneNodeEmitter::emitt(u32 now, u32 timeSinceLastCall,
if (MinStartSize==MaxStartSize)
p.startSize = MinStartSize;
else
- p.startSize = MinStartSize.getInterpolated(
- MaxStartSize, (os::Randomizer::rand() % 100) / 100.0f);
+ p.startSize = MinStartSize.getInterpolated(MaxStartSize, os::Randomizer::frand());
p.size = p.startSize;
Particles.push_back(p);
diff --git a/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h b/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h
index d6bf9233..3358ac30 100644
--- a/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h
+++ b/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -70,10 +70,19 @@ public:
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
//! Set the maximum starting size for particles
- virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; };
+ virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
//! Set the minimum starting size for particles
- virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
+
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
//! Get Mesh we're emitting particles from
virtual const IAnimatedMeshSceneNode* getAnimatedMeshSceneNode() const { return Node; }
@@ -104,10 +113,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Get the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Get the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
private:
diff --git a/source/Irrlicht/CParticleAttractionAffector.cpp b/source/Irrlicht/CParticleAttractionAffector.cpp
index 0fc38603..ab9678df 100644
--- a/source/Irrlicht/CParticleAttractionAffector.cpp
+++ b/source/Irrlicht/CParticleAttractionAffector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleAttractionAffector.h b/source/Irrlicht/CParticleAttractionAffector.h
index 241083fb..62b10f65 100644
--- a/source/Irrlicht/CParticleAttractionAffector.h
+++ b/source/Irrlicht/CParticleAttractionAffector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleBoxEmitter.cpp b/source/Irrlicht/CParticleBoxEmitter.cpp
index 4486440c..27a18317 100644
--- a/source/Irrlicht/CParticleBoxEmitter.cpp
+++ b/source/Irrlicht/CParticleBoxEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -40,7 +40,7 @@ s32 CParticleBoxEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outAr
Time += timeSinceLastCall;
const u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- const f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ const f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
const f32 everyWhatMillisecond = 1000.0f / perSecond;
if (Time > everyWhatMillisecond)
@@ -56,9 +56,9 @@ s32 CParticleBoxEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outAr
for (u32 i=0; igetAttributeAsFloat("MinStartSizeWidth");
- MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
- MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
- MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
+ int idx = -1;
+ idx = in->findAttribute("MinStartSizeWidth");
+ if ( idx >= 0 )
+ MinStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MinStartSizeHeight");
+ if ( idx >= 0 )
+ MinStartSize.Height = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeWidth");
+ if ( idx >= 0 )
+ MaxStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeHeight");
+ if ( idx >= 0 )
+ MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
diff --git a/source/Irrlicht/CParticleBoxEmitter.h b/source/Irrlicht/CParticleBoxEmitter.h
index f59e7719..c816e11f 100644
--- a/source/Irrlicht/CParticleBoxEmitter.h
+++ b/source/Irrlicht/CParticleBoxEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -31,7 +31,7 @@ public:
u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f)
+ const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f)
);
//! Prepares an array with new particles to emitt into the system
@@ -59,6 +59,15 @@ public:
//! Set the minimum starting size for particles
virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
+
//! Set box from which the particles are emitted.
virtual void setBox( const core::aabbox3df& box ) { Box = box; }
@@ -78,10 +87,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Gets the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Gets the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
//! Get box from which the particles are emitted.
virtual const core::aabbox3df& getBox() const { return Box; }
diff --git a/source/Irrlicht/CParticleCylinderEmitter.cpp b/source/Irrlicht/CParticleCylinderEmitter.cpp
index 1c0937bf..4e7d1a83 100644
--- a/source/Irrlicht/CParticleCylinderEmitter.cpp
+++ b/source/Irrlicht/CParticleCylinderEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -43,7 +43,7 @@ s32 CParticleCylinderEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*&
Time += timeSinceLastCall;
const u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- const f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ const f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
const f32 everyWhatMillisecond = 1000.0f / perSecond;
if(Time > everyWhatMillisecond)
@@ -59,18 +59,14 @@ s32 CParticleCylinderEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*&
for(u32 i=0; igetAttributeAsFloat("MinStartSizeWidth");
- MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
- MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
- MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
+ int idx = -1;
+ idx = in->findAttribute("MinStartSizeWidth");
+ if ( idx >= 0 )
+ MinStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MinStartSizeHeight");
+ if ( idx >= 0 )
+ MinStartSize.Height = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeWidth");
+ if ( idx >= 0 )
+ MaxStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeHeight");
+ if ( idx >= 0 )
+ MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
diff --git a/source/Irrlicht/CParticleCylinderEmitter.h b/source/Irrlicht/CParticleCylinderEmitter.h
index be2465ae..aafac10d 100644
--- a/source/Irrlicht/CParticleCylinderEmitter.h
+++ b/source/Irrlicht/CParticleCylinderEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -31,7 +31,7 @@ public:
u32 lifeTimeMax=4000,
s32 maxAngleDegrees=0,
const core::dimension2df& minStartSize = core::dimension2df(5.0f,5.0f),
- const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f)
+ const core::dimension2df& maxStartSize = core::dimension2df(5.0f,5.0f)
);
//! Prepares an array with new particles to emitt into the system
@@ -69,10 +69,19 @@ public:
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
//! Set the maximum starting size for particles
- virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; };
+ virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
//! Set the minimum starting size for particles
- virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
+
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
//! Get the center of the cylinder
virtual const core::vector3df& getCenter() const { return Center; }
@@ -105,10 +114,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Gets the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Gets the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
diff --git a/source/Irrlicht/CParticleFadeOutAffector.cpp b/source/Irrlicht/CParticleFadeOutAffector.cpp
index 5559c424..279c934e 100644
--- a/source/Irrlicht/CParticleFadeOutAffector.cpp
+++ b/source/Irrlicht/CParticleFadeOutAffector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -36,7 +36,7 @@ void CParticleFadeOutAffector::affect(u32 now, SParticle* particlearray, u32 cou
{
if (particlearray[i].endTime - now < FadeOutTime)
{
- d = (particlearray[i].endTime - now) / FadeOutTime;
+ d = (particlearray[i].endTime - now) / FadeOutTime; // FadeOutTime probably f32 to save casts here (just guessing)
particlearray[i].color = particlearray[i].startColor.getInterpolated(
TargetColor, d);
}
diff --git a/source/Irrlicht/CParticleFadeOutAffector.h b/source/Irrlicht/CParticleFadeOutAffector.h
index 7ad97fa0..7afb6619 100644
--- a/source/Irrlicht/CParticleFadeOutAffector.h
+++ b/source/Irrlicht/CParticleFadeOutAffector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -28,22 +28,22 @@ public:
virtual void setTargetColor( const video::SColor& targetColor ) { TargetColor = targetColor; }
//! Sets the amount of time it takes for each particle to fade out.
- virtual void setFadeOutTime( f32 fadeOutTime ) { FadeOutTime = fadeOutTime; }
+ virtual void setFadeOutTime( u32 fadeOutTime ) { FadeOutTime = fadeOutTime ? static_cast(fadeOutTime) : 1.0f; }
//! Sets the targetColor, i.e. the color the particles will interpolate
//! to over time.
virtual const video::SColor& getTargetColor() const { return TargetColor; }
//! Sets the amount of time it takes for each particle to fade out.
- virtual f32 getFadeOutTime() const { return FadeOutTime; }
+ virtual u32 getFadeOutTime() const { return static_cast(FadeOutTime); }
//! Writes attributes of the object.
- //! Implement this to expose the attributes of your scene node animator for
+ //! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the object.
- //! Implement this to set the attributes of your scene node animator for
+ //! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
//! \param startIndex: start index where to start reading attributes.
//! \return: returns last index of an attribute read by this affector
diff --git a/source/Irrlicht/CParticleGravityAffector.cpp b/source/Irrlicht/CParticleGravityAffector.cpp
index c57ca34e..3a7bf185 100644
--- a/source/Irrlicht/CParticleGravityAffector.cpp
+++ b/source/Irrlicht/CParticleGravityAffector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleGravityAffector.h b/source/Irrlicht/CParticleGravityAffector.h
index d517c25f..88a129de 100644
--- a/source/Irrlicht/CParticleGravityAffector.h
+++ b/source/Irrlicht/CParticleGravityAffector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleMeshEmitter.cpp b/source/Irrlicht/CParticleMeshEmitter.cpp
index 34c2835a..e5571164 100644
--- a/source/Irrlicht/CParticleMeshEmitter.cpp
+++ b/source/Irrlicht/CParticleMeshEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -44,7 +44,7 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
Time += timeSinceLastCall;
const u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- const f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ const f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
const f32 everyWhatMillisecond = 1000.0f / perSecond;
if(Time > everyWhatMillisecond)
@@ -77,19 +77,20 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
if( MaxAngleDegrees )
{
core::vector3df tgt = p.vector;
- tgt.rotateXYBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees, core::vector3df(0,0,0));
- tgt.rotateYZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees, core::vector3df(0,0,0));
- tgt.rotateXZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees, core::vector3df(0,0,0));
+ tgt.rotateXYBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateYZBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateXZBy(os::Randomizer::frand() * MaxAngleDegrees);
p.vector = tgt;
}
- if(MaxLifeTime - MinLifeTime == 0)
- p.endTime = now + MinLifeTime;
- else
- p.endTime = now + MinLifeTime + (os::Randomizer::rand() % (MaxLifeTime - MinLifeTime));
+ p.endTime = now + MinLifeTime;
+ if (MaxLifeTime != MinLifeTime)
+ p.endTime += os::Randomizer::rand() % (MaxLifeTime - MinLifeTime);
- p.color = MinStartColor.getInterpolated(
- MaxStartColor, (os::Randomizer::rand() % 100) / 100.0f);
+ if (MinStartColor==MaxStartColor)
+ p.color=MinStartColor;
+ else
+ p.color = MinStartColor.getInterpolated(MaxStartColor, os::Randomizer::frand());
p.startColor = p.color;
p.startVector = p.vector;
@@ -97,8 +98,7 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
if (MinStartSize==MaxStartSize)
p.startSize = MinStartSize;
else
- p.startSize = MinStartSize.getInterpolated(
- MaxStartSize, (os::Randomizer::rand() % 100) / 100.0f);
+ p.startSize = MinStartSize.getInterpolated(MaxStartSize, os::Randomizer::frand());
p.size = p.startSize;
Particles.push_back(p);
@@ -107,16 +107,7 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
}
else
{
- s32 randomMB = 0;
-
- if( MBNumber < 0 )
- {
- randomMB = os::Randomizer::rand() % MBCount;
- }
- else
- {
- randomMB = MBNumber;
- }
+ const s32 randomMB = (MBNumber < 0) ? (os::Randomizer::rand() % MBCount) : MBNumber;
u32 vertexNumber = Mesh->getMeshBuffer(randomMB)->getVertexCount();
if (!vertexNumber)
@@ -135,19 +126,20 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
if( MaxAngleDegrees )
{
core::vector3df tgt = Direction;
- tgt.rotateXYBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees, core::vector3df(0,0,0));
- tgt.rotateYZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees, core::vector3df(0,0,0));
- tgt.rotateXZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees, core::vector3df(0,0,0));
+ tgt.rotateXYBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateYZBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateXZBy(os::Randomizer::frand() * MaxAngleDegrees);
p.vector = tgt;
}
- if(MaxLifeTime - MinLifeTime == 0)
- p.endTime = now + MinLifeTime;
- else
- p.endTime = now + MinLifeTime + (os::Randomizer::rand() % (MaxLifeTime - MinLifeTime));
+ p.endTime = now + MinLifeTime;
+ if (MaxLifeTime != MinLifeTime)
+ p.endTime += os::Randomizer::rand() % (MaxLifeTime - MinLifeTime);
- p.color = MinStartColor.getInterpolated(
- MaxStartColor, (os::Randomizer::rand() % 100) / 100.0f);
+ if (MinStartColor==MaxStartColor)
+ p.color=MinStartColor;
+ else
+ p.color = MinStartColor.getInterpolated(MaxStartColor, os::Randomizer::frand());
p.startColor = p.color;
p.startVector = p.vector;
@@ -155,8 +147,7 @@ s32 CParticleMeshEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
if (MinStartSize==MaxStartSize)
p.startSize = MinStartSize;
else
- p.startSize = MinStartSize.getInterpolated(
- MaxStartSize, (os::Randomizer::rand() % 100) / 100.0f);
+ p.startSize = MinStartSize.getInterpolated(MaxStartSize, os::Randomizer::frand());
p.size = p.startSize;
Particles.push_back(p);
diff --git a/source/Irrlicht/CParticleMeshEmitter.h b/source/Irrlicht/CParticleMeshEmitter.h
index 3cbb4f35..213d6755 100644
--- a/source/Irrlicht/CParticleMeshEmitter.h
+++ b/source/Irrlicht/CParticleMeshEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -71,10 +71,19 @@ public:
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
//! Set the maximum starting size for particles
- virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; };
+ virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
//! Set the minimum starting size for particles
- virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
+
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Set maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
//! Get Mesh we're emitting particles from
virtual const IMesh* getMesh() const { return Mesh; }
@@ -105,10 +114,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Gets the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Gets the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Get maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
private:
diff --git a/source/Irrlicht/CParticlePointEmitter.cpp b/source/Irrlicht/CParticlePointEmitter.cpp
index 1982ee3a..d86a89e8 100644
--- a/source/Irrlicht/CParticlePointEmitter.cpp
+++ b/source/Irrlicht/CParticlePointEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -40,7 +40,7 @@ s32 CParticlePointEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& out
Time += timeSinceLastCall;
const u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- const f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ const f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
const f32 everyWhatMillisecond = 1000.0f / perSecond;
if (Time > everyWhatMillisecond)
@@ -52,19 +52,20 @@ s32 CParticlePointEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& out
if (MaxAngleDegrees)
{
core::vector3df tgt = Direction;
- tgt.rotateXYBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
- tgt.rotateYZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
- tgt.rotateXZBy((os::Randomizer::rand()%(MaxAngleDegrees*2)) - MaxAngleDegrees);
+ tgt.rotateXYBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateYZBy(os::Randomizer::frand() * MaxAngleDegrees);
+ tgt.rotateXZBy(os::Randomizer::frand() * MaxAngleDegrees);
Particle.vector = tgt;
}
- if (MaxLifeTime - MinLifeTime == 0)
- Particle.endTime = now + MinLifeTime;
- else
- Particle.endTime = now + MinLifeTime + (os::Randomizer::rand() % (MaxLifeTime - MinLifeTime));
+ Particle.endTime = now + MinLifeTime;
+ if (MaxLifeTime != MinLifeTime)
+ Particle.endTime += os::Randomizer::rand() % (MaxLifeTime - MinLifeTime);
- Particle.color = MinStartColor.getInterpolated(
- MaxStartColor, (os::Randomizer::rand() % 100) / 100.0f);
+ if (MinStartColor==MaxStartColor)
+ Particle.color=MinStartColor;
+ else
+ Particle.color = MinStartColor.getInterpolated(MaxStartColor, os::Randomizer::frand());
Particle.startColor = Particle.color;
Particle.startVector = Particle.vector;
@@ -72,8 +73,7 @@ s32 CParticlePointEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& out
if (MinStartSize==MaxStartSize)
Particle.startSize = MinStartSize;
else
- Particle.startSize = MinStartSize.getInterpolated(
- MaxStartSize, (os::Randomizer::rand() % 100) / 100.0f);
+ Particle.startSize = MinStartSize.getInterpolated(MaxStartSize, os::Randomizer::frand());
Particle.size = Particle.startSize;
outArray = &Particle;
@@ -108,10 +108,19 @@ 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");
+ int idx = -1;
+ idx = in->findAttribute("MinStartSizeWidth");
+ if ( idx >= 0 )
+ MinStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MinStartSizeHeight");
+ if ( idx >= 0 )
+ MinStartSize.Height = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeWidth");
+ if ( idx >= 0 )
+ MaxStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeHeight");
+ if ( idx >= 0 )
+ MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
diff --git a/source/Irrlicht/CParticlePointEmitter.h b/source/Irrlicht/CParticlePointEmitter.h
index 4ae94045..e9edc09a 100644
--- a/source/Irrlicht/CParticlePointEmitter.h
+++ b/source/Irrlicht/CParticlePointEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -51,10 +51,19 @@ public:
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
//! Set the maximum starting size for particles
- virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; };
+ virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
//! Set the minimum starting size for particles
- virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
+
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Set maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
//! Gets direction the emitter emits particles.
virtual const core::vector3df& getDirection() const { return Direction; }
@@ -72,10 +81,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Gets the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Gets the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Get maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
//! Writes attributes of the object.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
diff --git a/source/Irrlicht/CParticleRingEmitter.cpp b/source/Irrlicht/CParticleRingEmitter.cpp
index 76566bad..3c1aeb5b 100644
--- a/source/Irrlicht/CParticleRingEmitter.cpp
+++ b/source/Irrlicht/CParticleRingEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -42,7 +42,7 @@ s32 CParticleRingEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
Time += timeSinceLastCall;
u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
f32 everyWhatMillisecond = 1000.0f / perSecond;
if(Time > everyWhatMillisecond)
@@ -57,14 +57,14 @@ s32 CParticleRingEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& outA
for(u32 i=0; igetAttributeAsFloat("MinStartSizeWidth");
- MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
- MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
- MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
+ int idx = -1;
+ idx = in->findAttribute("MinStartSizeWidth");
+ if ( idx >= 0 )
+ MinStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MinStartSizeHeight");
+ if ( idx >= 0 )
+ MinStartSize.Height = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeWidth");
+ if ( idx >= 0 )
+ MaxStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeHeight");
+ if ( idx >= 0 )
+ MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
diff --git a/source/Irrlicht/CParticleRingEmitter.h b/source/Irrlicht/CParticleRingEmitter.h
index 7c2dee6c..d4328dbc 100644
--- a/source/Irrlicht/CParticleRingEmitter.h
+++ b/source/Irrlicht/CParticleRingEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -53,10 +53,19 @@ public:
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
//! Set the maximum starting size for particles
- virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; };
+ virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
//! Set the minimum starting size for particles
- virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
+
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Set maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
//! Set the center of the ring
virtual void setCenter( const core::vector3df& center ) { Center = center; }
@@ -83,10 +92,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Gets the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Gets the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Get maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
//! Get the center of the ring
virtual const core::vector3df& getCenter() const { return Center; }
diff --git a/source/Irrlicht/CParticleRotationAffector.cpp b/source/Irrlicht/CParticleRotationAffector.cpp
index c9fa8f6c..d7a26677 100644
--- a/source/Irrlicht/CParticleRotationAffector.cpp
+++ b/source/Irrlicht/CParticleRotationAffector.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleRotationAffector.h b/source/Irrlicht/CParticleRotationAffector.h
index 9c449579..48ad5960 100644
--- a/source/Irrlicht/CParticleRotationAffector.h
+++ b/source/Irrlicht/CParticleRotationAffector.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CParticleSphereEmitter.cpp b/source/Irrlicht/CParticleSphereEmitter.cpp
index 950eb6de..b2f782a0 100644
--- a/source/Irrlicht/CParticleSphereEmitter.cpp
+++ b/source/Irrlicht/CParticleSphereEmitter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -43,7 +43,7 @@ s32 CParticleSphereEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& ou
Time += timeSinceLastCall;
const u32 pps = (MaxParticlesPerSecond - MinParticlesPerSecond);
- const f32 perSecond = pps ? (f32)MinParticlesPerSecond + (os::Randomizer::rand() % pps) : MinParticlesPerSecond;
+ const f32 perSecond = pps ? ((f32)MinParticlesPerSecond + os::Randomizer::frand() * pps) : MinParticlesPerSecond;
const f32 everyWhatMillisecond = 1000.0f / perSecond;
if(Time > everyWhatMillisecond)
@@ -59,13 +59,13 @@ s32 CParticleSphereEmitter::emitt(u32 now, u32 timeSinceLastCall, SParticle*& ou
for(u32 i=0; igetAttributeAsFloat("MinStartSizeWidth");
- MinStartSize.Height = in->getAttributeAsFloat("MinStartSizeHeight");
- MaxStartSize.Width = in->getAttributeAsFloat("MaxStartSizeWidth");
- MaxStartSize.Height = in->getAttributeAsFloat("MaxStartSizeHeight");
-
+ int idx = -1;
+ idx = in->findAttribute("MinStartSizeWidth");
+ if ( idx >= 0 )
+ MinStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MinStartSizeHeight");
+ if ( idx >= 0 )
+ MinStartSize.Height = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeWidth");
+ if ( idx >= 0 )
+ MaxStartSize.Width = in->getAttributeAsFloat(idx);
+ idx = in->findAttribute("MaxStartSizeHeight");
+ if ( idx >= 0 )
+ MaxStartSize.Height = in->getAttributeAsFloat(idx);
MinParticlesPerSecond = in->getAttributeAsInt("MinParticlesPerSecond");
MaxParticlesPerSecond = in->getAttributeAsInt("MaxParticlesPerSecond");
diff --git a/source/Irrlicht/CParticleSphereEmitter.h b/source/Irrlicht/CParticleSphereEmitter.h
index 5273db45..4c0b326e 100644
--- a/source/Irrlicht/CParticleSphereEmitter.h
+++ b/source/Irrlicht/CParticleSphereEmitter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -53,10 +53,19 @@ public:
virtual void setMaxStartColor( const video::SColor& color ) { MaxStartColor = color; }
//! Set the maximum starting size for particles
- virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; };
+ virtual void setMaxStartSize( const core::dimension2df& size ) { MaxStartSize = size; }
//! Set the minimum starting size for particles
- virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; };
+ virtual void setMinStartSize( const core::dimension2df& size ) { MinStartSize = size; }
+
+ //! Set the minimum particle life-time in milliseconds
+ virtual void setMinLifeTime( u32 lifeTimeMin ) { MinLifeTime = lifeTimeMin; }
+
+ //! Set the maximum particle life-time in milliseconds
+ virtual void setMaxLifeTime( u32 lifeTimeMax ) { MaxLifeTime = lifeTimeMax; }
+
+ //! Set maximal random derivation from the direction
+ virtual void setMaxAngleDegrees( s32 maxAngleDegrees ) { MaxAngleDegrees = maxAngleDegrees; }
//! Set the center of the sphere for particle emissions
virtual void setCenter( const core::vector3df& center ) { Center = center; }
@@ -80,10 +89,19 @@ public:
virtual const video::SColor& getMaxStartColor() const { return MaxStartColor; }
//! Gets the maximum starting size for particles
- virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; };
+ virtual const core::dimension2df& getMaxStartSize() const { return MaxStartSize; }
//! Gets the minimum starting size for particles
- virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; };
+ virtual const core::dimension2df& getMinStartSize() const { return MinStartSize; }
+
+ //! Get the minimum particle life-time in milliseconds
+ virtual u32 getMinLifeTime() const { return MinLifeTime; }
+
+ //! Get the maximum particle life-time in milliseconds
+ virtual u32 getMaxLifeTime() const { return MaxLifeTime; }
+
+ //! Get maximal random derivation from the direction
+ virtual s32 getMaxAngleDegrees() const { return MaxAngleDegrees; }
//! Get the center of the sphere for particle emissions
virtual const core::vector3df& getCenter() const { return Center; }
diff --git a/source/Irrlicht/CParticleSystemSceneNode.cpp b/source/Irrlicht/CParticleSystemSceneNode.cpp
index 88d4c13b..6d17d31d 100644
--- a/source/Irrlicht/CParticleSystemSceneNode.cpp
+++ b/source/Irrlicht/CParticleSystemSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -91,6 +91,11 @@ void CParticleSystemSceneNode::addAffector(IParticleAffector* affector)
AffectorList.push_back(affector);
}
+//! Get a list of all particle affectors.
+const core::list& CParticleSystemSceneNode::getAffectors() const
+{
+ return AffectorList;
+}
//! Removes all particle affectors in the particle system.
void CParticleSystemSceneNode::removeAllAffectors()
@@ -452,7 +457,14 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time)
{
// erase is pretty expensive!
if (now > Particles[i].endTime)
- Particles.erase(i);
+ {
+ // Particle order does not seem to matter.
+ // So we can delete by switching with last particle and deleting that one.
+ // This is a lot faster and speed is very important here as the erase otherwise
+ // can cause noticable freezes.
+ Particles[i] = Particles[Particles.size()-1];
+ Particles.erase( Particles.size()-1 );
+ }
else
{
Particles[i].pos += (Particles[i].vector * scale);
@@ -486,6 +498,11 @@ void CParticleSystemSceneNode::setParticlesAreGlobal(bool global)
ParticlesAreGlobal = global;
}
+//! Remove all currently visible particles
+void CParticleSystemSceneNode::clearParticles()
+{
+ Particles.set_used(0);
+}
//! Sets the size of all particles.
void CParticleSystemSceneNode::setParticleSize(const core::dimension2d &size)
diff --git a/source/Irrlicht/CParticleSystemSceneNode.h b/source/Irrlicht/CParticleSystemSceneNode.h
index 23fde158..74f0bfc7 100644
--- a/source/Irrlicht/CParticleSystemSceneNode.h
+++ b/source/Irrlicht/CParticleSystemSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -42,6 +42,9 @@ public:
//! Adds new particle affector to the particle system.
virtual void addAffector(IParticleAffector* affector);
+ //! Get a list of all particle affectors.
+ virtual const core::list& getAffectors() const;
+
//! Removes all particle affectors in the particle system.
virtual void removeAllAffectors();
@@ -187,6 +190,9 @@ public:
//! ignore it. Default is true.
virtual void setParticlesAreGlobal(bool global=true);
+ //! Remove all currently visible particles
+ virtual void clearParticles();
+
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
diff --git a/source/Irrlicht/CQ3LevelMesh.cpp b/source/Irrlicht/CQ3LevelMesh.cpp
index 4b0f41e8..1f1d5734 100644
--- a/source/Irrlicht/CQ3LevelMesh.cpp
+++ b/source/Irrlicht/CQ3LevelMesh.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -27,9 +27,10 @@ namespace scene
//! constructor
CQ3LevelMesh::CQ3LevelMesh(io::IFileSystem* fs, scene::ISceneManager* smgr,
const Q3LevelLoadParameter &loadParam)
- : LoadParam(loadParam), Textures(0), LightMaps(0),
- Vertices(0), Faces(0), Planes(0), Nodes(0), Leafs(0), LeafFaces(0),
- MeshVerts(0), Brushes(0), FileSystem(fs), SceneManager(smgr)
+ : LoadParam(loadParam), Textures(0), NumTextures(0), LightMaps(0), NumLightMaps(0),
+ Vertices(0), NumVertices(0), Faces(0), NumFaces(0), Planes(0), NumPlanes(0),
+ Nodes(0), NumNodes(0), Leafs(0), NumLeafs(0), LeafFaces(0), NumLeafFaces(0),
+ MeshVerts(0), NumMeshVerts(0), Brushes(0), NumBrushes(0), FileSystem(fs), SceneManager(smgr)
{
#ifdef _DEBUG
IReferenceCounted::setDebugName("CQ3LevelMesh");
@@ -197,6 +198,8 @@ IMesh* CQ3LevelMesh::getMesh(s32 frameInMs, s32 detailLevel, s32 startFrameLoop,
void CQ3LevelMesh::loadTextures(tBSPLump* l, io::IReadFile* file)
{
NumTextures = l->length / sizeof(tBSPTexture);
+ if ( !NumTextures )
+ return;
Textures = new tBSPTexture[NumTextures];
file->seek(l->offset);
@@ -217,6 +220,8 @@ void CQ3LevelMesh::loadTextures(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadLightmaps(tBSPLump* l, io::IReadFile* file)
{
NumLightMaps = l->length / sizeof(tBSPLightmap);
+ if ( !NumLightMaps )
+ return;
LightMaps = new tBSPLightmap[NumLightMaps];
file->seek(l->offset);
@@ -228,6 +233,8 @@ void CQ3LevelMesh::loadLightmaps(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadVerts(tBSPLump* l, io::IReadFile* file)
{
NumVertices = l->length / sizeof(tBSPVertex);
+ if ( !NumVertices )
+ return;
Vertices = new tBSPVertex[NumVertices];
file->seek(l->offset);
@@ -255,6 +262,8 @@ void CQ3LevelMesh::loadVerts(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadFaces(tBSPLump* l, io::IReadFile* file)
{
NumFaces = l->length / sizeof(tBSPFace);
+ if (!NumFaces)
+ return;
Faces = new tBSPFace[NumFaces];
file->seek(l->offset);
@@ -395,6 +404,8 @@ void CQ3LevelMesh::loadModels(tBSPLump* l, io::IReadFile* file)
void CQ3LevelMesh::loadMeshVerts(tBSPLump* l, io::IReadFile* file)
{
NumMeshVerts = l->length / sizeof(s32);
+ if (!NumMeshVerts)
+ return;
MeshVerts = new s32[NumMeshVerts];
file->seek(l->offset);
@@ -718,13 +729,13 @@ s32 CQ3LevelMesh::setShaderMaterial( video::SMaterial &material, const tBSPFace
s32 shaderState = -1;
- if ( face->textureID >= 0 )
+ if ( face->textureID >= 0 && face->textureID < (s32)Tex.size() )
{
material.setTexture(0, Tex [ face->textureID ].Texture);
shaderState = Tex [ face->textureID ].ShaderID;
}
- if ( face->lightmapID >= 0 )
+ if ( face->lightmapID >= 0 && face->lightmapID < (s32)Lightmap.size() )
{
material.setTexture(1, Lightmap [ face->lightmapID ]);
material.MaterialType = LoadParam.defaultLightMapMaterial;
@@ -1834,7 +1845,7 @@ void CQ3LevelMesh::loadTextures()
s32 t;
// load lightmaps.
- Lightmap.set_used(NumLightMaps+1);
+ Lightmap.set_used(NumLightMaps);
/*
bool oldMipMapState = Driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
@@ -1859,7 +1870,7 @@ void CQ3LevelMesh::loadTextures()
// Driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
// load textures
- Tex.set_used( NumTextures+1 );
+ Tex.set_used( NumTextures );
const IShader* shader;
diff --git a/source/Irrlicht/CQ3LevelMesh.h b/source/Irrlicht/CQ3LevelMesh.h
index 9d58319e..f829dd3c 100644
--- a/source/Irrlicht/CQ3LevelMesh.h
+++ b/source/Irrlicht/CQ3LevelMesh.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CQuake3ShaderSceneNode.cpp b/source/Irrlicht/CQuake3ShaderSceneNode.cpp
index 10e4999e..d40092a5 100644
--- a/source/Irrlicht/CQuake3ShaderSceneNode.cpp
+++ b/source/Irrlicht/CQuake3ShaderSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Thomas Alten / Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Thomas Alten / Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CQuake3ShaderSceneNode.h b/source/Irrlicht/CQuake3ShaderSceneNode.h
index 83089d9a..9bcc1af2 100644
--- a/source/Irrlicht/CQuake3ShaderSceneNode.h
+++ b/source/Irrlicht/CQuake3ShaderSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten
+// Copyright (C) 2002-2011 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CReadFile.cpp b/source/Irrlicht/CReadFile.cpp
index b0d1a5b8..501168f2 100644
--- a/source/Irrlicht/CReadFile.cpp
+++ b/source/Irrlicht/CReadFile.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CReadFile.h b/source/Irrlicht/CReadFile.h
index aca25112..708bc944 100644
--- a/source/Irrlicht/CReadFile.h
+++ b/source/Irrlicht/CReadFile.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSTLMeshFileLoader.cpp b/source/Irrlicht/CSTLMeshFileLoader.cpp
index 720d6812..0ee62e9d 100644
--- a/source/Irrlicht/CSTLMeshFileLoader.cpp
+++ b/source/Irrlicht/CSTLMeshFileLoader.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSTLMeshFileLoader.h b/source/Irrlicht/CSTLMeshFileLoader.h
index fc8280c9..4bb855bf 100644
--- a/source/Irrlicht/CSTLMeshFileLoader.h
+++ b/source/Irrlicht/CSTLMeshFileLoader.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2009 Christian Stehno
+// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSTLMeshWriter.cpp b/source/Irrlicht/CSTLMeshWriter.cpp
index f705cc1c..93add5c5 100644
--- a/source/Irrlicht/CSTLMeshWriter.cpp
+++ b/source/Irrlicht/CSTLMeshWriter.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSTLMeshWriter.h b/source/Irrlicht/CSTLMeshWriter.h
index 017d0eb3..ba9981ae 100644
--- a/source/Irrlicht/CSTLMeshWriter.h
+++ b/source/Irrlicht/CSTLMeshWriter.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneCollisionManager.cpp b/source/Irrlicht/CSceneCollisionManager.cpp
index 123395a0..98c080f2 100644
--- a/source/Irrlicht/CSceneCollisionManager.cpp
+++ b/source/Irrlicht/CSceneCollisionManager.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -303,7 +303,7 @@ void CSceneCollisionManager::getPickedNodeFromBBAndSelector(
core::triangle3df candidateTriangle;
// do intersection test in object space
- const ISceneNode * hitNode = 0;
+ ISceneNode * hitNode = 0;
if (box.intersectsWithLine(line) &&
getCollisionPoint(ray, selector, candidateCollisionPoint, candidateTriangle, hitNode))
{
@@ -349,7 +349,7 @@ ISceneNode* CSceneCollisionManager::getSceneNodeFromCameraBB(
bool CSceneCollisionManager::getCollisionPoint(const core::line3d& ray,
ITriangleSelector* selector, core::vector3df& outIntersection,
core::triangle3df& outTriangle,
- const ISceneNode*& outNode)
+ ISceneNode*& outNode)
{
if (!selector)
{
@@ -423,7 +423,7 @@ core::vector3df CSceneCollisionManager::getCollisionResultPosition(
core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
- const ISceneNode*& outNode,
+ ISceneNode*& outNode,
f32 slidingSpeed,
const core::vector3df& gravity)
{
@@ -691,7 +691,7 @@ core::vector3df CSceneCollisionManager::collideEllipsoidWithWorld(
core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
- const ISceneNode*& outNode)
+ ISceneNode*& outNode)
{
if (!selector || radius.X == 0.0f || radius.Y == 0.0f || radius.Z == 0.0f)
return position;
@@ -874,7 +874,7 @@ core::line3d CSceneCollisionManager::getRayFromScreenCoordinates(
//! Calculates 2d screen position from a 3d position.
core::position2d CSceneCollisionManager::getScreenCoordinatesFrom3DPosition(
- const core::vector3df & pos3d, ICameraSceneNode* camera)
+ const core::vector3df & pos3d, ICameraSceneNode* camera, bool useViewPort)
{
if (!SceneManager || !Driver)
return core::position2d(-1000,-1000);
@@ -885,8 +885,11 @@ core::position2d CSceneCollisionManager::getScreenCoordinatesFrom3DPosition
if (!camera)
return core::position2d(-1000,-1000);
- const core::rect& viewPort = Driver->getViewPort();
- core::dimension2d dim(viewPort.getWidth(), viewPort.getHeight());
+ core::dimension2d dim;
+ if (useViewPort)
+ dim.set(Driver->getViewPort().getWidth(), Driver->getViewPort().getHeight());
+ else
+ dim=(Driver->getScreenSize());
dim.Width /= 2;
dim.Height /= 2;
@@ -905,7 +908,7 @@ core::position2d CSceneCollisionManager::getScreenCoordinatesFrom3DPosition
core::reciprocal(transformedPos[3]);
return core::position2d(
- core::round32(dim.Width * transformedPos[0] * zDiv) + dim.Width,
+ dim.Width + core::round32(dim.Width * (transformedPos[0] * zDiv)),
dim.Height - core::round32(dim.Height * (transformedPos[1] * zDiv)));
}
diff --git a/source/Irrlicht/CSceneCollisionManager.h b/source/Irrlicht/CSceneCollisionManager.h
index 7b13c8b9..5d1eb27b 100644
--- a/source/Irrlicht/CSceneCollisionManager.h
+++ b/source/Irrlicht/CSceneCollisionManager.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -45,7 +45,7 @@ namespace scene
virtual bool getCollisionPoint(const core::line3d& ray,
ITriangleSelector* selector, core::vector3df& outCollisionPoint,
core::triangle3df& outTriangle,
- const ISceneNode* & outNode);
+ ISceneNode* & outNode);
//! Collides a moving ellipsoid with a 3d world with gravity and returns
//! the resulting new position of the ellipsoid.
@@ -57,7 +57,7 @@ namespace scene
core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
- const ISceneNode*& outNode,
+ ISceneNode*& outNode,
f32 slidingSpeed,
const core::vector3df& gravityDirectionAndSpeed);
@@ -67,7 +67,7 @@ namespace scene
//! Calculates 2d screen position from a 3d position.
virtual core::position2d getScreenCoordinatesFrom3DPosition(
- const core::vector3df & pos, ICameraSceneNode* camera=0);
+ const core::vector3df & pos, ICameraSceneNode* camera=0, bool useViewPort=false);
//! Gets the scene node and nearest collision point for a ray based on
//! the nodes' id bitmasks, bounding boxes and triangle selectors.
@@ -138,7 +138,7 @@ namespace scene
const core::vector3df& gravity, core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
- const ISceneNode*& outNode);
+ ISceneNode*& outNode);
core::vector3df collideWithWorld(s32 recursionDepth, SCollisionData &colData,
core::vector3df pos, core::vector3df vel);
diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp
index 56efe516..fe3423d1 100644
--- a/source/Irrlicht/CSceneManager.cpp
+++ b/source/Irrlicht/CSceneManager.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -291,6 +291,12 @@ CSceneManager::~CSceneManager()
{
clearDeletionList();
+ //! force to remove hardwareTextures from the driver
+ //! because Scenes may hold internally data bounded to sceneNodes
+ //! which may be destroyed twice
+ if (Driver)
+ Driver->removeAllHardwareBuffers ();
+
if (FileSystem)
FileSystem->drop();
@@ -324,12 +330,6 @@ CSceneManager::~CSceneManager()
for (i=0; idrop();
- //! force to remove hardwareTextures from the driver
- //! because Scenes may hold internally data bounded to sceneNodes
- //! which may be destroyed twice
- if (Driver)
- Driver->removeAllHardwareBuffers ();
-
if(LightManager)
LightManager->drop();
@@ -588,9 +588,6 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight,
ISceneNode* parent, s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{
- if (!mesh)
- return 0;
-
if (!parent)
parent = this;
@@ -963,9 +960,10 @@ IAnimatedMesh* CSceneManager::addTerrainMesh(const io::path& name,
if (MeshCache->isMeshLoaded(name))
return MeshCache->getMeshByName(name);
+ const bool debugBorders=false;
IMesh* mesh = GeometryCreator->createTerrainMesh(texture, heightmap,
stretchSize, maxHeight, getVideoDriver(),
- defaultVertexBlockSize);
+ defaultVertexBlockSize, debugBorders);
if (!mesh)
return 0;
@@ -2040,13 +2038,13 @@ ISceneNodeAnimatorFactory* CSceneManager::getSceneNodeAnimatorFactory(u32 index)
//! Saves the current scene into a file.
//! \param filename: Name of the file .
-bool CSceneManager::saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer)
+bool CSceneManager::saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)
{
bool ret = false;
io::IWriteFile* file = FileSystem->createAndWriteFile(filename);
if (file)
{
- ret = saveScene(file, userDataSerializer);
+ ret = saveScene(file, userDataSerializer, node);
file->drop();
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
@@ -2055,7 +2053,7 @@ bool CSceneManager::saveScene(const io::path& filename, ISceneUserDataSerializer
//! Saves the current scene into a file.
-bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer)
+bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)
{
if (!file)
{
@@ -2069,9 +2067,11 @@ bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* us
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
+ if (!node)
+ node=this;
writer->writeXMLHeader();
- writeSceneNode(writer, this, userDataSerializer);
+ writeSceneNode(writer, node, userDataSerializer, FileSystem->getFileDir(FileSystem->getAbsolutePath(file->getFileName())).c_str(), true);
writer->drop();
return true;
@@ -2080,7 +2080,7 @@ bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* us
//! Loads a scene. Note that the current scene is not cleared before.
//! \param filename: Name of the file .
-bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer)
+bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)
{
bool ret = false;
io::IReadFile* read = FileSystem->createAndOpenFile(filename);
@@ -2090,7 +2090,7 @@ bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer
}
else
{
- ret = loadScene(read, userDataSerializer);
+ ret = loadScene(read, userDataSerializer, node);
read->drop();
}
@@ -2100,7 +2100,7 @@ bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer
//! Loads a scene. Note that the current scene is not cleared before.
-bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer)
+bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)
{
if (!file)
{
@@ -2126,7 +2126,7 @@ bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* use
while(reader->read())
{
- readSceneNode(reader, 0, userDataSerializer);
+ readSceneNode(reader, node, userDataSerializer);
}
// restore old collada parameters
@@ -2148,8 +2148,16 @@ void CSceneManager::readSceneNode(io::IXMLReader* reader, ISceneNode* parent, IS
scene::ISceneNode* node = 0;
- if (!parent && IRR_XML_FORMAT_SCENE==reader->getNodeName())
- node = this; // root
+ bool readAttributes=true;
+ if (IRR_XML_FORMAT_SCENE==reader->getNodeName())
+ {
+ // node==parent on start, which can be scene manager or distinct parent node
+ if (!parent)
+ node = this; // root
+ else
+ node = parent;
+ readAttributes = (node==this);
+ }
else if (parent && IRR_XML_FORMAT_NODE==reader->getNodeName())
{
// find node type and create it
@@ -2159,7 +2167,10 @@ void CSceneManager::readSceneNode(io::IXMLReader* reader, ISceneNode* parent, IS
node = SceneNodeFactoryList[i]->addSceneNode(attrName.c_str(), parent);
if (!node)
+ {
os::Printer::log("Could not create scene node of unknown type", attrName.c_str());
+ node=addEmptySceneNode(parent);
+ }
}
// read attributes
@@ -2177,7 +2188,7 @@ void CSceneManager::readSceneNode(io::IXMLReader* reader, ISceneNode* parent, IS
}
break;
case io::EXN_ELEMENT:
- if (core::stringw(L"attributes")==reader->getNodeName())
+ if ((core::stringw(L"attributes")==reader->getNodeName()) && readAttributes)
{
// read attributes
io::IAttributes* attr = FileSystem->createEmptyAttributes(Driver);
@@ -2189,21 +2200,26 @@ void CSceneManager::readSceneNode(io::IXMLReader* reader, ISceneNode* parent, IS
attr->drop();
}
else
- if (core::stringw(L"materials")==reader->getNodeName())
+ if ((core::stringw(L"materials")==reader->getNodeName()) && readAttributes)
readMaterials(reader, node);
else
- if (core::stringw(L"animators")==reader->getNodeName())
+ if ((core::stringw(L"animators")==reader->getNodeName()) && readAttributes)
readAnimators(reader, node);
else
- if (core::stringw(L"userData")==reader->getNodeName())
+ if ((core::stringw(L"userData")==reader->getNodeName()) && readAttributes)
readUserData(reader, node, userDataSerializer);
else
- if ((IRR_XML_FORMAT_NODE==reader->getNodeName()) ||
- (IRR_XML_FORMAT_SCENE==reader->getNodeName()))
+ if (IRR_XML_FORMAT_NODE==reader->getNodeName())
{
readSceneNode(reader, node, userDataSerializer);
}
else
+ if (IRR_XML_FORMAT_SCENE==reader->getNodeName())
+ {
+ // pass on parent value
+ readSceneNode(reader, parent, userDataSerializer);
+ }
+ else
{
os::Printer::log("Found unknown element in irrlicht scene file",
core::stringc(reader->getNodeName()).c_str());
@@ -2341,17 +2357,20 @@ void CSceneManager::readUserData(io::IXMLReader* reader, ISceneNode* node, IScen
//! writes a scene node
-void CSceneManager::writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer)
+void CSceneManager::writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer,
+ const c8* currentPath, bool init)
{
if (!writer || !node || node->isDebugObject())
return;
const wchar_t* name;
+ ISceneNode* tmpNode=node;
- if (node == this)
+ if (init)
{
name = IRR_XML_FORMAT_SCENE.c_str();
writer->writeElement(name, false);
+ node=this;
}
else
{
@@ -2360,13 +2379,18 @@ void CSceneManager::writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISc
core::stringw(getSceneNodeTypeName(node->getType())).c_str());
}
- writer->writeLineBreak();
writer->writeLineBreak();
// write properties
io::IAttributes* attr = FileSystem->createEmptyAttributes(Driver);
- node->serializeAttributes(attr);
+ io::SAttributeReadWriteOptions options;
+ if (currentPath)
+ {
+ options.Filename=currentPath;
+ options.Flags|=io::EARWF_USE_RELATIVE_PATHS;
+ }
+ node->serializeAttributes(attr, &options);
if (attr->getAttributeCount() != 0)
{
@@ -2440,12 +2464,22 @@ void CSceneManager::writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISc
userData->drop();
}
}
+ // reset to actual root node
+ if (init)
+ node=tmpNode;
- // write children
-
- ISceneNodeList::ConstIterator it = node->getChildren().begin();
- for (; it != node->getChildren().end(); ++it)
- writeSceneNode(writer, (*it), userDataSerializer);
+ // write children once root node is written
+ // if parent is not scene manager, we need to write out node first
+ if (init && (node != this))
+ {
+ writeSceneNode(writer, node, userDataSerializer, currentPath);
+ }
+ else
+ {
+ ISceneNodeList::ConstIterator it = node->getChildren().begin();
+ for (; it != node->getChildren().end(); ++it)
+ writeSceneNode(writer, (*it), userDataSerializer, currentPath);
+ }
attr->drop();
diff --git a/source/Irrlicht/CSceneManager.h b/source/Irrlicht/CSceneManager.h
index cd85d269..3fb8833c 100644
--- a/source/Irrlicht/CSceneManager.h
+++ b/source/Irrlicht/CSceneManager.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -216,8 +216,9 @@ namespace scene
//! Adds a terrain mesh to the mesh pool.
virtual IAnimatedMesh* addTerrainMesh(const io::path& meshname, video::IImage* texture, video::IImage* heightmap,
- const core::dimension2d& stretchSize,
- f32 maxHeight, const core::dimension2d& defaultVertexBlockSize);
+ const core::dimension2d& stretchSize = core::dimension2d(10.0f,10.0f),
+ f32 maxHeight=200.0f,
+ const core::dimension2d& defaultVertexBlockSize = core::dimension2d(64,64));
//! Add a arrow mesh to the mesh pool
virtual IAnimatedMesh* addArrowMesh(const io::path& name,
@@ -456,17 +457,17 @@ namespace scene
//! Saves the current scene into a file.
//! \param filename: Name of the file .
- virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0);
+ virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Saves the current scene into a file.
- virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0);
+ virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Loads a scene. Note that the current scene is not cleared before.
//! \param filename: Name of the file .
- virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0);
+ virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Loads a scene. Note that the current scene is not cleared before.
- virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0);
+ virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0);
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
@@ -501,7 +502,7 @@ namespace scene
void clearDeletionList();
//! writes a scene node
- void writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer);
+ void writeSceneNode(io::IXMLWriter* writer, ISceneNode* node, ISceneUserDataSerializer* userDataSerializer, const c8* currentPath=0, bool init=false);
//! reads a scene node
void readSceneNode(io::IXMLReader* reader, ISceneNode* parent, ISceneUserDataSerializer* userDataSerializer);
diff --git a/source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp b/source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
index c35aa6c6..f41d0225 100644
--- a/source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorCameraFPS.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h b/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
index ca64c75b..781fdb57 100644
--- a/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
+++ b/source/Irrlicht/CSceneNodeAnimatorCameraFPS.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp b/source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
index d00c4282..60d1ad89 100644
--- a/source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorCameraMaya.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h b/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h
index e91c5fdf..d46bbf89 100644
--- a/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h
+++ b/source/Irrlicht/CSceneNodeAnimatorCameraMaya.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp b/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
index d1948385..42924b22 100644
--- a/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -23,7 +23,7 @@ CSceneNodeAnimatorCollisionResponse::CSceneNodeAnimatorCollisionResponse(
f32 slidingSpeed)
: Radius(ellipsoidRadius), Gravity(gravityPerSecond), Translation(ellipsoidTranslation),
World(world), Object(object), SceneManager(scenemanager), LastTime(0),
- SlidingSpeed(slidingSpeed), CollisionCallback(0),
+ SlidingSpeed(slidingSpeed), CollisionNode(0), CollisionCallback(0),
Falling(false), IsCamera(false), AnimateCameraTarget(true), CollisionOccurred(false),
FirstUpdate(true)
{
diff --git a/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h b/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h
index f8d8e8ec..19703af7 100644
--- a/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h
+++ b/source/Irrlicht/CSceneNodeAnimatorCollisionResponse.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -110,7 +110,7 @@ namespace scene
virtual const core::vector3df & getCollisionResultPosition(void) const { return CollisionResultPosition; }
- virtual const ISceneNode* getCollisionNode(void) const { return CollisionNode; }
+ virtual ISceneNode* getCollisionNode(void) const { return CollisionNode; }
//! Sets a callback interface which will be called if a collision occurs.
@@ -140,7 +140,7 @@ namespace scene
core::vector3df CollisionPoint;
core::triangle3df CollisionTriangle;
core::vector3df CollisionResultPosition;
- const ISceneNode * CollisionNode;
+ ISceneNode * CollisionNode;
ICollisionCallback* CollisionCallback;
bool Falling;
diff --git a/source/Irrlicht/CSceneNodeAnimatorDelete.cpp b/source/Irrlicht/CSceneNodeAnimatorDelete.cpp
index 2925ab9b..012b04c0 100644
--- a/source/Irrlicht/CSceneNodeAnimatorDelete.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorDelete.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorDelete.h b/source/Irrlicht/CSceneNodeAnimatorDelete.h
index 42332bcd..03cb8d43 100644
--- a/source/Irrlicht/CSceneNodeAnimatorDelete.h
+++ b/source/Irrlicht/CSceneNodeAnimatorDelete.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp
index 6cebaa06..994b8d80 100644
--- a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h
index 3b6826da..c66b91e5 100644
--- a/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h
+++ b/source/Irrlicht/CSceneNodeAnimatorFlyCircle.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp b/source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
index 79b74344..1b1d23dc 100644
--- a/source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorFlyStraight.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorFlyStraight.h b/source/Irrlicht/CSceneNodeAnimatorFlyStraight.h
index 673b8f85..5e09a75e 100644
--- a/source/Irrlicht/CSceneNodeAnimatorFlyStraight.h
+++ b/source/Irrlicht/CSceneNodeAnimatorFlyStraight.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp b/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
index 59ad26b0..f6ec9c75 100644
--- a/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorFollowSpline.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorFollowSpline.h b/source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
index a2de040f..1a50de97 100644
--- a/source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
+++ b/source/Irrlicht/CSceneNodeAnimatorFollowSpline.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorRotation.cpp b/source/Irrlicht/CSceneNodeAnimatorRotation.cpp
index 3f5592b1..c6eaf5b4 100644
--- a/source/Irrlicht/CSceneNodeAnimatorRotation.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorRotation.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorRotation.h b/source/Irrlicht/CSceneNodeAnimatorRotation.h
index ced74659..be98f1cf 100644
--- a/source/Irrlicht/CSceneNodeAnimatorRotation.h
+++ b/source/Irrlicht/CSceneNodeAnimatorRotation.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorTexture.cpp b/source/Irrlicht/CSceneNodeAnimatorTexture.cpp
index 9901afa6..d09df204 100644
--- a/source/Irrlicht/CSceneNodeAnimatorTexture.cpp
+++ b/source/Irrlicht/CSceneNodeAnimatorTexture.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSceneNodeAnimatorTexture.h b/source/Irrlicht/CSceneNodeAnimatorTexture.h
index 04e9fec5..b1a51886 100644
--- a/source/Irrlicht/CSceneNodeAnimatorTexture.h
+++ b/source/Irrlicht/CSceneNodeAnimatorTexture.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CShadowVolumeSceneNode.cpp b/source/Irrlicht/CShadowVolumeSceneNode.cpp
index d1cda6c1..726ae739 100644
--- a/source/Irrlicht/CShadowVolumeSceneNode.cpp
+++ b/source/Irrlicht/CShadowVolumeSceneNode.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CShadowVolumeSceneNode.h b/source/Irrlicht/CShadowVolumeSceneNode.h
index eeb26a96..e3b8853a 100644
--- a/source/Irrlicht/CShadowVolumeSceneNode.h
+++ b/source/Irrlicht/CShadowVolumeSceneNode.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
diff --git a/source/Irrlicht/CSkinnedMesh.cpp b/source/Irrlicht/CSkinnedMesh.cpp
index b5032797..a100e371 100644
--- a/source/Irrlicht/CSkinnedMesh.cpp
+++ b/source/Irrlicht/CSkinnedMesh.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2002-2009 Nikolaus Gebhardt
+// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
@@ -18,11 +18,10 @@ namespace scene
//! constructor
CSkinnedMesh::CSkinnedMesh()
-: SkinningBuffers(0), AnimationFrames(0.f),
- LastAnimatedFrame(0.f), LastSkinnedFrame(0.f),
- InterpolationMode(EIM_LINEAR),
+: SkinningBuffers(0), AnimationFrames(0.f), FramesPerSecond(25.f),
+ LastAnimatedFrame(0.f), InterpolationMode(EIM_LINEAR),
HasAnimation(false), PreparedForSkinning(false),
- BoneControlUsed(false), AnimateNormals(true), HardwareSkinning(false)
+ AnimateNormals(true), HardwareSkinning(false)
{
#ifdef _DEBUG
setDebugName("CSkinnedMesh");
@@ -54,6 +53,23 @@ u32 CSkinnedMesh::getFrameCount() const
}
+//! Gets the default animation speed of the animated mesh.
+/** \return Amount of frames per second. If the amount is 0, it is a static, non animated mesh. */
+f32 CSkinnedMesh::getAnimationSpeed() const
+{
+ return FramesPerSecond;
+}
+
+
+//! Gets the frame count of the animated mesh.
+/** \param fps Frames per second to play the animation with. If the amount is 0, it is not animated.
+The actual speed is set in the scene node the mesh is instantiated in.*/
+void CSkinnedMesh::setAnimationSpeed(f32 fps)
+{
+ FramesPerSecond=fps;
+}
+
+
//! returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail. Note, that some Meshes will ignore the detail level.
IMesh* CSkinnedMesh::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
{
@@ -125,14 +141,14 @@ void CSkinnedMesh::animateMesh(f32 frame, f32 blend)
//----------------
// Temp!
- buildAll_LocalAnimatedMatrices();
+ buildAllLocalAnimatedMatrices();
//-----------------
updateBoundingBox();
}
-void CSkinnedMesh::buildAll_LocalAnimatedMatrices()
+void CSkinnedMesh::buildAllLocalAnimatedMatrices()
{
for (u32 i=0; i