Commit bda0b6e3 authored by hybrid's avatar hybrid

Merged SkinnedMesh branch 658:895 into trunk.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@896 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f3a8858e
......@@ -7,12 +7,12 @@
#include "IUnknown.h"
#include "aabbox3d.h"
#include "IMesh.h"
namespace irr
{
namespace scene
{
class IMesh;
enum E_ANIMATED_MESH_TYPE
{
......@@ -20,10 +20,10 @@ namespace scene
EAMT_UNKNOWN = 0,
//! Quake 2 MD2 model file
EAMT_MD2,
EAMT_MD2,
//! Quake 3 MD3 model file
EAMT_MD3,
EAMT_MD3,
//! Milkshape 3d skeletal animation file
EAMT_MS3D,
......@@ -37,8 +37,8 @@ namespace scene
//! 3D Studio .3ds file
EAMT_3DS,
//! Microsoft Direct3D .x-file. Can contain static and skeletal animated
//! skinned meshes. This is the standard and best supported
//! Microsoft Direct3D .x-file. Can contain static and skeletal animated
//! skinned meshes. This is the standard and best supported
//! format of the Irrlicht Engine.
EAMT_X,
......@@ -53,20 +53,20 @@ namespace scene
EAMT_CSM,
//! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
//! The oct file format contains 3D geometry and lightmaps and can
//! The oct file format contains 3D geometry and lightmaps and can
//! be loaded directly by Irrlicht
EAMT_OCT,
//! Blitz Basic .b3d file, the file format by Mark Sibly
EAMT_B3D
//! genetic skinned mesh
EAMT_SKINNED
};
//! Interface for an animated mesh.
/** There are already simple implementations of this interface available so
/** There are already simple implementations of this interface available so
you don't have to implement this interface on your own if you need to:
You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
irr::scene::SMeshBuffer etc. */
class IAnimatedMesh : public virtual IUnknown
class IAnimatedMesh : public IMesh
{
public:
......@@ -86,7 +86,7 @@ namespace scene
\param startFrameLoop: Because some animated meshes (.MD2) are blended between 2
static frames, and maybe animated in a loop, the startFrameLoop and the endFrameLoop
have to be defined, to prevent the animation to be blended between frames which are
outside of this loop.
outside of this loop.
If startFrameLoop and endFrameLoop are both -1, they are ignored.
\param endFrameLoop: see startFrameLoop.
\return Returns the animated mesh based on a detail level. */
......
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_B3D_H_INCLUDED__
#define __I_ANIMATED_MESH_B3D_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "irrArray.h"
#include "matrix4.h"
namespace irr
{
namespace scene
{
class ISceneNode;
class ISceneManager;
//! Interface for using some special functions of B3d meshes
/** Please note that the B3d Mesh's frame numbers are scaled by 100 */
class IAnimatedMeshB3d : public IAnimatedMesh
{
public:
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time. This is used for being able to attach
//! objects to parts of animated meshes. For example a weapon to an animated
//! hand.
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \param frame: Frame of the animation.
//! \return Returns a pointer to the matrix of the mesh part or
//! null if an error occured.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame) = 0;
//! Returns a pointer to a local matrix of a Joint, can be used to control the animation
virtual core::matrix4* getLocalMatrixOfJoint(s32 jointNumber) = 0;
//! Returns a pointer to a matrix of a part of the mesh unanimated
virtual core::matrix4* getMatrixOfJointUnanimated(s32 jointNumber) = 0;
//! Move this Joint's local matrix when animating
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \param On: False= Leave joint's local matrix, True= Animate
//! (not used yet)
virtual void setJointAnimation(s32 jointNumber, bool On) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
//!Update Normals when Animating
//!False= Don't (default)
//!True= Update normals, slower
virtual void updateNormalsWhenAnimating(bool on) = 0;
//!Sets Interpolation Mode
//!0- Constant
//!1- Linear (default)
virtual void setInterpolationMode(s32 mode) = 0;
//!Want should happen on when animating
//!0-Nothing
//!1-Update nodes only
//!2-Update skin only
//!3-Update both nodes and skin (default)
virtual void setAnimateMode(s32 mode) = 0;
//!Convert all mesh buffers to use tangent vertices
virtual void convertToTangents() =0;
virtual void recoverJointsFromMesh(core::array<ISceneNode*> &JointChildSceneNodes)=0;
virtual void tranferJointsToMesh(core::array<ISceneNode*> &JointChildSceneNodes)=0;
virtual void createJoints(core::array<ISceneNode*> &JointChildSceneNodes, ISceneNode* AnimatedMeshSceneNode, ISceneManager* SceneManager)=0;
};
} // end namespace scene
} // end namespace irr
#endif
// Copyright (C) 2002-2007 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
#ifndef __I_ANIMATED_MESH_MS3D_H_INCLUDED__
#define __I_ANIMATED_MESH_MS3D_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "matrix4.h"
namespace irr
{
namespace scene
{
//! Interface for using some special functions of MS3D meshes
class IAnimatedMeshMS3D : public IAnimatedMesh
{
public:
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time. This is used for being able to attach
//! objects to parts of animated meshes. For example a weapon to an animated
//! hand.
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshMS3D::getJointCount()-1;
//! \param frame: Frame of the animation.
//! \return Returns a pointer to the matrix of the mesh part or
//! null if an error occured.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshMS3D::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
};
} // end namespace scene
} // end namespace irr
#endif
......@@ -6,6 +6,7 @@
#define __I_ANIMATED_MESH_SCENE_NODE_H_INCLUDED__
#include "ISceneNode.h"
#include "IBoneSceneNode.h"
#include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshMD3.h"
#include "IShadowVolumeSceneNode.h"
......@@ -54,7 +55,7 @@ namespace scene
//! \param frame: Number of the frame to let the animation be started from.
//! The frame number must be a valid frame number of the IMesh used by this
//! scene node. Set IAnimatedMesh::getMesh() for details.
virtual void setCurrentFrame(s32 frame) = 0;
virtual void setCurrentFrame(f32 frame) = 0;
//! Sets the frame numbers between the animation is looped.
//! The default is 0 - MaximalFrameCount of the mesh.
......@@ -84,6 +85,7 @@ namespace scene
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(s32 id=-1,
bool zfailmethod=true, f32 infinity=10000.0f) = 0;
//! 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 ms3d mesh.
//! Otherwise 0 is returned. With this method it is possible to
......@@ -92,26 +94,26 @@ namespace scene
//! animated model. This example shows how:
//! \code
//! ISceneNode* hand =
//! yourMS3DAnimatedMeshSceneNode->getMS3DJointNode("LeftHand");
//! yourAnimatedMeshSceneNode->getJointNode("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.
//! before this call and is created by it. (Todo: Rewrite)
//! \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 IBoneSceneNode* getJointNode(const c8* jointName)=0;
//! 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 x mesh.
//! the corresponding joint, if the mesh in this scene node is a ms3d 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");
//! yourMS3DAnimatedMeshSceneNode->getMS3DJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
......@@ -120,17 +122,17 @@ namespace scene
//! \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* getMS3DJointNode(const c8* jointName) = 0;
//! 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 b3d mesh.
//! 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 =
//! yourB3DAnimatedMeshSceneNode->getB3DJointNode("LeftHand");
//! yourMS3DAnimatedMeshSceneNode->getXJointNode("LeftHand");
//! hand->addChild(weaponSceneNode);
//! \endcode
//! Please note that the SceneNode returned by this method may not exist
......@@ -139,7 +141,7 @@ namespace scene
//! \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* getB3DJointNode(const c8* jointName) = 0;
virtual ISceneNode* getXJointNode(const c8* jointName) = 0;
//! Starts a default MD2 animation.
//! With this method it is easily possible to start a Run, Attack,
......@@ -165,7 +167,7 @@ namespace scene
virtual bool setMD2Animation(const c8* animationName) = 0;
//! Returns the current displayed frame number.
virtual s32 getFrameNr() const = 0;
virtual f32 getFrameNr() const = 0;
//! Returns the current start frame number.
virtual s32 getStartFrame() const = 0;
//! Returns the current end frame number.
......@@ -199,6 +201,16 @@ namespace scene
// or the absolutetransformation if it's a normal scenenode
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)
virtual void setJointMode(s32 mode)=0;
//! 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
virtual void setTransitionTime(f32 Time) =0;
//! updates the joint positions of this mesh
virtual void animateJoints() = 0;
};
} // end namespace scene
......
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ANIMATED_MESH_X_H_INCLUDED__
#define __I_ANIMATED_MESH_X_H_INCLUDED__
#include "IAnimatedMesh.h"
#include "irrArray.h"
#include "matrix4.h"
namespace irr
{
namespace scene
{
//! Interface for using some special functions of X meshes
class IAnimatedMeshX : public IAnimatedMesh
{
public:
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time. This is used for being able to attach
//! objects to parts of animated meshes. For example a weapon to an animated
//! hand.
//! \param jointNumber: Zero based index of joint. The last joint has the number
//! IAnimatedMeshX::getJointCount()-1;
//! \param frame: Frame of the animation.
//! \return Returns a pointer to the matrix of the mesh part or
//! null if an error occured.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame) = 0;
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshX::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
//! Returns a pointer to list of points containing the skeleton.
//! Draw a line between point 1 and 2, and 3 and 4 and 5 and 6
//! and so on to visualize this. Only for debug purposes. If you
//! use an .x-File with the IAnimatedMeshSceneNode and turn DebugDataVisible
//! to true, the Scene node will visualize the skeleton using this
//! method.
virtual const core::array<core::vector3df>* getDrawableSkeleton(s32 frame) = 0;
//! Returns amount of animations in .X-file.
virtual s32 getAnimationCount() const = 0;
//! Returns the name of an animation.
//! \param idx: Zero based Index of the animation. Must be a value between
//! 0 and getAnimationCount()-1;
//! \return Returns pointer to the string of the name of the animation.
//! Returns 0 if an animation with this index does not exist.
virtual const c8* getAnimationName(s32 idx) const = 0;
//! Sets an animation as animation to play back.
//! \param idx: Zero based Index of the animation. Must be a value between
//! 0 and getAnimationCount()-1;
virtual void setCurrentAnimation(s32 idx) = 0;
//! Sets an animation as animation to play back.
//! \param name: Name of the animtion.
//! \return Returns true if successful, and false if the specified animation
//! does not exist.
virtual bool setCurrentAnimation(const c8* name) = 0;
};
} // end namespace scene
} // end namespace irr
#endif
#ifndef __I_BONE_SCENE_NODE_H_INCLUDED__
#define __I_BONE_SCENE_NODE_H_INCLUDED__
// Used with SkinnedMesh and IAnimatedMeshSceneNode, for boned meshes
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
//! Enumeration for different bone animation modes
enum E_BONE_ANIMATION_MODE
{
//! The bone is usually animated, unless it's parent is not animated
EBAM_AUTOMATIC=0,
//! The bone is animated by the skin, if it's parent is not animated
//! then animation will resume from this bone onward
EBAM_ANIMATED,
//! The bone is not animated by the skin
EBAM_UNANIMATED,
//! Not an animation mode, just here to count the available modes
EBAM_COUNT
};
//! Names for bone animation modes
const c8* const BoneAnimationModeNames[] =
{
"automatic",
"animated",
"unanimated",
0,
};
class IBoneSceneNode : public ISceneNode
{
public:
IBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1) :
ISceneNode(parent, mgr, id),positionHint(-1),scaleHint(-1),rotationHint(-1) { }
//! Returns the name of the bone
virtual const c8* getBoneName() const = 0;
//! Returns the index of the bone
virtual u32 getBoneIndex() const = 0;
//! Sets the animation mode of the bone. Returns true if successful.
virtual bool setAnimationMode(E_BONE_ANIMATION_MODE mode) = 0;
//! Gets the current animation mode of the bone
virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
//! returns the axis aligned bounding box of this node
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
//! Returns the relative transformation of the scene node.
//virtual core::matrix4 getRelativeTransformation() const = 0;
virtual void OnAnimate(u32 timeMs) =0;
//! Does nothing as bones are not visible
virtual void render() { };
virtual void setAbsoluteTransformation(core::matrix4 transformation)
{
AbsoluteTransformation=transformation;
}
//! updates the absolute position based on the relative and the parents position
virtual void updateAbsolutePositionOfAllChildren()=0;
s32 positionHint;
s32 scaleHint;
s32 rotationHint;
};
} // end namespace scene
} // end namespace irr
#endif
// Copyright (C) 2002-2006 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SKINNED_MESH_H_INCLUDED__
#define __I_SKINNED_MESH_H_INCLUDED__
#include "irrArray.h"
#include "IBoneSceneNode.h"
#include "IAnimatedMesh.h"
#include "SSkinMeshBuffer.h"
namespace irr
{
namespace scene
{
enum E_INTERPOLATION_MODE
{
// constant interpolation
EIM_CONSTANT = 0,
// linear interpolation
EIM_LINEAR,
//! count of all available interpolation modes
EIM_COUNT
};
//! Interface for using some special functions of Skinned meshes
class ISkinnedMesh : public IAnimatedMesh
{
public:
//! Gets joint count.
//! \return Returns amount of joints in the skeletal animated mesh.
virtual s32 getJointCount() const = 0;
//! Gets the name of a joint.
//! \param number: Zero based index of joint. The last joint has the number
//! IAnimatedMeshB3d::getJointCount()-1;
//! \return Returns name of joint and null if an error happened.
virtual const c8* getJointName(s32 number) const = 0;
//! Gets a joint number from its name
//! \param name: Name of the joint.
//! \return Returns the number of the joint or -1 if not found.
virtual s32 getJointNumber(const c8* name) const = 0;
//! uses animation from another mesh
//! the animation is linked (not copied) based on joint names (so make sure they are unique)
//! \return Returns true if all joints in this mesh were matched up (empty names will not be matched, and it's case sensitive)
//! unmatched joints will not be animated
virtual bool useAnimationFrom(ISkinnedMesh *mesh) = 0;
//!Update Normals when Animating
//!False= Don't (default)
//!True= Update normals, slower
virtual void updateNormalsWhenAnimating(bool on) = 0;
//!Sets Interpolation Mode
virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) = 0;
//! Animates this mesh's joints based on frame input
virtual void animateMesh(f32 frame, f32 blend)=0;
//! Preforms a software skin on this mesh based of joint positions
virtual void skinMesh() = 0;
//!Recovers the joints from the mesh
virtual void recoverJointsFromMesh(core::array<IBoneSceneNode*> &JointChildSceneNodes) = 0;
//!Tranfers the joint data to the mesh
virtual void tranferJointsToMesh(core::array<IBoneSceneNode*> &JointChildSceneNodes) = 0;
//!Creates an array of joints from this mesh
virtual void createJoints(core::array<IBoneSceneNode*> &JointChildSceneNodes,
IAnimatedMeshSceneNode* AnimatedMeshSceneNode, ISceneManager* SceneManager) = 0;
virtual void convertMeshToTangents() = 0;
//! A vertex weight
struct SWeight
{
//! Index of the mesh buffer
u16 buffer_id; //I doubt 32bits is needed
//! Index of the vertex
u32 vertex_id; //Store global ID here
//! Weight Strength/Percentage (0-1)
f32 strength;
private:
//! Internal members used by CSkinnedMesh
friend class CSkinnedMesh;
bool *Moved;
core::vector3df StaticPos;
core::vector3df StaticNormal;
};
//! Animation keyframe which describes a new position, scale or rotation
struct SPositionKey
{
f32 frame;
core::vector3df position;
};
struct SScaleKey
{
f32 frame;
core::vector3df scale;
};
struct SRotationKey
{
f32 frame;
core::quaternion rotation;
};
//! Joints
struct SJoint
{
SJoint() :
Name(""), LocalMatrix(),
Children(), PositionKeys(), ScaleKeys(), RotationKeys(), Weights(),
UseAnimationFrom(0), LocalAnimatedMatrix_Animated(false),positionHint(-1),scaleHint(-1),rotationHint(-1)
{
}
//! The name of this joint
core::stringc Name;
//! Local matrix of this joint
core::matrix4 LocalMatrix;
//! List of child joints
core::array<SJoint*> Children;
//! Animation keys causing translation change
core::array<SPositionKey> PositionKeys;
//! Animation keys causing scale change
core::array<SScaleKey> ScaleKeys;
//! Animation keys causing rotation change
core::array<SRotationKey> RotationKeys;
//! Skin weights
core::array<SWeight> Weights;
//! Unnecessary for loaders, will be overwritten on finalize
core::matrix4 GlobalMatrix;
core::matrix4 GlobalAnimatedMatrix;
core::matrix4 LocalAnimatedMatrix;
core::vector3df Animatedposition;
core::vector3df Animatedscale;
core::quaternion Animatedrotation;
core::matrix4 GlobalInversedMatrix; //the x format pre-calculates this
private:
//! Internal members used by CSkinnedMesh
friend class CSkinnedMesh;
SJoint *UseAnimationFrom;
bool LocalAnimatedMatrix_Animated;
s32 positionHint;
s32 scaleHint;
s32 rotationHint;
};
//Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_
//these functions will use the needed arrays, set vaules, etc to help the loaders
//! exposed for loaders to add mesh buffers
virtual core::array<SSkinMeshBuffer*> &getMeshBuffers() = 0;
//! alternative method for adding joints
virtual core::array<SJoint*> &getAllJoints() = 0;
//! loaders should call this after populating the mesh
virtual void finalize() = 0;
virtual SSkinMeshBuffer *createBuffer() = 0;
virtual SJoint *createJoint(SJoint *parent=0) = 0;
virtual SPositionKey *createPositionKey(SJoint *joint) = 0;
virtual SScaleKey *createScaleKey(SJoint *joint) = 0;
virtual SRotationKey *createRotationKey(SJoint *joint) = 0;
virtual SWeight *createWeight(SJoint *joint) = 0;
};
} // end namespace scene
} // end namespace irr
#endif
......@@ -6,7 +6,7 @@
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Irrlicht SDK Version
#define IRRLICHT_SDK_VERSION "1.3.1"
#define IRRLICHT_SDK_VERSION "1.4RC"
//! The defines for different operating system are:
//! _IRR_XBOX_PLATFORM_ for XBox
......@@ -213,6 +213,46 @@ Note that the engine will run in D3D REF for this, which is a lot slower than HA
//#define BURNINGVIDEO_RENDERER_ULTRA_FAST
//! Define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_ if you want to use bone based
/** animated meshes. If you compile without this, you will be unable to load
B3D, MS3D or X meshes */
#define _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
#ifdef _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
//! Define _IRR_COMPILE_WITH_B3D_LOADER_ if you want to use Blitz3D files
#define _IRR_COMPILE_WITH_B3D_LOADER_
//! Define _IRR_COMPILE_WITH_B3D_LOADER_ if you want to Milkshape files
#define _IRR_COMPILE_WITH_MS3D_LOADER_
//! Define _IRR_COMPILE_WITH_X_LOADER_ if you want to use Microsoft X files
#define _IRR_COMPILE_WITH_X_LOADER_
#endif
//! Define _IRR_COMPILE_WITH_MD2_LOADER_ if you want to load Quake 2 animated files
#define _IRR_COMPILE_WITH_MD2_LOADER_
//! Define _IRR_COMPILE_WITH_MD3_LOADER_ if you want to load Quake 3 animated files
#define _IRR_COMPILE_WITH_MD3_LOADER_
//! Define _IRR_COMPILE_WITH_3DS_LOADER_ if you want to load 3D Studio Max files
#define _IRR_COMPILE_WITH_3DS_LOADER_
//! Define _IRR_COMPILE_WITH_COLLADA_LOADER_ if you want to load Collada files
#define _IRR_COMPILE_WITH_COLLADA_LOADER_
//! Define _IRR_COMPILE_WITH_CSM_LOADER_ if you want to load Cartography Shop files
#define _IRR_COMPILE_WITH_CSM_LOADER_
//! Define _IRR_COMPILE_WITH_BSP_LOADER_ if you want to load Quake 3 BSP files
#define _IRR_COMPILE_WITH_BSP_LOADER_
//! Define _IRR_COMPILE_WITH_DMF_LOADER_ if you want to load DeleD files
#define _IRR_COMPILE_WITH_DMF_LOADER_
//! Define _IRR_COMPILE_WITH_LMTS_LOADER_ if you want to load LMTools files
#define _IRR_COMPILE_WITH_LMTS_LOADER_
//! Define _IRR_COMPILE_WITH_MY3D_LOADER_ if you want to load MY3D files
#define _IRR_COMPILE_WITH_MY3D_LOADER_
//! Define _IRR_COMPILE_WITH_OBJ_LOADER_ if you want to load Wavefront OBJ files
#define _IRR_COMPILE_WITH_OBJ_LOADER_
//! Define _IRR_COMPILE_WITH_OCT_LOADER_ if you want to load FSRad OCT files
#define _IRR_COMPILE_WITH_OCT_LOADER_
//! Define _IRR_COMPILE_WITH_OGRE_LOADER_ if you want to load Ogre 3D files
#define _IRR_COMPILE_WITH_OGRE_LOADER_
//! Set FPU settings
/** Irrlicht should use approximate float and integer fpu techniques
precision will be lower but speed higher. currently X86 only
......
......@@ -63,7 +63,7 @@ namespace scene
//! 255 the highest level of detail. Most meshes will ignore the detail level.
//! \param startFrameLoop: start frame
//! \param endFrameLoop: end frame
//! \return Returns the animated mesh based on a detail level.
//! \return Returns the animated mesh based on a detail level.
virtual IMesh* getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop=-1, s32 endFrameLoop=-1)
{
if (Meshes.empty())
......@@ -83,7 +83,7 @@ namespace scene
}
}
//! Returns an axis aligned bounding box of the mesh.
//! \return A bounding box of this mesh is returned.
virtual const core::aabbox3d<f32>& getBoundingBox() const
......@@ -107,16 +107,42 @@ namespace scene
Box = Meshes[0]->getBoundingBox();
for (u32 i=1; i<Meshes.size(); ++i)
Box.addInternalBox(Meshes[i]->getBoundingBox());
Box.addInternalBox(Meshes[i]->getBoundingBox());
}
//! Returns the type of the animated mesh.
virtual E_ANIMATED_MESH_TYPE getMeshType() const
{
return Type;
}
//! returns amount of mesh buffers.
virtual u32 getMeshBufferCount() const
{
return 0;
}
//! returns pointer to a mesh buffer
virtual IMeshBuffer* getMeshBuffer(u32 nr) const
{
return 0;
}
//! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
{
return 0;
}
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
return;
}
core::aabbox3d<f32> Box;
core::array<IMesh*> Meshes;
E_ANIMATED_MESH_TYPE Type;
......
// Copyright (C) 2002-2006 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SKIN_MESH_BUFFER_H_INCLUDED__
#define __I_SKIN_MESH_BUFFER_H_INCLUDED__
#include "IMeshBuffer.h"
#include "S3DVertex.h"
namespace irr
{
namespace scene
{
//! A mesh buffer able to choose between
//! S3DVertex2TCoords, S3DVertex and S3DVertexTangents at runtime
struct SSkinMeshBuffer : public IMeshBuffer
{
SSkinMeshBuffer(video::E_VERTEX_TYPE vt=video::EVT_STANDARD) : VertexType(vt)
{
#ifdef _DEBUG
setDebugName("SSkinMeshBuffer");
#endif
}
virtual ~SSkinMeshBuffer() {}
virtual const video::SMaterial& getMaterial() const
{
return Material;
}
virtual video::SMaterial& getMaterial()
{
return Material;
}
virtual video::S3DVertex *getVertex(u32 index)
{
switch (VertexType)
{
case video::EVT_2TCOORDS: return (video::S3DVertex*)&Vertices_2TCoords[index];
case video::EVT_TANGENTS: return (video::S3DVertex*)&Vertices_Tangents[index];
default: return &Vertices_Standard[index];
}
}
virtual const void* getVertices() const
{
switch (VertexType)
{
case video::EVT_2TCOORDS: return Vertices_2TCoords.const_pointer();
case video::EVT_TANGENTS: return Vertices_Tangents.const_pointer();
default: return Vertices_Standard.const_pointer();
}
}
virtual void* getVertices()
{
switch (VertexType)
{
case video::EVT_2TCOORDS: return Vertices_2TCoords.pointer();
case video::EVT_TANGENTS: return Vertices_Tangents.pointer();
default: return Vertices_Standard.pointer();
}
}
virtual u32 getVertexCount() const
{
switch (VertexType)
{
case video::EVT_2TCOORDS: return Vertices_2TCoords.size();
case video::EVT_TANGENTS: return Vertices_Tangents.size();
default: return Vertices_Standard.size();
}
}
virtual const u16* getIndices() const
{
return Indices.const_pointer();
}
virtual u16* getIndices()
{
return Indices.pointer();
}
virtual u32 getIndexCount() const
{
return Indices.size();
}
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return BoundingBox;
}
virtual void setBoundingBox( const core::aabbox3df& box)
{
BoundingBox = box;
}
virtual void recalculateBoundingBox()
{
switch (VertexType)
{
case video::EVT_STANDARD:
{
if (Vertices_Standard.empty())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset(Vertices_Standard[0].Pos);
for (u32 i=1; i<Vertices_Standard.size(); ++i)
BoundingBox.addInternalPoint(Vertices_Standard[i].Pos);
}
break;
}
case video::EVT_2TCOORDS:
{
if (Vertices_2TCoords.empty())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset(Vertices_2TCoords[0].Pos);
for (u32 i=1; i<Vertices_2TCoords.size(); ++i)
BoundingBox.addInternalPoint(Vertices_2TCoords[i].Pos);
}
break;
}
case video::EVT_TANGENTS:
{
if (Vertices_Tangents.empty())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset(Vertices_Tangents[0].Pos);
for (u32 i=1; i<Vertices_Tangents.size(); ++i)
BoundingBox.addInternalPoint(Vertices_Tangents[i].Pos);
}
break;
}
}
}
virtual video::E_VERTEX_TYPE getVertexType() const
{
return VertexType;
}
//! returns the byte size (stride, pitch) of the vertex
virtual u32 getVertexPitch() const
{
switch (VertexType)
{
case video::EVT_2TCOORDS: return sizeof(video::S3DVertex2TCoords);
case video::EVT_TANGENTS: return sizeof(video::S3DVertexTangents);
default: return sizeof(video::S3DVertex);
}
}
virtual void MoveTo_2TCoords()
{
if (VertexType==video::EVT_STANDARD)
{
for(u32 n=0;n<Vertices_Standard.size();++n)
{
video::S3DVertex2TCoords Vertex;
Vertex.Color=Vertices_Standard[n].Color;
Vertex.Pos=Vertices_Standard[n].Pos;
Vertex.Normal=Vertices_Standard[n].Normal;
Vertex.TCoords=Vertices_Standard[n].TCoords;
Vertices_2TCoords.push_back(Vertex);
}
Vertices_Standard.clear();
VertexType=video::EVT_2TCOORDS;
}
}
virtual void MoveTo_Tangents()
{
if (VertexType==video::EVT_STANDARD)
{
for(u32 n=0;n<Vertices_Standard.size();++n)
{
video::S3DVertexTangents Vertex;
Vertex.Color=Vertices_Standard[n].Color;
Vertex.Pos=Vertices_Standard[n].Pos;
Vertex.Normal=Vertices_Standard[n].Normal;
Vertex.TCoords=Vertices_Standard[n].TCoords;
Vertices_Tangents.push_back(Vertex);
}
Vertices_Standard.clear();
VertexType=video::EVT_TANGENTS;
}
else if (VertexType==video::EVT_2TCOORDS)
{
for(u32 n=0;n<Vertices_2TCoords.size();++n)
{
video::S3DVertexTangents Vertex;
Vertex.Color=Vertices_2TCoords[n].Color;
Vertex.Pos=Vertices_2TCoords[n].Pos;
Vertex.Normal=Vertices_2TCoords[n].Normal;
Vertex.TCoords=Vertices_2TCoords[n].TCoords;
Vertices_Tangents.push_back(Vertex);
}
Vertices_2TCoords.clear();
VertexType=video::EVT_TANGENTS;
}
}
//! append the vertices and indices to the current buffer
virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {}
//! append the meshbuffer to the current buffer
virtual void append(const IMeshBuffer* const other) {}
video::SMaterial Material;
video::E_VERTEX_TYPE VertexType;
core::array<video::S3DVertexTangents> Vertices_Tangents;
core::array<video::S3DVertex2TCoords> Vertices_2TCoords;
core::array<video::S3DVertex> Vertices_Standard;
core::array<u16> Indices;
core::aabbox3d<f32> BoundingBox;
};
} // end namespace scene
} // end namespace irr
#endif
......@@ -18,11 +18,11 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Please note that the Irrlicht Engine is based in part on the work of the
Please note that the Irrlicht Engine is based in part on the work of the
Independent JPEG Group, the zlib and the libPng. This means that if you use
the Irrlicht Engine in your product, you must acknowledge somewhere in your
documentation that you've used the IJG code. It would also be nice to mention
that you use the Irrlicht Engine, the zlib and libPng. See the README files
that you use the Irrlicht Engine, the zlib and libPng. See the README files
in the jpeglib, the zlib and libPng for further informations.
*/
......@@ -43,13 +43,10 @@
#include "IAnimatedMesh.h"
#include "IAnimatedMeshMD2.h"
#include "IAnimatedMeshMD3.h"
#include "IAnimatedMeshMS3D.h"
#include "IAnimatedMeshMS3D.h"
#include "IQ3LevelMesh.h"
#include "IAnimatedMeshX.h"
#include "IAnimatedMeshB3d.h"
#include "IAnimatedMeshSceneNode.h"
#include "IBillboardSceneNode.h"
#include "IBoneSceneNode.h"
#include "ICameraSceneNode.h"
#include "IDummyTransformationSceneNode.h"
#include "IEventReceiver.h"
......@@ -104,6 +101,7 @@
#include "ISceneNodeAnimatorCollisionResponse.h"
#include "IShaderConstantSetCallBack.h"
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
#include "ISkinnedMesh.h"
#include "ITerrainSceneNode.h"
#include "ITextSceneNode.h"
#include "ITexture.h"
......@@ -147,8 +145,8 @@
* Welcome to the Irrlicht Engine API documentation.
* Here you'll find any information you'll need to develop applications with
* the Irrlicht Engine. If you are looking for a tutorial on how to start, you'll
* find some on the homepage of the Irrlicht Engine at
* <A HREF="http://irrlicht.sourceforge.net" >irrlicht.sourceforge.net</A>
* find some on the homepage of the Irrlicht Engine at
* <A HREF="http://irrlicht.sourceforge.net" >irrlicht.sourceforge.net</A>
* or inside the SDK in the examples directory.
*
* The Irrlicht Engine is intended to be an easy-to-use 3d engine, so
......@@ -166,7 +164,7 @@
*
* \section irrexample Short example
*
* A simple application, starting up the engine, loading a Quake 2 animated
* A simple application, starting up the engine, loading a Quake 2 animated
* model file and the corresponding texture, animating and displaying it
* in front of a blue background and placing a user controlable 3d camera
* would look like the following code. I think this example shows the usage
......@@ -200,7 +198,7 @@
*
* // add a first person shooter style user controlled camera
* scenemgr->addCameraSceneNodeFPS();
*
*
* // draw everything
* while(device->run() && driver)
* {
......@@ -231,10 +229,10 @@
*
* As you can see, the engine uses namespaces. Everything in the engine is
* placed into the namespace 'irr', but there are also 5 sub namespaces.
* You can find a list of all namespaces with descriptions at the
* <A HREF="namespaces.html"> namespaces page</A>.
* You can find a list of all namespaces with descriptions at the
* <A HREF="namespaces.html"> namespaces page</A>.
* This is also a good place to start reading the documentation. If you
* don't want to write the namespace names all the time, just use all namespaces like
* don't want to write the namespace names all the time, just use all namespaces like
* this:
* \code
* using namespace core;
......@@ -257,7 +255,7 @@ namespace irr
//! Creates an Irrlicht device. The Irrlicht device is the root object for using the engine.
/** If you need more parameters to be passed to the creation of the Irrlicht Engine device,
use the createDeviceEx() function.
\param deviceType: Type of the device. This can currently be video::EDT_NULL,
\param deviceType: Type of the device. This can currently be video::EDT_NULL,
video::EDT_SOFTWARE, video::EDT_BURNINGSVIDEO, video::EDT_DIRECT3D8, video::EDT_DIRECT3D9 and video::EDT_OPENGL.
\param windowSize: Size of the window or the video mode in fullscreen mode.
\param bits: Bits per pixel in fullscreen mode. Ignored if windowed mode.
......@@ -266,7 +264,7 @@ namespace irr
\param stencilbuffer: Specifies if the stencil buffer should be enabled. Set this to true,
if you want the engine be able to draw stencil buffer shadows. Note that not all
devices are able to use the stencil buffer. If they don't no shadows will be drawn.
\param vsync: Specifies vertical syncronisation: If set to true, the driver will wait
\param vsync: Specifies vertical syncronisation: If set to true, the driver will wait
for the vertical retrace period, otherwise not.
\param receiver: A user created event receiver.
\param sdk_version_do_not_use: Don't use or change this parameter. Always set it to
......@@ -284,13 +282,13 @@ namespace irr
IEventReceiver* receiver = 0,
const c8* sdk_version_do_not_use = IRRLICHT_SDK_VERSION);
//! Creates an Irrlicht device with the option to specify advanced parameters.
//! Creates an Irrlicht device with the option to specify advanced parameters.
/** Usually you should used createDevice() for creating an Irrlicht Engine device.
Use this function only if you wish to specify advanced parameters like a window
handle in which the device should be created.
\param parameters: Structure containing advanced parameters for the creation of the device.
See irr::SIrrlichtCreationParameters for details.
\return Returns pointer to the created IrrlichtDevice or null if the
\return Returns pointer to the created IrrlichtDevice or null if the
device could not be created. */
IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(
const SIrrlichtCreationParameters& parameters);
......
......@@ -2,6 +2,9 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_3DS_LOADER_
#include "C3DSMeshFileLoader.h"
#include "os.h"
#include "SMeshBuffer.h"
......@@ -1262,3 +1265,4 @@ void C3DSMeshFileLoader::readString(io::IReadFile* file, ChunkData& data, core::
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_3DS_LOADER_
This diff is collapsed.
......@@ -2,6 +2,9 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_MD2_LOADER_
#include "CAnimatedMeshMD2.h"
#include "os.h"
#include "SColor.h"
......@@ -758,3 +761,4 @@ const c8* CAnimatedMeshMD2::getAnimationName(s32 nr) const
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_MD2_LOADER_
......@@ -18,7 +18,7 @@ namespace irr
namespace scene
{
class CAnimatedMeshMD2 : public IAnimatedMeshMD2, public IMesh
class CAnimatedMeshMD2 : public IAnimatedMeshMD2
{
public:
......@@ -45,7 +45,7 @@ namespace scene
//! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Returns the pointer to the mesh buffer or
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const;
......@@ -62,18 +62,18 @@ namespace scene
virtual E_ANIMATED_MESH_TYPE getMeshType() const;
//! Returns frame loop data for a special MD2 animation type.
virtual void getFrameLoop(EMD2_ANIMATION_TYPE,
virtual void getFrameLoop(EMD2_ANIMATION_TYPE,
s32& outBegin, s32& outEnd, s32& outFps) const;
//! Returns frame loop data for a special MD2 animation type.
virtual bool getFrameLoop(const c8* name,
virtual bool getFrameLoop(const c8* name,
s32& outBegin, s32& outEnd, s32& outFps) const;
//! Returns amount of md2 animations in this file.
virtual s32 getAnimationCount() const;
//! Returns name of md2 animation.
//! \param nr: Zero based index of animation.
//! Returns name of md2 animation.
//! \param nr: Zero based index of animation.
virtual const c8* getAnimationName(s32 nr) const;
private:
......
......@@ -2,6 +2,9 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_MD3_LOADER_
#include "CAnimatedMeshMD3.h"
#include "os.h"
......@@ -411,3 +414,4 @@ E_ANIMATED_MESH_TYPE CAnimatedMeshMD3::getMeshType() const
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_MD3_LOADER_
......@@ -43,6 +43,43 @@ namespace scene
virtual const core::aabbox3d<f32>& getBoundingBox() const;
virtual E_ANIMATED_MESH_TYPE getMeshType() const;
//link?
//! returns amount of mesh buffers.
virtual u32 getMeshBufferCount() const
{
return 0;
}
//! returns pointer to a mesh buffer
virtual IMeshBuffer* getMeshBuffer(u32 nr) const
{
return 0;
}
//! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const
{
return 0;
}
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{
return;
}
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box)
{
return;
}
private:
//! animates one frame
inline void Animate (u32 frame);
......@@ -62,7 +99,7 @@ namespace scene
SCacheInfo ( s32 frame = -1, s32 start = -1, s32 end = -1 )
: Frame ( frame ), startFrameLoop ( start ),
endFrameLoop ( end ) {}
bool operator == ( const SCacheInfo &other ) const
{
return 0 == memcmp ( this, &other, sizeof ( SCacheInfo ) );
......
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ANIMATED_MESH_MS3D_H_INCLUDED__
#define __C_ANIMATED_MESH_MS3D_H_INCLUDED__
#include "IAnimatedMeshMS3D.h"
#include "IMesh.h"
#include "IReadFile.h"
#include "S3DVertex.h"
#include "irrString.h"
#include "SSharedMeshBuffer.h"
namespace irr
{
namespace video
{
class IVideoDriver;
} // end namespace video
namespace scene
{
class CAnimatedMeshMS3D : public IAnimatedMeshMS3D, public IMesh
{
public:
//! constructor
CAnimatedMeshMS3D(video::IVideoDriver* driver);
//! destructor
virtual ~CAnimatedMeshMS3D();
//! loads an md2 file
virtual bool loadFile(io::IReadFile* file);
//! returns the amount of frames in milliseconds. If the amount is 1, it is a static (=non animated) mesh.
virtual s32 getFrameCount();
//! 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.
virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1);
//! returns amount of mesh buffers.
virtual u32 getMeshBufferCount() const;
//! returns pointer to a mesh buffer
virtual IMeshBuffer* getMeshBuffer(u32 nr) const;
//! Returns pointer to a mesh buffer which fits a material
/** \param material: material to search for
\return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const;
//! returns an axis aligned bounding box
virtual const core::aabbox3d<f32>& getBoundingBox() const;
//! set user axis aligned bounding box
virtual void setBoundingBox( const core::aabbox3df& box);
//! sets a flag of all contained materials to a new value
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue);
//! Returns the type of the animated mesh.
virtual E_ANIMATED_MESH_TYPE getMeshType() const;
//! Returns a pointer to a transformation matrix of a part of the
//! mesh based on a frame time.
virtual core::matrix4* getMatrixOfJoint(s32 jointNumber, s32 frame);
//! Gets joint count.
virtual s32 getJointCount() const;
//! Gets the name of a joint.
virtual const c8* getJointName(s32 number) const;
//! Gets a joint number from its name
virtual s32 getJointNumber(const c8* name) const;
private:
struct SKeyframe
{
f32 timeindex;
core::vector3df data; // translation or rotation
};
struct SJoint
{
core::stringc Name;
s32 Index;
core::vector3df Rotation;
core::vector3df Translation;
core::matrix4 RelativeTransformation;
core::matrix4 AbsoluteTransformation;
core::matrix4 AbsoluteTransformationAnimated;
core::array<SKeyframe> TranslationKeys;
core::array<SKeyframe> RotationKeys;
core::array<u16> VertexIds;
s32 Parent;
core::stringc ParentName;
};
struct SGroup
{
core::stringc Name;
core::array<u16> VertexIds;
u16 MaterialIdx;
};
void animate(s32 frame);
void getKeyframeData(const core::array<SKeyframe>& keys, f32 time, core::vector3df& outdata) const;
void getKeyframeRotation(const core::array<SKeyframe>& keys, f32 time, core::vector3df& outdata) const;
core::aabbox3d<f32> BoundingBox;
core::array<video::S3DVertex> Vertices;
core::array<video::S3DVertex> AnimatedVertices;
core::array<u16> Indices;
core::array<SJoint> Joints;
core::array<SGroup> Groups;
core::array<SSharedMeshBuffer> Buffers;
f32 totalTime;
bool HasAnimation;
s32 lastCalculatedFrame;
video::IVideoDriver* Driver;
};
} // end namespace scene
} // end namespace irr
#endif
This diff is collapsed.
......@@ -8,6 +8,9 @@
#include "IAnimatedMeshSceneNode.h"
#include "IAnimatedMesh.h"
#include "matrix4.h"
namespace irr
{
namespace scene
......@@ -28,7 +31,7 @@ namespace scene
virtual ~CAnimatedMeshSceneNode();
//! sets the current frame. from now on the animation is played from this frame.
virtual void setCurrentFrame(s32 frame);
virtual void setCurrentFrame(f32 frame);
//! frame
virtual void OnRegisterSceneNode();
......@@ -72,6 +75,10 @@ namespace scene
virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(s32 id,
bool zfailmethod=true, f32 infinity=10000.0f);
//! Returns a pointer to a child node, which has the same transformation as
//! the corrsesponding joint, if the mesh in this scene node is a skinned mesh.
virtual IBoneSceneNode* getJointNode(const c8* jointName);
//! Returns a pointer to a child node, which has the same transformation as
//! the corrsesponding joint, if the mesh in this scene node is a ms3d mesh.
virtual ISceneNode* getMS3DJointNode(const c8* jointName);
......@@ -80,10 +87,6 @@ namespace scene
//! the corrsesponding joint, if the mesh in this scene node is a x mesh.
virtual ISceneNode* getXJointNode(const c8* jointName);
//! 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 b3d mesh.
virtual ISceneNode* getB3DJointNode(const c8* 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.
......@@ -96,7 +99,7 @@ namespace scene
virtual bool setMD2Animation(const c8* animationName);
//! Returns the current displayed frame number.
virtual s32 getFrameNr() const;
virtual f32 getFrameNr() const;
//! Returns the current start frame number.
virtual s32 getStartFrame() const;
//! Returns the current end frame number.
......@@ -132,9 +135,24 @@ namespace scene
//! updates the absolute position based on the relative and the parents position
virtual void updateAbsolutePosition();
//! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set)
virtual void setJointMode(s32 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
virtual void setTransitionTime(f32 Time);
//! updates the joint positions of this mesh
virtual void animateJoints();
private:
u32 buildFrameNr( u32 timeMs);
f32 buildFrameNr( u32 timeMs);
void checkJoints();
void beginTransition();
core::array<video::SMaterial> Materials;
core::aabbox3d<f32> Box;
......@@ -145,7 +163,15 @@ namespace scene
s32 EndFrame;
f32 FramesPerSecond;
s32 CurrentFrameNr;
f32 CurrentFrameNr;
s32 JointMode; //0-unused, 1-get joints only, 2-set joints only, 3-move and set
bool JointsUsed;
u32 TransitionTime; //Transition time in millisecs
f32 Transiting; //is mesh transiting (plus cache of TransitionTime)
f32 TransitingBlend; //0-1, calculated on buildFrameNr
bool Looping;
bool ReadOnlyMaterials;
......@@ -155,7 +181,9 @@ namespace scene
IShadowVolumeSceneNode* Shadow;
core::array<IDummyTransformationSceneNode* > JointChildSceneNodes;
core::array<IBoneSceneNode* > JointChildSceneNodes;
core::array<core::matrix4> PretransitingSave;
struct SMD3Special
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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