Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# ISkinnedMesh.h

Go to the documentation of this file.

    00001 // Copyright (C) 2002-2009 Nikolaus Gebhardt
    00002 // This file is part of the "Irrlicht Engine".
    00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
    00004
    00005 #ifndef __I_SKINNED_MESH_H_INCLUDED__
    00006 #define __I_SKINNED_MESH_H_INCLUDED__
    00007
    00008 #include "irrArray.h"
    00009 #include "IBoneSceneNode.h"
    00010 #include "IAnimatedMesh.h"
    00011 #include "SSkinMeshBuffer.h"
    00012
    00013 namespace irr
    00014 {
    00015 namespace scene
    00016 {
    00017
    00018         enum E_INTERPOLATION_MODE
    00019         {
    00020                 // constant does use the current key-values without interpolation
    00021                 EIM_CONSTANT = 0,
    00022
    00023                 // linear interpolation
    00024                 EIM_LINEAR,
    00025
    00027                 EIM_COUNT
    00028         };
    00029
    00030
    00032         class ISkinnedMesh : public IAnimatedMesh
    00033         {
    00034         public:
    00035
    00037
    00038                 virtual u32 getJointCount() const = 0;
    00039
    00041
    00044                 virtual const c8* getJointName(u32 number) const = 0;
    00045
    00047
    00049                 virtual s32 getJointNumber(const c8* name) const = 0;
    00050
    00052
    00057                 virtual bool useAnimationFrom(const ISkinnedMesh *mesh) = 0;
    00058
    00060
    00063                 virtual void updateNormalsWhenAnimating(bool on) = 0;
    00064
    00066                 virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) = 0;
    00067
    00069                 virtual void animateMesh(f32 frame, f32 blend)=0;
    00070
    00072                 virtual void skinMesh() = 0;
    00073
    00075
    00076                 virtual void convertMeshToTangents() = 0;
    00077
    00079                 /* This feature is not implementated in Irrlicht yet */
    00080                 virtual bool setHardwareSkinning(bool on) = 0;
    00081
    00083                 struct SWeight
    00084                 {
    00086                         u16 buffer_id; //I doubt 32bits is needed
    00087
    00089                         u32 vertex_id; //Store global ID here
    00090
    00092                         f32 strength;
    00093
    00094                 private:
    00096                         friend class CSkinnedMesh;
    00097                         bool *Moved;
    00098                         core::vector3df StaticPos;
    00099                         core::vector3df StaticNormal;
    00100                 };
    00101
    00102
    00104                 struct SPositionKey
    00105                 {
    00106                         f32 frame;
    00107                         core::vector3df position;
    00108                 };
    00109
    00111                 struct SScaleKey
    00112                 {
    00113                         f32 frame;
    00114                         core::vector3df scale;
    00115                 };
    00116
    00118                 struct SRotationKey
    00119                 {
    00120                         f32 frame;
    00121                         core::quaternion rotation;
    00122                 };
    00123
    00125                 struct SJoint
    00126                 {
    00127                         SJoint() : UseAnimationFrom(0), LocalAnimatedMatrix_Animated(false), GlobalSkinningSpace(false),
    00128                                 positionHint(-1),scaleHint(-1),rotationHint(-1)
    00129                         {
    00130                         }
    00131
    00133                         core::stringc Name;
    00134
    00136                         core::matrix4 LocalMatrix;
    00137
    00139                         core::array<SJoint*> Children;
    00140
    00142                         core::array<u32> AttachedMeshes;
    00143
    00145                         core::array<SPositionKey> PositionKeys;
    00146
    00148                         core::array<SScaleKey> ScaleKeys;
    00149
    00151                         core::array<SRotationKey> RotationKeys;
    00152
    00154                         core::array<SWeight> Weights;
    00155
    00157                         core::matrix4 GlobalMatrix;
    00158                         core::matrix4 GlobalAnimatedMatrix;
    00159                         core::matrix4 LocalAnimatedMatrix;
    00160                         core::vector3df Animatedposition;
    00161                         core::vector3df Animatedscale;
    00162                         core::quaternion Animatedrotation;
    00163
    00164                         core::matrix4 GlobalInversedMatrix; //the x format pre-calculates this
    00165
    00166                 private:
    00168                         friend class CSkinnedMesh;
    00169
    00170                         SJoint *UseAnimationFrom;
    00171                         bool LocalAnimatedMatrix_Animated;
    00172
    00173                         bool GlobalSkinningSpace;
    00174
    00175                         s32 positionHint;
    00176                         s32 scaleHint;
    00177                         s32 rotationHint;
    00178                 };
    00179
    00180
    00181                 //Interface for the mesh loaders (finalize should lock these functions, and they should have some prefix like loader_
    00182
    00183                 //these functions will use the needed arrays, set values, etc to help the loaders
    00184
    00186                 virtual core::array<SSkinMeshBuffer*>& getMeshBuffers() = 0;
    00187
    00189                 virtual core::array<SJoint*>& getAllJoints() = 0;
    00190
    00192                 virtual const core::array<SJoint*>& getAllJoints() const = 0;
    00193
    00195                 virtual void finalize() = 0;
    00196
    00198                 virtual SSkinMeshBuffer* addMeshBuffer() = 0;
    00199
    00201                 virtual SJoint* addJoint(SJoint *parent=0) = 0;
    00202
    00204                 virtual SWeight* addWeight(SJoint *joint) = 0;
    00205
    00207                 virtual SPositionKey* addPositionKey(SJoint *joint) = 0;
    00209                 virtual SScaleKey* addScaleKey(SJoint *joint) = 0;
    00211                 virtual SRotationKey* addRotationKey(SJoint *joint) = 0;
    00212
    00214                 virtual bool isStatic()=0;
    00215         };
    00216
    00217 } // end namespace scene
    00218 } // end namespace irr
    00219
    00220 #endif
    00221

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Feb 14 13:06:57 2010 by Doxygen (1.6.2)