Commit a03e241b authored by lukeph's avatar lukeph

updated docs in AnimatedMeshSceneNode for the new commands.

added: getJointNode(u32 jointID)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@901 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 25514589
...@@ -86,10 +86,8 @@ namespace scene ...@@ -86,10 +86,8 @@ namespace scene
bool zfailmethod=true, f32 infinity=10000.0f) = 0; bool zfailmethod=true, f32 infinity=10000.0f) = 0;
//! Returns a pointer to a child node, which has the same transformation as //! Returns a pointer to a joint in the mesh (if the mesh is a bone based mesh)
//! the corresponding joint, if the mesh in this scene node is a ms3d mesh. //! With this method it is possible to attach scene nodes to joints
//! Otherwise 0 is returned. With this method it is possible to
//! attach scene nodes to joints more easily. In this way, it is
//! for example possible to attach a weapon to the left hand of an //! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how: //! animated model. This example shows how:
//! \code //! \code
...@@ -97,50 +95,21 @@ namespace scene ...@@ -97,50 +95,21 @@ namespace scene
//! yourAnimatedMeshSceneNode->getJointNode("LeftHand"); //! yourAnimatedMeshSceneNode->getJointNode("LeftHand");
//! hand->addChild(weaponSceneNode); //! hand->addChild(weaponSceneNode);
//! \endcode //! \endcode
//! Please note that the SceneNode returned by this method may not exist //! Please note that the joint returned by this method may not exist
//! before this call and is created by it. (Todo: Rewrite) //! before this call and the joints in the node were created by it.
//! \param jointName: Name of the joint. //! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint //! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an //! with the specified name. Returns 0 if the contained mesh is not an
//! ms3d mesh or the name of the joint could not be found. //! skinned mesh or the name of the joint could not be found.
virtual IBoneSceneNode* getJointNode(const c8* jointName)=0; virtual IBoneSceneNode* getJointNode(const c8* jointName)=0;
//! Returns a pointer to a child node, which has the same transformation as //! same as getJointNode(const c8* jointName), but based on id
//! the corresponding joint, if the mesh in this scene node is a ms3d mesh. virtual IBoneSceneNode* getJointNode(u32 jointID) = 0;
//! Otherwise 0 is returned. With this method it is possible to
//! attach scene nodes to joints more easily. In this way, it is //! Redundant command, please use getJointNode (only for backwards compatibility)
//! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourMS3DAnimatedMeshSceneNode->getMS3DJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
//! before this call and is created by it.
//! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an
//! ms3d mesh or the name of the joint could not be found.
virtual ISceneNode* getMS3DJointNode(const c8* jointName) = 0; virtual ISceneNode* getMS3DJointNode(const c8* jointName) = 0;
//! Returns a pointer to a child node, which has the same transformation as //! Redundant command, please use getJointNode (only for backwards compatibility)
//! the corresponding joint, if the mesh in this scene node is a x mesh.
//! Otherwise 0 is returned. With this method it is possible to
//! attach scene nodes to joints more easily. In this way, it is
//! for example possible to attach a weapon to the left hand of an
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourMS3DAnimatedMeshSceneNode->getXJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
//! before this call and is created by it.
//! \param jointName: Name of the joint.
//! \return Returns a pointer to the scene node which represents the joint
//! with the specified name. Returns 0 if the contained mesh is not an
//! ms3d mesh or the name of the joint could not be found.
virtual ISceneNode* getXJointNode(const c8* jointName) = 0; virtual ISceneNode* getXJointNode(const c8* jointName) = 0;
//! Starts a default MD2 animation. //! Starts a default MD2 animation.
...@@ -197,18 +166,21 @@ namespace scene ...@@ -197,18 +166,21 @@ namespace scene
//! Returns the current mesh //! Returns the current mesh
virtual IAnimatedMesh* getMesh(void) = 0; virtual IAnimatedMesh* getMesh(void) = 0;
// returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, //! 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 //! or the absolutetransformation if it's a normal scenenode
virtual const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname) = 0; virtual const SMD3QuaterionTag& getMD3TagTransformation( const core::stringc & tagname) = 0;
//! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set) //! Set how the joints should be updated on render
//! 0-do nothing
//! 1-get joints positions from the mesh (for attached nodes, etc)
//! 2-control joint positions in the mesh (eg. ragdolls, or set the animation from animateJoints() )
virtual void setJointMode(s32 mode)=0; virtual void setJointMode(s32 mode)=0;
//! Sets the transition time in seconds (note: This needs to enable joints, and setJointmode maybe set to 2) //! 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 //! you must call animateJoints(), or the mesh will not animate
virtual void setTransitionTime(f32 Time) =0; virtual void setTransitionTime(f32 Time) =0;
//! updates the joint positions of this mesh //! animates the joints in the mesh based on the current frame (also takes in to account transitions)
virtual void animateJoints() = 0; virtual void animateJoints() = 0;
}; };
......
...@@ -584,6 +584,7 @@ IShadowVolumeSceneNode* CAnimatedMeshSceneNode::addShadowVolumeSceneNode(s32 id, ...@@ -584,6 +584,7 @@ IShadowVolumeSceneNode* CAnimatedMeshSceneNode::addShadowVolumeSceneNode(s32 id,
IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName) IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
{ {
...@@ -609,7 +610,21 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName) ...@@ -609,7 +610,21 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
return 0; return 0;
} }
return (IBoneSceneNode*)JointChildSceneNodes[number]; //JointChildSceneNodes will only be IBoneSceneNode later return getJointNode((u32)number);
}
IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(u32 jointID)
{
if (JointChildSceneNodes.size() <= jointID)
{
os::Printer::log("Joint not loaded into node", ELL_WARNING);
return 0;
}
return JointChildSceneNodes[jointID];
} }
...@@ -621,7 +636,7 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName) ...@@ -621,7 +636,7 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
ISceneNode* CAnimatedMeshSceneNode::getMS3DJointNode(const c8* jointName) ISceneNode* CAnimatedMeshSceneNode::getMS3DJointNode(const c8* jointName)
{ {
//return getJointNode(jointName); return getJointNode(jointName);
return 0; return 0;
} }
...@@ -631,7 +646,7 @@ ISceneNode* CAnimatedMeshSceneNode::getMS3DJointNode(const c8* jointName) ...@@ -631,7 +646,7 @@ ISceneNode* CAnimatedMeshSceneNode::getMS3DJointNode(const c8* jointName)
//! the corrsesponding joint, if the mesh in this scene node is a ms3d mesh. //! the corrsesponding joint, if the mesh in this scene node is a ms3d mesh.
ISceneNode* CAnimatedMeshSceneNode::getXJointNode(const c8* jointName) ISceneNode* CAnimatedMeshSceneNode::getXJointNode(const c8* jointName)
{ {
//return getJointNode(jointName); return getJointNode(jointName);
return 0; return 0;
} }
......
...@@ -79,12 +79,13 @@ namespace scene ...@@ -79,12 +79,13 @@ namespace scene
//! the corrsesponding joint, if the mesh in this scene node is a skinned mesh. //! the corrsesponding joint, if the mesh in this scene node is a skinned mesh.
virtual IBoneSceneNode* getJointNode(const c8* jointName); virtual IBoneSceneNode* getJointNode(const c8* jointName);
//! Returns a pointer to a child node, which has the same transformation as //! same as getJointNode(const c8* jointName), but based on id
//! the corrsesponding joint, if the mesh in this scene node is a ms3d mesh. virtual IBoneSceneNode* getJointNode(u32 jointID);
//! Redundant command, please use getJointNode.
virtual ISceneNode* getMS3DJointNode(const c8* jointName); virtual ISceneNode* getMS3DJointNode(const c8* jointName);
//! Returns a pointer to a child node, which has the same transformation as //! Redundant command, please use getJointNode.
//! the corrsesponding joint, if the mesh in this scene node is a x mesh.
virtual ISceneNode* getXJointNode(const c8* jointName); virtual ISceneNode* getXJointNode(const c8* jointName);
//! Removes a child from this scene node. //! Removes a child from this scene node.
......
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