Commit 451d5bca authored by hybrid's avatar hybrid

Merged from 1.4 branch revisions 1251:1271

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1272 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 89aa5dab
...@@ -14,11 +14,11 @@ namespace scene ...@@ -14,11 +14,11 @@ namespace scene
{ {
//! Scene node which is a dynamic light. //! Scene node which is a dynamic light.
/** You can switch the light on and off by /** You can switch the light on and off by making it visible or not. It can be
making it visible or not, and let it be animated by ordinary scene node animators. animated by ordinary scene node animators.
If you set the light type to be directional, you will need to set the direction of the If the light type is directional or spot, the direction of the light source
light source manually in the SLight structure, the position of the scene node will have no is defined by the rotation of the scene node (assuming (0,0,1) as the local
effect on this direction. direction of the light).
*/ */
class ILightSceneNode : public ISceneNode class ILightSceneNode : public ISceneNode
{ {
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
: ISceneNode(parent, mgr, id, position) {} : ISceneNode(parent, mgr, id, position) {}
//! Sets the light data associated with this ILightSceneNode //! Sets the light data associated with this ILightSceneNode
//! \param light The new light data.
virtual void setLightData(const video::SLight& light) = 0; virtual void setLightData(const video::SLight& light) = 0;
//! Gets the light data associated with this ILightSceneNode //! Gets the light data associated with this ILightSceneNode
......
...@@ -25,11 +25,13 @@ namespace irr ...@@ -25,11 +25,13 @@ namespace irr
namespace scene namespace scene
{ {
//! Scene node interface. //! Scene node interface.
/** A scene node is a node in the hirachical scene graph. Every scene node may have children, /** A scene node is a node in the hierarchical scene graph. Every scene
which are other scene nodes. Children move relative the their parents position. If the parent of a node is not node may have children, which are also scene nodes. Children move
visible, its children won't be visible too. In this way, it is for example easily possible relative to their parent's position. If the parent of a node is not
to attach a light to a moving car, or to place a walking character on a moving platform visible, its children won't be visible either. In this way, it is for
on a moving ship. */ example easily possible to attach a light to a moving car, or to place
a walking character on a moving platform on a moving ship.
*/
class ISceneNode : virtual public io::IAttributeExchangingObject class ISceneNode : virtual public io::IAttributeExchangingObject
{ {
public: public:
...@@ -70,8 +72,8 @@ namespace scene ...@@ -70,8 +72,8 @@ namespace scene
//! This method is called just before the rendering process of the whole scene. //! This method is called just before the rendering process of the whole scene.
/** Nodes may register themselves in the render pipeline during this call, /** Nodes may register themselves in the render pipeline during this call,
precalculate the geometry which should be renderered, and prevent their precalculate the geometry which should be renderered, and prevent their
children from being able to register them selfes if they are clipped by simply children from being able to register themselves if they are clipped by simply
not calling their OnRegisterSceneNode-Method. not calling their OnRegisterSceneNode method.
If you are implementing your own scene node, you should overwrite this method If you are implementing your own scene node, you should overwrite this method
with an implementation code looking like this: with an implementation code looking like this:
\code \code
...@@ -94,10 +96,10 @@ namespace scene ...@@ -94,10 +96,10 @@ namespace scene
//! OnAnimate() is called just before rendering the whole scene. //! OnAnimate() is called just before rendering the whole scene.
//! Nodes may calculate or store animations here, and may do other useful things, //! Nodes may calculate or store animations here, and may do other useful things,
//! dependent on what they are. Also, OnAnimate() should be called for all //! depending on what they are. Also, OnAnimate() should be called for all
//! child scene nodes here. This method will be called once per frame, independent //! child scene nodes here. This method will be called once per frame, independent
//! of if the scene node is visible or not. //! of whether the scene node is visible or not.
//! \param timeMs: Current time in milliseconds. //! \param timeMs Current time in milliseconds.
virtual void OnAnimate(u32 timeMs) virtual void OnAnimate(u32 timeMs)
{ {
if (IsVisible) if (IsVisible)
...@@ -125,7 +127,7 @@ namespace scene ...@@ -125,7 +127,7 @@ namespace scene
//! Returns the name of the node. //! Returns the name of the node.
//! \return Returns name as wide character string. //! \return Name as character string.
virtual const c8* getName() const virtual const c8* getName() const
{ {
return Name.c_str(); return Name.c_str();
...@@ -133,7 +135,7 @@ namespace scene ...@@ -133,7 +135,7 @@ namespace scene
//! Sets the name of the node. //! Sets the name of the node.
//! \param name: New name of the scene node. //! \param name New name of the scene node.
virtual void setName(const c8* name) virtual void setName(const c8* name)
{ {
Name = name; Name = name;
...@@ -141,16 +143,18 @@ namespace scene ...@@ -141,16 +143,18 @@ namespace scene
//! Returns the axis aligned, not transformed bounding box of this node. //! Returns the axis aligned, not transformed bounding box of this node.
//! This means that if this node is a animated 3d character, moving in a room, //! This means that if this node is an animated 3d character, moving in a room,
//! the bounding box will always be around the origin. To get the box in //! the bounding box will always be around the origin. To get the box in
//! real world coordinates, just transform it with the matrix you receive with //! real world coordinates, just transform it with the matrix you receive with
//! getAbsoluteTransformation() or simply use getTransformedBoundingBox(), //! getAbsoluteTransformation() or simply use getTransformedBoundingBox(),
//! which does the same. //! which does the same.
//! \return The non-transformed bounding box.
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0; virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! Returns the axis aligned, transformed and animated absolute bounding box //! Returns the axis aligned, transformed and animated absolute bounding box
//! of this node. //! of this node.
//! \return The transformed bounding box.
virtual const core::aabbox3d<f32> getTransformedBoundingBox() const virtual const core::aabbox3d<f32> getTransformedBoundingBox() const
{ {
core::aabbox3d<f32> box = getBoundingBox(); core::aabbox3d<f32> box = getBoundingBox();
...@@ -160,6 +164,7 @@ namespace scene ...@@ -160,6 +164,7 @@ namespace scene
//! returns the absolute transformation of the node. Is recalculated every OnAnimate()-call. //! returns the absolute transformation of the node. Is recalculated every OnAnimate()-call.
//! \return The absolute transformation matrix.
virtual const core::matrix4& getAbsoluteTransformation() const virtual const core::matrix4& getAbsoluteTransformation() const
{ {
return AbsoluteTransformation; return AbsoluteTransformation;
...@@ -170,14 +175,14 @@ namespace scene ...@@ -170,14 +175,14 @@ namespace scene
//! The relative transformation is stored internally as 3 vectors: //! The relative transformation is stored internally as 3 vectors:
//! translation, rotation and scale. To get the relative transformation //! translation, rotation and scale. To get the relative transformation
//! matrix, it is calculated from these values. //! matrix, it is calculated from these values.
//! \return Returns the relative transformation matrix. //! \return The relative transformation matrix.
virtual core::matrix4 getRelativeTransformation() const virtual core::matrix4 getRelativeTransformation() const
{ {
core::matrix4 mat; core::matrix4 mat;
mat.setRotationDegrees(RelativeRotation); mat.setRotationDegrees(RelativeRotation);
mat.setTranslation(RelativeTranslation); mat.setTranslation(RelativeTranslation);
if (RelativeScale != core::vector3df(1,1,1)) if (RelativeScale != core::vector3df(1.f,1.f,1.f))
{ {
core::matrix4 smat; core::matrix4 smat;
smat.setScale(RelativeScale); smat.setScale(RelativeScale);
...@@ -188,8 +193,9 @@ namespace scene ...@@ -188,8 +193,9 @@ namespace scene
} }
//! Returns true if the node is visible. This is only an option, set by the user and has //! Returns true if the node is visible. This is only an option
//! nothing to do with geometry culling //! set by the user, but has nothing to do with geometry culling
//! \return The visibility of the node, true means visible.
virtual bool isVisible() const virtual bool isVisible() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
...@@ -197,7 +203,8 @@ namespace scene ...@@ -197,7 +203,8 @@ namespace scene
} }
//! Sets if the node should be visible or not. All children of this node won't be visible too. //! Sets if the node should be visible or not. All children of this node won't be visible either, when set to true.
//! \param isVisisble If the node shall be visible.
virtual void setVisible(bool isVisible) virtual void setVisible(bool isVisible)
{ {
IsVisible = isVisible; IsVisible = isVisible;
...@@ -205,13 +212,15 @@ namespace scene ...@@ -205,13 +212,15 @@ namespace scene
//! Returns the id of the scene node. This id can be used to identify the node. //! Returns the id of the scene node. This id can be used to identify the node.
//! \return The id.
virtual s32 getID() const virtual s32 getID() const
{ {
return ID; return ID;
} }
//! sets the id of the scene node. This id can be used to identify the node. //! Sets the id of the scene node. This id can be used to identify the node.
//! \param id The new id.
virtual void setID(s32 id) virtual void setID(s32 id)
{ {
ID = id; ID = id;
...@@ -219,7 +228,8 @@ namespace scene ...@@ -219,7 +228,8 @@ namespace scene
//! Adds a child to this scene node. If the scene node already //! Adds a child to this scene node. If the scene node already
//! has got a parent, it is removed from there as child. //! has a parent it is first removed from the other parent.
//! \param child A pointer to the new child.
virtual void addChild(ISceneNode* child) virtual void addChild(ISceneNode* child)
{ {
if (child && (child != this)) if (child && (child != this))
...@@ -233,7 +243,8 @@ namespace scene ...@@ -233,7 +243,8 @@ namespace scene
//! Removes a child from this scene node. //! Removes a child from this scene node.
//! \return Returns true if the child could be removed, and false if not. //! \param child A pointer to the new child.
//! \return True if the child could be removed, and false if not.
virtual bool removeChild(ISceneNode* child) virtual bool removeChild(ISceneNode* child)
{ {
core::list<ISceneNode*>::Iterator it = Children.begin(); core::list<ISceneNode*>::Iterator it = Children.begin();
...@@ -274,6 +285,7 @@ namespace scene ...@@ -274,6 +285,7 @@ namespace scene
//! Adds an animator which should animate this node. //! Adds an animator which should animate this node.
//! \param animator A pointer to the new animator.
virtual void addAnimator(ISceneNodeAnimator* animator) virtual void addAnimator(ISceneNodeAnimator* animator)
{ {
if (animator) if (animator)
...@@ -285,6 +297,7 @@ namespace scene ...@@ -285,6 +297,7 @@ namespace scene
//! Returns a const reference to the list of all scene node animators. //! Returns a const reference to the list of all scene node animators.
//! \return The list of animators attached to this node.
const core::list<ISceneNodeAnimator*>& getAnimators() const const core::list<ISceneNodeAnimator*>& getAnimators() const
{ {
return Animators; return Animators;
...@@ -292,6 +305,7 @@ namespace scene ...@@ -292,6 +305,7 @@ namespace scene
//! Removes an animator from this scene node. //! Removes an animator from this scene node.
//! \param animator A pointer to the animator to be deleted.
virtual void removeAnimator(ISceneNodeAnimator* animator) virtual void removeAnimator(ISceneNodeAnimator* animator)
{ {
core::list<ISceneNodeAnimator*>::Iterator it = Animators.begin(); core::list<ISceneNodeAnimator*>::Iterator it = Animators.begin();
...@@ -318,11 +332,11 @@ namespace scene ...@@ -318,11 +332,11 @@ namespace scene
//! Returns the material based on the zero based index i. To get the amount //! Returns the material based on the zero based index i. To get the amount
//! of materials used by this scene node, use getMaterialCount(). //! of materials used by this scene node, use getMaterialCount().
//! This function is needed for inserting the node into the scene hirachy on a //! This function is needed for inserting the node into the scene hierarchy at an
//! optimal position for minimizing renderstate changes, but can also be used //! optimal position for minimizing renderstate changes, but can also be used
//! to directly modify the material of a scene node. //! to directly modify the material of a scene node.
//! \param num: Zero based index. The maximal value is getMaterialCount() - 1. //! \param num Zero based index. The maximal value is getMaterialCount() - 1.
//! \return Returns the material of that index. //! \return The material at that index.
virtual video::SMaterial& getMaterial(u32 num) virtual video::SMaterial& getMaterial(u32 num)
{ {
return *((video::SMaterial*)0); return *((video::SMaterial*)0);
...@@ -330,17 +344,17 @@ namespace scene ...@@ -330,17 +344,17 @@ namespace scene
//! Returns amount of materials used by this scene node. //! Returns amount of materials used by this scene node.
//! \return Returns current count of materials used by this scene node. //! \return Current amount of materials used by this scene node.
virtual u32 getMaterialCount() const virtual u32 getMaterialCount() const
{ {
return 0; return 0;
} }
//! Sets all material flags at once to a new value. Helpful for //! Sets all material flags at once to a new value. Useful, for
//! example, if you want to be the the whole mesh to be lighted by //! example, if you want the whole mesh to be affected by light.
//! \param flag: Which flag of all materials to be set. //! \param flag Which flag of all materials to be set.
//! \param newvalue: New value of the flag. //! \param newvalue New value of that flag.
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{ {
for (u32 i=0; i<getMaterialCount(); ++i) for (u32 i=0; i<getMaterialCount(); ++i)
...@@ -350,9 +364,9 @@ namespace scene ...@@ -350,9 +364,9 @@ namespace scene
//! Sets the texture of the specified layer in all materials of this //! Sets the texture of the specified layer in all materials of this
//! scene node to the new texture. //! scene node to the new texture.
//! \param textureLayer: Layer of texture to be set. Must be a value greater or //! \param textureLayer Layer of texture to be set. Must be a
//! equal than 0 and smaller than MATERIAL_MAX_TEXTURES. //! value smaller than MATERIAL_MAX_TEXTURES.
//! \param texture: Texture to be used. //! \param texture New texture to be used.
void setMaterialTexture(u32 textureLayer, video::ITexture* texture) void setMaterialTexture(u32 textureLayer, video::ITexture* texture)
{ {
if (textureLayer >= video::MATERIAL_MAX_TEXTURES) if (textureLayer >= video::MATERIAL_MAX_TEXTURES)
...@@ -363,9 +377,9 @@ namespace scene ...@@ -363,9 +377,9 @@ namespace scene
} }
//! Sets the material type of all materials s32 this scene node //! Sets the material type of all materials in this scene node
//! to a new material type. //! to a new material type.
//! \param newType: New type of material to be set. //! \param newType New type of material to be set.
void setMaterialType(video::E_MATERIAL_TYPE newType) void setMaterialType(video::E_MATERIAL_TYPE newType)
{ {
for (u32 i=0; i<getMaterialCount(); ++i) for (u32 i=0; i<getMaterialCount(); ++i)
...@@ -373,16 +387,16 @@ namespace scene ...@@ -373,16 +387,16 @@ namespace scene
} }
//! Gets the scale of the scene node. //! Gets the relative scale of the scene node.
/** \return Returns the scale of the scene node. */ /** \return The scale of the scene node. */
virtual const core::vector3df& getScale() const virtual const core::vector3df& getScale() const
{ {
return RelativeScale; return RelativeScale;
} }
//! Sets the scale of the scene node. //! Sets the relative scale of the scene node.
/** \param scale: New scale of the node */ /** \param scale New scale of the node */
virtual void setScale(const core::vector3df& scale) virtual void setScale(const core::vector3df& scale)
{ {
RelativeScale = scale; RelativeScale = scale;
...@@ -400,7 +414,7 @@ namespace scene ...@@ -400,7 +414,7 @@ namespace scene
//! Sets the rotation of the node. //! Sets the rotation of the node.
/** This only modifies the relative rotation of the node. /** This only modifies the relative rotation of the node.
\param rotation: New rotation of the node in degrees. */ \param rotation New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation) virtual void setRotation(const core::vector3df& rotation)
{ {
RelativeRotation = rotation; RelativeRotation = rotation;
...@@ -409,7 +423,7 @@ namespace scene ...@@ -409,7 +423,7 @@ namespace scene
//! Gets the position of the node. //! Gets the position of the node.
/** Note that the position is relative to the parent. /** Note that the position is relative to the parent.
\return Returns the current position of the node relative to the parent. */ \return The current position of the node relative to the parent. */
virtual const core::vector3df& getPosition() const virtual const core::vector3df& getPosition() const
{ {
return RelativeTranslation; return RelativeTranslation;
...@@ -418,7 +432,7 @@ namespace scene ...@@ -418,7 +432,7 @@ namespace scene
//! Sets the position of the node. //! Sets the position of the node.
/** Note that the position is relative to the parent. /** Note that the position is relative to the parent.
\param newpos: New relative postition of the scene node. */ \param newpos New relative postition of the scene node. */
virtual void setPosition(const core::vector3df& newpos) virtual void setPosition(const core::vector3df& newpos)
{ {
RelativeTranslation = newpos; RelativeTranslation = newpos;
...@@ -426,8 +440,7 @@ namespace scene ...@@ -426,8 +440,7 @@ namespace scene
//! Gets the abolute position of the node. //! Gets the abolute position of the node.
/** The position is absolute. //! \return The current absolute position of the scene node.
\return Returns the current absolute position of the scene node. */
virtual core::vector3df getAbsolutePosition() const virtual core::vector3df getAbsolutePosition() const
{ {
return AbsoluteTransformation.getTranslation(); return AbsoluteTransformation.getTranslation();
...@@ -436,10 +449,10 @@ namespace scene ...@@ -436,10 +449,10 @@ namespace scene
//! Enables or disables automatic culling based on the bounding box. //! Enables or disables automatic culling based on the bounding box.
/** Automatic culling is enabled by default. Note that not /** Automatic culling is enabled by default. Note that not
all SceneNodes support culling (e.g. the billboard scene node) all SceneNodes support culling and that some nodes always cull
and that some nodes always cull their geometry because it is their their geometry because it is their only reason for existence,
only reason for existence, for example the OctreeSceneNode. for example the OctreeSceneNode.
\param state: The culling state to be used. */ \param state The culling state to be used. */
void setAutomaticCulling( E_CULLING_TYPE state) void setAutomaticCulling( E_CULLING_TYPE state)
{ {
AutomaticCullingState = state; AutomaticCullingState = state;
...@@ -447,8 +460,7 @@ namespace scene ...@@ -447,8 +460,7 @@ namespace scene
//! Gets the automatic culling state. //! Gets the automatic culling state.
/** \return The node is culled based on its bounding box if this method /** \return The automatic culling state. */
returns true, otherwise no culling is performed. */
E_CULLING_TYPE getAutomaticCulling() const E_CULLING_TYPE getAutomaticCulling() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
...@@ -457,16 +469,18 @@ namespace scene ...@@ -457,16 +469,18 @@ namespace scene
//! Sets if debug data like bounding boxes should be drawn. //! Sets if debug data like bounding boxes should be drawn.
/** Please note that not all scene nodes support this feature. */ /** A bitwise OR of the types is supported.
virtual void setDebugDataVisible(E_DEBUG_SCENE_TYPE visible) Please note that not all scene nodes support this feature.
\param state The debug data visibility state to be used. */
virtual void setDebugDataVisible(s32 state)
{ {
DebugDataVisible = visible; DebugDataVisible = state;
} }
//! Returns if debug data like bounding boxes are drawed. //! Returns if debug data like bounding boxes are drawn.
E_DEBUG_SCENE_TYPE isDebugDataVisible() const /** \return A bitwise OR of the debug data values currently visible. */
s32 isDebugDataVisible() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return DebugDataVisible; return DebugDataVisible;
} }
...@@ -479,9 +493,11 @@ namespace scene ...@@ -479,9 +493,11 @@ namespace scene
IsDebugObject = debugObject; IsDebugObject = debugObject;
} }
//! Returns if this scene node is a debug object. //! Returns if this scene node is a debug object.
/** Debug objects have some special properties, for example they can be easily /** Debug objects have some special properties, for example they can be easily
excluded from collision detection or from serialization, etc. */ excluded from collision detection or from serialization, etc.
\return If this node is a debug object, true is returned. */
bool isDebugObject() const bool isDebugObject() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
...@@ -490,6 +506,7 @@ namespace scene ...@@ -490,6 +506,7 @@ namespace scene
//! Returns a const reference to the list of all children. //! Returns a const reference to the list of all children.
/** \return The list of all children of this node. */
const core::list<ISceneNode*>& getChildren() const const core::list<ISceneNode*>& getChildren() const
{ {
return Children; return Children;
...@@ -497,6 +514,7 @@ namespace scene ...@@ -497,6 +514,7 @@ namespace scene
//! Changes the parent of the scene node. //! Changes the parent of the scene node.
/** \param newParent The new parent to be used. */
virtual void setParent(ISceneNode* newParent) virtual void setParent(ISceneNode* newParent)
{ {
grab(); grab();
...@@ -519,7 +537,7 @@ namespace scene ...@@ -519,7 +537,7 @@ namespace scene
//! ISceneNode::setTriangleSelector(). If a scene node got no triangle //! ISceneNode::setTriangleSelector(). If a scene node got no triangle
//! selector, but collision tests should be done with it, a triangle //! selector, but collision tests should be done with it, a triangle
//! selector is created using the bounding box of the scene node. //! selector is created using the bounding box of the scene node.
//! \return Returns a pointer to the TriangleSelector or NULL, if there //! \return A pointer to the TriangleSelector or 0, if there
//! is none. //! is none.
virtual ITriangleSelector* getTriangleSelector() const virtual ITriangleSelector* getTriangleSelector() const
{ {
...@@ -534,7 +552,7 @@ namespace scene ...@@ -534,7 +552,7 @@ namespace scene
//! create their own selector by default, so it would be good to //! create their own selector by default, so it would be good to
//! check if there is already a selector in this node by calling //! check if there is already a selector in this node by calling
//! ISceneNode::getTriangleSelector(). //! ISceneNode::getTriangleSelector().
//! \param selector: New triangle selector for this scene node. //! \param selector New triangle selector for this scene node.
virtual void setTriangleSelector(ITriangleSelector* selector) virtual void setTriangleSelector(ITriangleSelector* selector)
{ {
if (TriangleSelector) if (TriangleSelector)
...@@ -549,7 +567,7 @@ namespace scene ...@@ -549,7 +567,7 @@ namespace scene
//! updates the absolute position based on the relative and the parents position //! updates the absolute position based on the relative and the parents position
virtual void updateAbsolutePosition() virtual void updateAbsolutePosition()
{ {
if (Parent ) if (Parent)
{ {
AbsoluteTransformation = AbsoluteTransformation =
Parent->getAbsoluteTransformation() * getRelativeTransformation(); Parent->getAbsoluteTransformation() * getRelativeTransformation();
...@@ -558,23 +576,32 @@ namespace scene ...@@ -558,23 +576,32 @@ namespace scene
AbsoluteTransformation = getRelativeTransformation(); AbsoluteTransformation = getRelativeTransformation();
} }
//! Returns the parent of this scene node //! Returns the parent of this scene node
//! \return A pointer to the parent.
scene::ISceneNode* getParent() const scene::ISceneNode* getParent() const
{ {
return Parent; return Parent;
} }
//! Returns type of the scene node //! Returns type of the scene node
//! \return The type of this node.
virtual ESCENE_NODE_TYPE getType() const virtual ESCENE_NODE_TYPE getType() const
{ {
return ESNT_UNKNOWN; return ESNT_UNKNOWN;
} }
//! Writes attributes of the scene node. //! Writes attributes of the scene node.
//! Implement this to expose the attributes of your scene node for //! Implement this to expose the attributes of your scene node for
//! scripting languages, editors, debuggers or xml serialization purposes. //! scripting languages, editors, debuggers or xml serialization purposes.
//! \param out The attribute container to write into.
//! \param options Additional options which might influence the serialization.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
if (!out)
return;
out->addString ("Name", Name.c_str()); out->addString ("Name", Name.c_str());
out->addInt ("Id", ID ); out->addInt ("Id", ID );
...@@ -588,11 +615,16 @@ namespace scene ...@@ -588,11 +615,16 @@ namespace scene
out->addBool ("IsDebugObject", IsDebugObject ); out->addBool ("IsDebugObject", IsDebugObject );
} }
//! Reads attributes of the scene node. //! Reads attributes of the scene node.
//! Implement this to set the attributes of your scene node for //! Implement this to set the attributes of your scene node for
//! scripting languages, editors, debuggers or xml deserialization purposes. //! scripting languages, editors, debuggers or xml deserialization purposes.
//! \param in The attribute container to read from.
//! \param options Additional options which might influence the deserialization.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
if (!in)
return;
Name = in->getAttributeAsString("Name"); Name = in->getAttributeAsString("Name");
ID = in->getAttributeAsInt("Id"); ID = in->getAttributeAsInt("Id");
...@@ -603,13 +635,16 @@ namespace scene ...@@ -603,13 +635,16 @@ namespace scene
IsVisible = in->getAttributeAsBool("Visible"); IsVisible = in->getAttributeAsBool("Visible");
AutomaticCullingState = (scene::E_CULLING_TYPE ) in->getAttributeAsEnumeration("AutomaticCulling", scene::AutomaticCullingNames); AutomaticCullingState = (scene::E_CULLING_TYPE ) in->getAttributeAsEnumeration("AutomaticCulling", scene::AutomaticCullingNames);
DebugDataVisible = (scene::E_DEBUG_SCENE_TYPE ) in->getAttributeAsInt("DebugDataVisible"); DebugDataVisible = in->getAttributeAsInt("DebugDataVisible");
IsDebugObject = in->getAttributeAsBool("IsDebugObject"); IsDebugObject = in->getAttributeAsBool("IsDebugObject");
updateAbsolutePosition(); updateAbsolutePosition();
} }
//! Creates a clone of this scene node and its children. //! Creates a clone of this scene node and its children.
//! \param newParent An optional new parent.
//! \param newManager An optional new scene manager.
//! \return The newly created clone of this node.
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0)
{ {
return 0; // to be implemented by derived classes return 0; // to be implemented by derived classes
...@@ -617,7 +652,10 @@ namespace scene ...@@ -617,7 +652,10 @@ namespace scene
protected: protected:
//! A clone function for the ISceneNode members.
//! this method can be used by clone() implementations of derived classes //! this method can be used by clone() implementations of derived classes
//! \param topCopyFrom The node from which the values are copied
//! \param newManager The new scene manager.
void cloneMembers(ISceneNode* toCopyFrom, ISceneManager* newManager) void cloneMembers(ISceneNode* toCopyFrom, ISceneManager* newManager)
{ {
Name = toCopyFrom->Name; Name = toCopyFrom->Name;
...@@ -697,7 +735,7 @@ namespace scene ...@@ -697,7 +735,7 @@ namespace scene
bool IsVisible; bool IsVisible;
//! flag if debug data should be drawn, such as Bounding Boxes. //! flag if debug data should be drawn, such as Bounding Boxes.
E_DEBUG_SCENE_TYPE DebugDataVisible; s32 DebugDataVisible;
//! is debug object? //! is debug object?
bool IsDebugObject; bool IsDebugObject;
......
...@@ -37,26 +37,26 @@ const c8* const LightTypeNames[] = ...@@ -37,26 +37,26 @@ const c8* const LightTypeNames[] =
*/ */
struct SLight struct SLight
{ {
SLight() : AmbientColor(0.0f,0.0f,0.0f), DiffuseColor(1.0f,1.0f,1.0f), SLight() : AmbientColor(0.f,0.f,0.f), DiffuseColor(1.f,1.f,1.f),
SpecularColor(1.0f,1.0f,1.0f), Attenuation(1.0f,0.0f,0.0f), SpecularColor(1.f,1.f,1.f), Attenuation(1.f,0.f,0.f),
Radius(100.0f), OuterCone(45.0f), InnerCone(0.0f), Radius(100.f), OuterCone(45.f), InnerCone(0.f), Falloff(2.f),
Falloff(2.0f), CastShadows(true), Type(ELT_POINT), Position(0.f,0.f,0.f), Direction(0.f,0.f,1.f),
Position(0.0f,0.0f,0.0f), Direction(0.0f,0.0f,1.0f) Type(ELT_POINT), CastShadows(true)
{}; {};
//! Ambient color emitted by the light //! Ambient color emitted by the light
SColorf AmbientColor; SColorf AmbientColor;
//! Diffuse color emitted by the light. //! Diffuse color emitted by the light.
/** This is the primary color you might want to set. */ //! This is the primary color you want to set.
SColorf DiffuseColor; SColorf DiffuseColor;
//! Specular color emitted by the light. //! Specular color emitted by the light.
/** For details how to use specular highlights, see SMaterial::Shininess */ //! For details how to use specular highlights, see SMaterial::Shininess
SColorf SpecularColor; SColorf SpecularColor;
//! Attenuation factors (constant, linear, quadratic) //! Attenuation factors (constant, linear, quadratic)
/** Changes the light strength fading over distance */ //! Changes the light strength fading over distance
core::vector3df Attenuation; core::vector3df Attenuation;
//! Radius of light. Everything within this radius be be lighted. //! Radius of light. Everything within this radius be be lighted.
...@@ -71,17 +71,19 @@ struct SLight ...@@ -71,17 +71,19 @@ struct SLight
//! The light strength's decrease between Outer and Inner cone. //! The light strength's decrease between Outer and Inner cone.
f32 Falloff; f32 Falloff;
//! Does the light cast shadows? //! Read-ONLY! Position of the light. If Type is ELT_DIRECTIONAL,
bool CastShadows; //! it is ignored. Changed via light scene node's position.
core::vector3df Position;
//! Read-ONLY! Direction of the light. If Type is ELT_POINT,
//! it is ignored. Changed via light scene node's rotation.
core::vector3df Direction;
//! Type of the light. Default: ELT_POINT //! Type of the light. Default: ELT_POINT
E_LIGHT_TYPE Type; E_LIGHT_TYPE Type;
//! Read-ONLY! Position of the light. If Type is ELT_DIRECTIONAL, this is ignored. //! Does the light cast shadows?
core::vector3df Position; bool CastShadows;
//! Read-ONLY! Direction of the light. If Type is ELT_POINT, this is ignored.
core::vector3df Direction;
}; };
} // end namespace video } // end namespace video
......
...@@ -49,7 +49,7 @@ namespace scene ...@@ -49,7 +49,7 @@ namespace scene
// reverse search // reverse search
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial & material) const virtual IMeshBuffer* getMeshBuffer( const video::SMaterial & material) const
{ {
for (s32 i = (s32) MeshBuffers.size(); --i >= 0; ) for (s32 i = (s32)MeshBuffers.size()-1; i >= 0; --i)
{ {
if ( material == MeshBuffers[i]->getMaterial()) if ( material == MeshBuffers[i]->getMaterial())
return MeshBuffers[i]; return MeshBuffers[i];
......
...@@ -556,11 +556,11 @@ public: ...@@ -556,11 +556,11 @@ public:
} }
//! finds first occurrence of a character of a list in string //! finds first occurrence of a character of a list in string
/** \param c: List of strings to find. For example if the method /** \param c: List of characters to find. For example if the method
should find the first occurrence of 'a' or 'b', this parameter should be "ab". should find the first occurrence of 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Ususally, \param count: Amount of characters in the list. Usually,
this should be strlen(ofParameter1) this should be strlen(c)
\return Returns position where one of the character has been found, \return Returns position where one of the characters has been found,
or -1 if not found. */ or -1 if not found. */
s32 findFirstChar(const T* const c, u32 count) const s32 findFirstChar(const T* const c, u32 count) const
{ {
...@@ -579,8 +579,8 @@ public: ...@@ -579,8 +579,8 @@ public:
//! Finds first position of a character not in a given list. //! Finds first position of a character not in a given list.
/** \param c: List of characters not to find. For example if the method /** \param c: List of characters not to find. For example if the method
should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab". should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Ususally, \param count: Amount of characters in the list. Usually,
this should be strlen(ofParameter1) this should be strlen(c)
\return Returns position where the character has been found, \return Returns position where the character has been found,
or -1 if not found. */ or -1 if not found. */
template <class B> template <class B>
...@@ -603,8 +603,8 @@ public: ...@@ -603,8 +603,8 @@ public:
//! Finds last position of a character not in a given list. //! Finds last position of a character not in a given list.
/** \param c: List of characters not to find. For example if the method /** \param c: List of characters not to find. For example if the method
should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab". should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Ususally, \param count: Amount of characters in the list. Usually,
this should be strlen(ofParameter1) this should be strlen(c)
\return Returns position where the character has been found, \return Returns position where the character has been found,
or -1 if not found. */ or -1 if not found. */
template <class B> template <class B>
...@@ -654,6 +654,27 @@ public: ...@@ -654,6 +654,27 @@ public:
return -1; return -1;
} }
//! finds last occurrence of a character of a list in string
/** \param c: List of strings to find. For example if the method
should find the last occurrence of 'a' or 'b', this parameter should be "ab".
\param count: Amount of characters in the list. Usually,
this should be strlen(c)
\return Returns position where one of the characters has been found,
or -1 if not found. */
s32 findLastChar(const T* const c, u32 count) const
{
if (!c)
return -1;
for (u32 i=(used-1); i>=0; --i)
for (u32 j=0; j<count; ++j)
if (array[i] == c[j])
return i;
return -1;
}
//! finds another string in this string //! finds another string in this string
//! \param str: Another string //! \param str: Another string
//! \return Returns positions where the string has been found, //! \return Returns positions where the string has been found,
......
...@@ -402,10 +402,9 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop, ...@@ -402,10 +402,9 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop,
video::S3DVertex* first = FrameList[firstFrame].pointer(); video::S3DVertex* first = FrameList[firstFrame].pointer();
video::S3DVertex* second = FrameList[secondFrame].pointer(); video::S3DVertex* second = FrameList[secondFrame].pointer();
s32 count = FrameList[firstFrame].size();
// interpolate both frames // interpolate both frames
for (s32 i=0; i<count; ++i) const u32 count = FrameList[firstFrame].size();
for (u32 i=0; i<count; ++i)
{ {
target->Pos = (second->Pos - first->Pos) * div + first->Pos; target->Pos = (second->Pos - first->Pos) * div + first->Pos;
target->Normal = (second->Normal - first->Normal) * div + first->Normal; target->Normal = (second->Normal - first->Normal) * div + first->Normal;
...@@ -722,7 +721,8 @@ void CAnimatedMeshMD2::getFrameLoop(EMD2_ANIMATION_TYPE l, ...@@ -722,7 +721,8 @@ void CAnimatedMeshMD2::getFrameLoop(EMD2_ANIMATION_TYPE l,
bool CAnimatedMeshMD2::getFrameLoop(const c8* name, bool CAnimatedMeshMD2::getFrameLoop(const c8* name,
s32& outBegin, s32&outEnd, s32& outFPS) const s32& outBegin, s32&outEnd, s32& outFPS) const
{ {
for (s32 i=0; i<(s32)FrameData.size(); ++i) for (u32 i=0; i<FrameData.size(); ++i)
{
if (FrameData[i].name == name) if (FrameData[i].name == name)
{ {
outBegin = FrameData[i].begin << MD2_FRAME_SHIFT; outBegin = FrameData[i].begin << MD2_FRAME_SHIFT;
...@@ -731,6 +731,7 @@ bool CAnimatedMeshMD2::getFrameLoop(const c8* name, ...@@ -731,6 +731,7 @@ bool CAnimatedMeshMD2::getFrameLoop(const c8* name,
outFPS = FrameData[i].fps << MD2_FRAME_SHIFT; outFPS = FrameData[i].fps << MD2_FRAME_SHIFT;
return true; return true;
} }
}
return false; return false;
} }
...@@ -746,7 +747,7 @@ s32 CAnimatedMeshMD2::getAnimationCount() const ...@@ -746,7 +747,7 @@ s32 CAnimatedMeshMD2::getAnimationCount() const
//! Returns name of md2 animation. //! Returns name of md2 animation.
const c8* CAnimatedMeshMD2::getAnimationName(s32 nr) const const c8* CAnimatedMeshMD2::getAnimationName(s32 nr) const
{ {
if (nr < 0 || nr >= (s32)FrameData.size()) if ((u32)nr >= FrameData.size())
return 0; return 0;
return FrameData[nr].name.c_str(); return FrameData[nr].name.c_str();
......
...@@ -260,20 +260,7 @@ void CAnimatedMeshSceneNode::render() ...@@ -260,20 +260,7 @@ void CAnimatedMeshSceneNode::render()
} }
m=skinnedMesh; m=skinnedMesh;
if (m)
{
for (u32 g=0; g< m->getMeshBufferCount(); ++g)
{
const IMeshBuffer* mb = m->getMeshBuffer(g);
const core::matrix4 mat = AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation;
core::aabbox3df tmpbox(mb->getBoundingBox());
mat.transformBox(tmpbox);
if (g==0)
Box = tmpbox;
else
Box.addInternalBox(tmpbox);
}
}
} }
if ( 0 == m ) if ( 0 == m )
...@@ -298,14 +285,15 @@ void CAnimatedMeshSceneNode::render() ...@@ -298,14 +285,15 @@ void CAnimatedMeshSceneNode::render()
// overwrite half transparency // overwrite half transparency
if ( DebugDataVisible & scene::EDS_HALF_TRANSPARENCY ) if ( DebugDataVisible & scene::EDS_HALF_TRANSPARENCY )
{ {
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 i=0; i<m->getMeshBufferCount(); ++i) for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{ {
scene::IMeshBuffer* mb = m->getMeshBuffer(i); scene::IMeshBuffer* mb = m->getMeshBuffer(i);
mat = Materials[i]; mat = Materials[i];
mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR; mat.MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
if (Mesh->getMeshType() == EAMT_SKINNED) if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->setMaterial(mat); driver->setMaterial(mat);
...@@ -318,8 +306,7 @@ void CAnimatedMeshSceneNode::render() ...@@ -318,8 +306,7 @@ void CAnimatedMeshSceneNode::render()
// render original meshes // render original meshes
if ( renderMeshes ) if ( renderMeshes )
{ {
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 i=0; i<m->getMeshBufferCount(); ++i) for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{ {
video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType); video::IMaterialRenderer* rnd = driver->getMaterialRenderer(Materials[i].MaterialType);
...@@ -331,7 +318,9 @@ void CAnimatedMeshSceneNode::render() ...@@ -331,7 +318,9 @@ void CAnimatedMeshSceneNode::render()
{ {
scene::IMeshBuffer* mb = m->getMeshBuffer(i); scene::IMeshBuffer* mb = m->getMeshBuffer(i);
if (Mesh->getMeshType() == EAMT_SKINNED) if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->setMaterial(Materials[i]); driver->setMaterial(Materials[i]);
...@@ -402,11 +391,11 @@ void CAnimatedMeshSceneNode::render() ...@@ -402,11 +391,11 @@ void CAnimatedMeshSceneNode::render()
// show bounding box // show bounding box
if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS ) if ( DebugDataVisible & scene::EDS_BBOX_BUFFERS )
{ {
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 g=0; g< m->getMeshBufferCount(); ++g) for (u32 g=0; g< m->getMeshBufferCount(); ++g)
{ {
const IMeshBuffer* mb = m->getMeshBuffer(g); const IMeshBuffer* mb = m->getMeshBuffer(g);
if (Mesh->getMeshType() == EAMT_SKINNED) if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->draw3DBox( mb->getBoundingBox(), driver->draw3DBox( mb->getBoundingBox(),
...@@ -483,12 +472,13 @@ void CAnimatedMeshSceneNode::render() ...@@ -483,12 +472,13 @@ void CAnimatedMeshSceneNode::render()
mat.ZBuffer = true; mat.ZBuffer = true;
driver->setMaterial(mat); driver->setMaterial(mat);
if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
for (u32 g=0; g<m->getMeshBufferCount(); ++g) for (u32 g=0; g<m->getMeshBufferCount(); ++g)
{ {
const IMeshBuffer* mb = m->getMeshBuffer(g); const IMeshBuffer* mb = m->getMeshBuffer(g);
if (Mesh->getMeshType() == EAMT_SKINNED) if (RenderFromIdentity)
driver->setTransform(video::ETS_WORLD, core::matrix4() );
else if (Mesh->getMeshType() == EAMT_SKINNED)
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation); driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((SSkinMeshBuffer*)mb)->Transformation);
driver->drawMeshBuffer(mb); driver->drawMeshBuffer(mb);
} }
......
...@@ -21,8 +21,7 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -21,8 +21,7 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool noclip) s32 id, core::rect<s32> rectangle, bool noclip)
: IGUIButton(environment, parent, id, rectangle), Pressed(false), : IGUIButton(environment, parent, id, rectangle), Pressed(false),
IsPushButton(false), UseAlphaChannel(false), Border(true), IsPushButton(false), UseAlphaChannel(false), Border(true),
MouseOverTime(0), FocusTime(0), ClickTime(0), SpriteBank(0), ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0)
OverrideFont(0), Image(0), PressedImage(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIButton"); setDebugName("CGUIButton");
...@@ -39,7 +38,6 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -39,7 +38,6 @@ CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
} }
//! destructor //! destructor
CGUIButton::~CGUIButton() CGUIButton::~CGUIButton()
{ {
...@@ -56,12 +54,14 @@ CGUIButton::~CGUIButton() ...@@ -56,12 +54,14 @@ CGUIButton::~CGUIButton()
SpriteBank->drop(); SpriteBank->drop();
} }
//! Sets if the button should use the skin to draw its border //! Sets if the button should use the skin to draw its border
void CGUIButton::setDrawBorder(bool border) void CGUIButton::setDrawBorder(bool border)
{ {
Border = border; Border = border;
} }
void CGUIButton::setSpriteBank(IGUISpriteBank* sprites) void CGUIButton::setSpriteBank(IGUISpriteBank* sprites)
{ {
if (sprites) if (sprites)
...@@ -73,6 +73,7 @@ void CGUIButton::setSpriteBank(IGUISpriteBank* sprites) ...@@ -73,6 +73,7 @@ void CGUIButton::setSpriteBank(IGUISpriteBank* sprites)
SpriteBank = sprites; SpriteBank = sprites;
} }
void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop)
{ {
if (SpriteBank) if (SpriteBank)
...@@ -87,6 +88,7 @@ void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor col ...@@ -87,6 +88,7 @@ void CGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor col
} }
} }
//! called if an event happened. //! called if an event happened.
bool CGUIButton::OnEvent(const SEvent& event) bool CGUIButton::OnEvent(const SEvent& event)
{ {
...@@ -199,7 +201,6 @@ bool CGUIButton::OnEvent(const SEvent& event) ...@@ -199,7 +201,6 @@ bool CGUIButton::OnEvent(const SEvent& event)
} }
//! draws the element and its children //! draws the element and its children
void CGUIButton::draw() void CGUIButton::draw()
{ {
...@@ -287,7 +288,6 @@ void CGUIButton::draw() ...@@ -287,7 +288,6 @@ void CGUIButton::draw()
} }
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin. //! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
void CGUIButton::setOverrideFont(IGUIFont* font) void CGUIButton::setOverrideFont(IGUIFont* font)
{ {
...@@ -318,6 +318,7 @@ void CGUIButton::setImage(video::ITexture* image) ...@@ -318,6 +318,7 @@ void CGUIButton::setImage(video::ITexture* image)
setPressedImage(Image); setPressedImage(Image);
} }
//! Sets the image which should be displayed on the button when it is in its normal state. //! Sets the image which should be displayed on the button when it is in its normal state.
void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos) void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
{ {
...@@ -334,6 +335,7 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos) ...@@ -334,6 +335,7 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
setPressedImage(Image, pos); setPressedImage(Image, pos);
} }
//! Sets an image which should be displayed on the button when it is in pressed state. //! Sets an image which should be displayed on the button when it is in pressed state.
void CGUIButton::setPressedImage(video::ITexture* image) void CGUIButton::setPressedImage(video::ITexture* image)
{ {
...@@ -348,6 +350,7 @@ void CGUIButton::setPressedImage(video::ITexture* image) ...@@ -348,6 +350,7 @@ void CGUIButton::setPressedImage(video::ITexture* image)
PressedImage->grab(); PressedImage->grab();
} }
//! Sets the image which should be displayed on the button when it is in its pressed state. //! Sets the image which should be displayed on the button when it is in its pressed state.
void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos) void CGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
{ {
...@@ -378,6 +381,7 @@ bool CGUIButton::isPressed() const ...@@ -378,6 +381,7 @@ bool CGUIButton::isPressed() const
return Pressed; return Pressed;
} }
//! Sets the pressed state of the button if this is a pushbutton //! Sets the pressed state of the button if this is a pushbutton
void CGUIButton::setPressed(bool pressed) void CGUIButton::setPressed(bool pressed)
{ {
...@@ -388,6 +392,7 @@ void CGUIButton::setPressed(bool pressed) ...@@ -388,6 +392,7 @@ void CGUIButton::setPressed(bool pressed)
} }
} }
//! Returns whether the button is a push button //! Returns whether the button is a push button
bool CGUIButton::isPushButton() const bool CGUIButton::isPushButton() const
{ {
...@@ -395,12 +400,14 @@ bool CGUIButton::isPushButton() const ...@@ -395,12 +400,14 @@ bool CGUIButton::isPushButton() const
return IsPushButton; return IsPushButton;
} }
//! Sets if the alpha channel should be used for drawing images on the button (default is false) //! Sets if the alpha channel should be used for drawing images on the button (default is false)
void CGUIButton::setUseAlphaChannel(bool useAlphaChannel) void CGUIButton::setUseAlphaChannel(bool useAlphaChannel)
{ {
UseAlphaChannel = useAlphaChannel; UseAlphaChannel = useAlphaChannel;
} }
//! Returns if the alpha channel should be used for drawing images on the button //! Returns if the alpha channel should be used for drawing images on the button
bool CGUIButton::isAlphaChannelUsed() const bool CGUIButton::isAlphaChannelUsed() const
{ {
...@@ -408,16 +415,17 @@ bool CGUIButton::isAlphaChannelUsed() const ...@@ -408,16 +415,17 @@ bool CGUIButton::isAlphaChannelUsed() const
return UseAlphaChannel; return UseAlphaChannel;
} }
bool CGUIButton::isDrawingBorder() const bool CGUIButton::isDrawingBorder() const
{ {
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return Border; return Border;
} }
//! Writes attributes of the element. //! Writes attributes of the element.
void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{ {
IGUIButton::serializeAttributes(out,options); IGUIButton::serializeAttributes(out,options);
out->addBool ("PushButton", IsPushButton ); out->addBool ("PushButton", IsPushButton );
...@@ -435,6 +443,7 @@ void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWri ...@@ -435,6 +443,7 @@ void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWri
// out->addString ("OverrideFont", OverrideFont); // out->addString ("OverrideFont", OverrideFont);
} }
//! Reads attributes of the element //! Reads attributes of the element
void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{ {
...@@ -463,7 +472,9 @@ void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWr ...@@ -463,7 +472,9 @@ void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWr
updateAbsolutePosition(); updateAbsolutePosition();
} }
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_ #endif // _IRR_COMPILE_WITH_GUI_
...@@ -108,8 +108,6 @@ namespace gui ...@@ -108,8 +108,6 @@ namespace gui
bool Border; bool Border;
u32 MouseOverTime;
u32 FocusTime;
u32 ClickTime; u32 ClickTime;
IGUISpriteBank* SpriteBank; IGUISpriteBank* SpriteBank;
......
...@@ -206,9 +206,11 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment, ...@@ -206,9 +206,11 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment,
//! destructor //! destructor
CGUITabControl::~CGUITabControl() CGUITabControl::~CGUITabControl()
{ {
for (s32 i=0; i<(s32)Tabs.size(); ++i) for (u32 i=0; i<Tabs.size(); ++i)
{
if (Tabs[i]) if (Tabs[i])
Tabs[i]->drop(); Tabs[i]->drop();
}
if (UpButton) if (UpButton)
UpButton->drop(); UpButton->drop();
...@@ -269,9 +271,11 @@ void CGUITabControl::addTab(CGUITab* tab) ...@@ -269,9 +271,11 @@ void CGUITabControl::addTab(CGUITab* tab)
return; return;
// check if its already added // check if its already added
for (s32 i=0; i < (s32)Tabs.size(); ++i) for (u32 i=0; i < Tabs.size(); ++i)
{
if (Tabs[i] == tab) if (Tabs[i] == tab)
return; return;
}
tab->grab(); tab->grab();
...@@ -309,7 +313,7 @@ s32 CGUITabControl::getTabCount() const ...@@ -309,7 +313,7 @@ s32 CGUITabControl::getTabCount() const
//! Returns a tab based on zero based index //! Returns a tab based on zero based index
IGUITab* CGUITabControl::getTab(s32 idx) const IGUITab* CGUITabControl::getTab(s32 idx) const
{ {
if (idx < 0 || idx >= (s32)Tabs.size()) if ((u32)idx >= Tabs.size())
return 0; return 0;
return Tabs[idx]; return Tabs[idx];
...@@ -523,7 +527,7 @@ void CGUITabControl::draw() ...@@ -523,7 +527,7 @@ void CGUITabControl::draw()
//const wchar_t* activetext = 0; //const wchar_t* activetext = 0;
CGUITab *activeTab = 0; CGUITab *activeTab = 0;
for (s32 i=CurrentScrollTabIndex; i<(s32)Tabs.size(); ++i) for (u32 i=0; i<Tabs.size(); ++i)
{ {
// get Text // get Text
const wchar_t* text = 0; const wchar_t* text = 0;
...@@ -543,7 +547,7 @@ void CGUITabControl::draw() ...@@ -543,7 +547,7 @@ void CGUITabControl::draw()
pos += len; pos += len;
if (i == ActiveTab) if ((s32)i == ActiveTab)
{ {
left = frameRect.UpperLeftCorner.X; left = frameRect.UpperLeftCorner.X;
right = frameRect.LowerRightCorner.X; right = frameRect.LowerRightCorner.X;
......
...@@ -17,6 +17,7 @@ CMetaTriangleSelector::CMetaTriangleSelector() ...@@ -17,6 +17,7 @@ CMetaTriangleSelector::CMetaTriangleSelector()
#endif #endif
} }
//! destructor //! destructor
CMetaTriangleSelector::~CMetaTriangleSelector() CMetaTriangleSelector::~CMetaTriangleSelector()
{ {
...@@ -24,7 +25,6 @@ CMetaTriangleSelector::~CMetaTriangleSelector() ...@@ -24,7 +25,6 @@ CMetaTriangleSelector::~CMetaTriangleSelector()
} }
//! Returns amount of all available triangles in this selector //! Returns amount of all available triangles in this selector
s32 CMetaTriangleSelector::getTriangleCount() const s32 CMetaTriangleSelector::getTriangleCount() const
{ {
...@@ -36,7 +36,6 @@ s32 CMetaTriangleSelector::getTriangleCount() const ...@@ -36,7 +36,6 @@ s32 CMetaTriangleSelector::getTriangleCount() const
} }
//! Gets all triangles. //! Gets all triangles.
void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize, void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::matrix4* transform) const s32& outTriangleCount, const core::matrix4* transform) const
...@@ -54,7 +53,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array ...@@ -54,7 +53,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array
} }
//! Gets all triangles which lie within a specific bounding box. //! Gets all triangles which lie within a specific bounding box.
void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize, void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::aabbox3d<f32>& box, s32& outTriangleCount, const core::aabbox3d<f32>& box,
...@@ -74,7 +72,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array ...@@ -74,7 +72,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array
} }
//! Gets all triangles which have or may have contact with a 3d line. //! Gets all triangles which have or may have contact with a 3d line.
void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize, void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arraySize,
s32& outTriangleCount, const core::line3d<f32>& line, s32& outTriangleCount, const core::line3d<f32>& line,
...@@ -94,7 +91,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array ...@@ -94,7 +91,6 @@ void CMetaTriangleSelector::getTriangles(core::triangle3df* triangles, s32 array
} }
//! Adds a triangle selector to the collection of triangle selectors //! Adds a triangle selector to the collection of triangle selectors
//! in this metaTriangleSelector. //! in this metaTriangleSelector.
void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd) void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd)
...@@ -107,23 +103,23 @@ void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd) ...@@ -107,23 +103,23 @@ void CMetaTriangleSelector::addTriangleSelector(ITriangleSelector* toAdd)
} }
//! Removes a specific triangle selector which was added before from the collection. //! Removes a specific triangle selector which was added before from the collection.
bool CMetaTriangleSelector::removeTriangleSelector(ITriangleSelector* toRemove) bool CMetaTriangleSelector::removeTriangleSelector(ITriangleSelector* toRemove)
{ {
for (u32 i=0; i<TriangleSelectors.size(); ++i) for (u32 i=0; i<TriangleSelectors.size(); ++i)
{
if (toRemove == TriangleSelectors[i]) if (toRemove == TriangleSelectors[i])
{ {
TriangleSelectors[i]->drop(); TriangleSelectors[i]->drop();
TriangleSelectors.erase(i); TriangleSelectors.erase(i);
return true; return true;
} }
}
return false; return false;
} }
//! Removes all triangle selectors from the collection. //! Removes all triangle selectors from the collection.
void CMetaTriangleSelector::removeAllTriangleSelectors() void CMetaTriangleSelector::removeAllTriangleSelectors()
{ {
......
...@@ -422,7 +422,7 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time) ...@@ -422,7 +422,7 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time)
// animate all particles // animate all particles
f32 scale = (f32)timediff; f32 scale = (f32)timediff;
for (s32 i=0; i<(s32)Particles.size();) for (u32 i=0; i<Particles.size();)
{ {
if (now > Particles[i].endTime) if (now > Particles[i].endTime)
Particles.erase(i); Particles.erase(i);
......
...@@ -278,8 +278,8 @@ CSceneManager::~CSceneManager() ...@@ -278,8 +278,8 @@ CSceneManager::~CSceneManager()
if (MeshManipulator) if (MeshManipulator)
MeshManipulator->drop(); MeshManipulator->drop();
if ( GUIEnvironment ) if (GUIEnvironment)
GUIEnvironment->drop (); GUIEnvironment->drop();
u32 i; u32 i;
...@@ -350,8 +350,9 @@ video::IVideoDriver* CSceneManager::getVideoDriver() ...@@ -350,8 +350,9 @@ video::IVideoDriver* CSceneManager::getVideoDriver()
return Driver; return Driver;
} }
//! returns the GUI Environment //! returns the GUI Environment
gui::IGUIEnvironment* CSceneManager::getGUIEnvironment () gui::IGUIEnvironment* CSceneManager::getGUIEnvironment()
{ {
return GUIEnvironment; return GUIEnvironment;
} }
...@@ -376,6 +377,7 @@ ITextSceneNode* CSceneManager::addTextSceneNode(gui::IGUIFont* font, ...@@ -376,6 +377,7 @@ ITextSceneNode* CSceneManager::addTextSceneNode(gui::IGUIFont* font,
return t; return t;
} }
//! Adds a text scene node, which uses billboards //! Adds a text scene node, which uses billboards
ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font,
const wchar_t* text, ISceneNode* parent, const wchar_t* text, ISceneNode* parent,
...@@ -399,12 +401,9 @@ ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, ...@@ -399,12 +401,9 @@ ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font,
//! Adds a scene node, which can render a quake3 shader //! Adds a scene node, which can render a quake3 shader
ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer, ISceneNode* CSceneManager::addQuake3SceneNode(IMeshBuffer* meshBuffer,
const quake3::SShader * shader, const quake3::SShader * shader,
ISceneNode* parent, ISceneNode* parent, s32 id)
s32 id
)
{ {
if ( 0 == shader ) if ( 0 == shader )
return 0; return 0;
...@@ -412,11 +411,10 @@ ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer, ...@@ -412,11 +411,10 @@ ISceneNode* CSceneManager::addQuake3SceneNode( IMeshBuffer* meshBuffer,
if (!parent) if (!parent)
parent = this; parent = this;
CQuake3ShaderSceneNode* node = new CQuake3ShaderSceneNode ( parent, this, id, FileSystem, meshBuffer, shader ); CQuake3ShaderSceneNode* node = new CQuake3ShaderSceneNode( parent, this, id, FileSystem, meshBuffer, shader );
node->drop(); node->drop();
return node; return node;
} }
//! adds Volume Lighting Scene Node. //! adds Volume Lighting Scene Node.
...@@ -437,8 +435,9 @@ ISceneNode* CSceneManager::addVolumeLightSceneNode(ISceneNode* parent, s32 id, ...@@ -437,8 +435,9 @@ ISceneNode* CSceneManager::addVolumeLightSceneNode(ISceneNode* parent, s32 id,
//! adds a test scene node for test purposes to the scene. It is a simple cube of (1,1,1) size. //! adds a test scene node for test purposes to the scene. It is a simple cube of (1,1,1) size.
//! the returned pointer must not be dropped. //! the returned pointer must not be dropped.
ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent, s32 id, ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent,
const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale) s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{ {
if (!parent) if (!parent)
parent = this; parent = this;
...@@ -449,11 +448,11 @@ ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent, s32 id ...@@ -449,11 +448,11 @@ ISceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent, s32 id
return node; return node;
} }
//! Adds a sphere scene node for test purposes to the scene. //! Adds a sphere scene node for test purposes to the scene.
ISceneNode* CSceneManager::addSphereSceneNode(f32 radius, s32 polyCount, ISceneNode* parent, s32 id, ISceneNode* CSceneManager::addSphereSceneNode(f32 radius, s32 polyCount,
const core::vector3df& position, ISceneNode* parent, s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& rotation, const core::vector3df& scale)
const core::vector3df& scale)
{ {
if (!parent) if (!parent)
parent = this; parent = this;
...@@ -504,7 +503,6 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight, ...@@ -504,7 +503,6 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight,
} }
//! adds a scene node for rendering an animated mesh model //! adds a scene node for rendering an animated mesh model
IAnimatedMeshSceneNode* CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent, s32 id, IAnimatedMeshSceneNode* CSceneManager::addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent, s32 id,
const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& position, const core::vector3df& rotation,
...@@ -584,7 +582,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNode(ISceneNode* parent, ...@@ -584,7 +582,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNode(ISceneNode* parent,
} }
//! Adds a camera scene node which is able to be controlle with the mouse similar //! Adds a camera scene node which is able to be controlle with the mouse similar
//! like in the 3D Software Maya by Alias Wavefront. //! like in the 3D Software Maya by Alias Wavefront.
//! The returned pointer must not be dropped. //! The returned pointer must not be dropped.
...@@ -604,7 +601,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeMaya(ISceneNode* parent, ...@@ -604,7 +601,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeMaya(ISceneNode* parent,
} }
//! Adds a camera scene node which is able to be controled with the mouse and keys //! Adds a camera scene node which is able to be controled with the mouse and keys
//! like in most first person shooters (FPS): //! like in most first person shooters (FPS):
ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent, ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
...@@ -624,7 +620,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent, ...@@ -624,7 +620,6 @@ ICameraSceneNode* CSceneManager::addCameraSceneNodeFPS(ISceneNode* parent,
} }
//! Adds a dynamic light scene node. The light will cast dynamic light on all //! Adds a dynamic light scene node. The light will cast dynamic light on all
//! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING //! other scene nodes in the scene, which have the material flag video::MTF_LIGHTING
//! turned on. (This is the default setting in most scene nodes). //! turned on. (This is the default setting in most scene nodes).
...@@ -641,7 +636,6 @@ ILightSceneNode* CSceneManager::addLightSceneNode(ISceneNode* parent, ...@@ -641,7 +636,6 @@ ILightSceneNode* CSceneManager::addLightSceneNode(ISceneNode* parent,
} }
//! Adds a billboard scene node to the scene. A billboard is like a 3d sprite: A 2d element, //! Adds a billboard scene node to the scene. A billboard is like a 3d sprite: A 2d element,
//! which always looks to the camera. It is usually used for things like explosions, fire, //! which always looks to the camera. It is usually used for things like explosions, fire,
//! lensflares and things like that. //! lensflares and things like that.
...@@ -1239,9 +1233,9 @@ void CSceneManager::drawAll() ...@@ -1239,9 +1233,9 @@ void CSceneManager::drawAll()
Driver->setAmbientLight(AmbientLight); Driver->setAmbientLight(AmbientLight);
LightList.sort (); // on distance to camera LightList.sort(); // on distance to camera
u32 maxLights = core::min_ ( Driver->getMaximalDynamicLightAmount (), LightList.size () ); u32 maxLights = core::min_ ( Driver->getMaximalDynamicLightAmount(), LightList.size() );
for (i=0; i< maxLights; ++i) for (i=0; i< maxLights; ++i)
LightList[i].node->render(); LightList[i].node->render();
...@@ -1267,7 +1261,7 @@ void CSceneManager::drawAll() ...@@ -1267,7 +1261,7 @@ void CSceneManager::drawAll()
for (i=0; i<SolidNodeList.size(); ++i) for (i=0; i<SolidNodeList.size(); ++i)
SolidNodeList[i].node->render(); SolidNodeList[i].node->render();
Parameters.setAttribute ( "drawn", (s32) SolidNodeList.size () ); Parameters.setAttribute ( "drawn", (s32) SolidNodeList.size() );
SolidNodeList.set_used(0); SolidNodeList.set_used(0);
} }
...@@ -1296,7 +1290,6 @@ void CSceneManager::drawAll() ...@@ -1296,7 +1290,6 @@ void CSceneManager::drawAll()
TransparentNodeList.set_used(0); TransparentNodeList.set_used(0);
} }
clearDeletionList(); clearDeletionList();
CurrentRendertime = ESNRP_COUNT; CurrentRendertime = ESNRP_COUNT;
...@@ -1495,7 +1488,7 @@ void CSceneManager::clearDeletionList() ...@@ -1495,7 +1488,7 @@ void CSceneManager::clearDeletionList()
if (DeletionList.empty()) if (DeletionList.empty())
return; return;
for (s32 i=0; i<(s32)DeletionList.size(); ++i) for (u32 i=0; i<DeletionList.size(); ++i)
{ {
DeletionList[i]->remove(); DeletionList[i]->remove();
DeletionList[i]->drop(); DeletionList[i]->drop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment