Loading...
Searching...
No Matches
ISkinnedMesh.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 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 does use the current key-values without interpolation
EIM_CONSTANT = 0,
// linear interpolation
EIM_LINEAR,
EIM_COUNT
};
class ISkinnedMesh : public IAnimatedMesh
{
public:
virtual u32 getJointCount() const = 0;
virtual const c8* getJointName(u32 number) const = 0;
virtual s32 getJointNumber(const c8* name) const = 0;
virtual bool useAnimationFrom(const ISkinnedMesh *mesh) = 0;
virtual void updateNormalsWhenAnimating(bool on) = 0;
virtual void setInterpolationMode(E_INTERPOLATION_MODE mode) = 0;
virtual void animateMesh(f32 frame, f32 blend)=0;
virtual void skinMesh() = 0;
virtual void convertMeshToTangents() = 0;
/* This feature is not implementated in Irrlicht yet */
virtual bool setHardwareSkinning(bool on) = 0;
struct SWeight
{
u16 buffer_id; //I doubt 32bits is needed
u32 vertex_id; //Store global ID here
f32 strength;
private:
friend class CSkinnedMesh;
bool *Moved;
core::vector3df StaticPos;
core::vector3df StaticNormal;
};
struct SPositionKey
{
f32 frame;
core::vector3df position;
};
struct SScaleKey
{
f32 frame;
core::vector3df scale;
};
struct SRotationKey
{
f32 frame;
core::quaternion rotation;
};
struct SJoint
{
SJoint() : UseAnimationFrom(0), GlobalSkinningSpace(false),
positionHint(-1),scaleHint(-1),rotationHint(-1)
{
}
core::stringc Name;
core::matrix4 LocalMatrix;
core::array<SJoint*> Children;
core::array<u32> AttachedMeshes;
core::array<SPositionKey> PositionKeys;
core::array<SScaleKey> ScaleKeys;
core::array<SRotationKey> RotationKeys;
core::array<SWeight> Weights;
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:
friend class CSkinnedMesh;
SJoint *UseAnimationFrom;
bool GlobalSkinningSpace;
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 values, etc to help the loaders
virtual core::array<SSkinMeshBuffer*>& getMeshBuffers() = 0;
virtual core::array<SJoint*>& getAllJoints() = 0;
virtual const core::array<SJoint*>& getAllJoints() const = 0;
virtual void finalize() = 0;
virtual SSkinMeshBuffer* addMeshBuffer() = 0;
virtual SJoint* addJoint(SJoint *parent=0) = 0;
virtual SWeight* addWeight(SJoint *joint) = 0;
virtual SPositionKey* addPositionKey(SJoint *joint) = 0;
virtual SScaleKey* addScaleKey(SJoint *joint) = 0;
virtual SRotationKey* addRotationKey(SJoint *joint) = 0;
virtual bool isStatic()=0;
};
} // end namespace scene
} // end namespace irr
#endif
IAnimatedMesh.h
IBoneSceneNode.h
SSkinMeshBuffer.h
irr::core::array
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
irr::core::quaternion
Quaternion class for representing rotations.
Definition quaternion.h:27
irr::scene::IAnimatedMesh
Interface for an animated mesh.
Definition IAnimatedMesh.h:63
irr::scene::ISkinnedMesh
Interface for using some special functions of Skinned meshes.
Definition ISkinnedMesh.h:33
irr::scene::ISkinnedMesh::getJointName
virtual const c8 * getJointName(u32 number) const =0
Gets the name of a joint.
irr::scene::ISkinnedMesh::updateNormalsWhenAnimating
virtual void updateNormalsWhenAnimating(bool on)=0
Update Normals when Animating.
irr::scene::ISkinnedMesh::useAnimationFrom
virtual bool useAnimationFrom(const ISkinnedMesh *mesh)=0
Use animation from another mesh.
irr::scene::ISkinnedMesh::isStatic
virtual bool isStatic()=0
Check if the mesh is non-animated.
irr::scene::ISkinnedMesh::getAllJoints
virtual core::array< SJoint * > & getAllJoints()=0
exposed for loaders: joints list
irr::scene::ISkinnedMesh::skinMesh
virtual void skinMesh()=0
Preforms a software skin on this mesh based of joint positions.
irr::scene::ISkinnedMesh::setHardwareSkinning
virtual bool setHardwareSkinning(bool on)=0
Allows to enable hardware skinning.
irr::scene::ISkinnedMesh::animateMesh
virtual void animateMesh(f32 frame, f32 blend)=0
Animates this mesh's joints based on frame input.
irr::scene::ISkinnedMesh::addRotationKey
virtual SRotationKey * addRotationKey(SJoint *joint)=0
Adds a new rotation key to the mesh, access it as last one.
irr::scene::ISkinnedMesh::getMeshBuffers
virtual core::array< SSkinMeshBuffer * > & getMeshBuffers()=0
exposed for loaders: to add mesh buffers
irr::scene::ISkinnedMesh::getJointCount
virtual u32 getJointCount() const =0
Gets joint count.
irr::scene::ISkinnedMesh::finalize
virtual void finalize()=0
loaders should call this after populating the mesh
irr::scene::ISkinnedMesh::addJoint
virtual SJoint * addJoint(SJoint *parent=0)=0
Adds a new joint to the mesh, access it as last one.
irr::scene::ISkinnedMesh::getAllJoints
virtual const core::array< SJoint * > & getAllJoints() const =0
exposed for loaders: joints list
irr::scene::ISkinnedMesh::addMeshBuffer
virtual SSkinMeshBuffer * addMeshBuffer()=0
Adds a new meshbuffer to the mesh, access it as last one.
irr::scene::ISkinnedMesh::addPositionKey
virtual SPositionKey * addPositionKey(SJoint *joint)=0
Adds a new position key to the mesh, access it as last one.
irr::scene::ISkinnedMesh::addWeight
virtual SWeight * addWeight(SJoint *joint)=0
Adds a new weight to the mesh, access it as last one.
irr::scene::ISkinnedMesh::getJointNumber
virtual s32 getJointNumber(const c8 *name) const =0
Gets a joint number from its name.
irr::scene::ISkinnedMesh::addScaleKey
virtual SScaleKey * addScaleKey(SJoint *joint)=0
Adds a new scale key to the mesh, access it as last one.
irr::scene::ISkinnedMesh::convertMeshToTangents
virtual void convertMeshToTangents()=0
converts the vertex type of all meshbuffers to tangents.
irr::scene::ISkinnedMesh::setInterpolationMode
virtual void setInterpolationMode(E_INTERPOLATION_MODE mode)=0
Sets Interpolation Mode.
irrArray.h
irr::core::vector3df
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition vector3d.h:445
irr::core::matrix4
CMatrix4< f32 > matrix4
Typedef for f32 matrix.
Definition matrix4.h:2235
irr::core::stringc
string< c8 > stringc
Typedef for character strings.
Definition irrString.h:1358
irr::scene
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition CDynamicMeshBuffer.h:16
irr::scene::E_INTERPOLATION_MODE
E_INTERPOLATION_MODE
Definition ISkinnedMesh.h:19
irr::scene::EIM_COUNT
@ EIM_COUNT
count of all available interpolation modes
Definition ISkinnedMesh.h:27
irr::scene::EIM_CONSTANT
@ EIM_CONSTANT
Definition ISkinnedMesh.h:21
irr::scene::EIM_LINEAR
@ EIM_LINEAR
Definition ISkinnedMesh.h:24
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::f32
float f32
32 bit floating point variable.
Definition irrTypes.h:104
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
irr::c8
char c8
8 bit character variable.
Definition irrTypes.h:31
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
irr::u16
unsigned short u16
16 bit unsigned variable.
Definition irrTypes.h:40
irr::scene::ISkinnedMesh::SJoint
Joints.
Definition ISkinnedMesh.h:126
irr::scene::ISkinnedMesh::SJoint::SJoint
SJoint()
Definition ISkinnedMesh.h:127
irr::scene::ISkinnedMesh::SJoint::Name
core::stringc Name
The name of this joint.
Definition ISkinnedMesh.h:133
irr::scene::ISkinnedMesh::SJoint::LocalMatrix
core::matrix4 LocalMatrix
Local matrix of this joint.
Definition ISkinnedMesh.h:136
irr::scene::ISkinnedMesh::SJoint::RotationKeys
core::array< SRotationKey > RotationKeys
Animation keys causing rotation change.
Definition ISkinnedMesh.h:151
irr::scene::ISkinnedMesh::SJoint::GlobalMatrix
core::matrix4 GlobalMatrix
Unnecessary for loaders, will be overwritten on finalize.
Definition ISkinnedMesh.h:157
irr::scene::ISkinnedMesh::SJoint::PositionKeys
core::array< SPositionKey > PositionKeys
Animation keys causing translation change.
Definition ISkinnedMesh.h:145
irr::scene::ISkinnedMesh::SJoint::LocalAnimatedMatrix
core::matrix4 LocalAnimatedMatrix
Definition ISkinnedMesh.h:159
irr::scene::ISkinnedMesh::SJoint::GlobalAnimatedMatrix
core::matrix4 GlobalAnimatedMatrix
Definition ISkinnedMesh.h:158
irr::scene::ISkinnedMesh::SJoint::Weights
core::array< SWeight > Weights
Skin weights.
Definition ISkinnedMesh.h:154
irr::scene::ISkinnedMesh::SJoint::CSkinnedMesh
friend class CSkinnedMesh
Internal members used by CSkinnedMesh.
Definition ISkinnedMesh.h:168
irr::scene::ISkinnedMesh::SJoint::ScaleKeys
core::array< SScaleKey > ScaleKeys
Animation keys causing scale change.
Definition ISkinnedMesh.h:148
irr::scene::ISkinnedMesh::SJoint::Children
core::array< SJoint * > Children
List of child joints.
Definition ISkinnedMesh.h:139
irr::scene::ISkinnedMesh::SJoint::Animatedrotation
core::quaternion Animatedrotation
Definition ISkinnedMesh.h:162
irr::scene::ISkinnedMesh::SJoint::GlobalInversedMatrix
core::matrix4 GlobalInversedMatrix
Definition ISkinnedMesh.h:164
irr::scene::ISkinnedMesh::SJoint::Animatedscale
core::vector3df Animatedscale
Definition ISkinnedMesh.h:161
irr::scene::ISkinnedMesh::SJoint::AttachedMeshes
core::array< u32 > AttachedMeshes
List of attached meshes.
Definition ISkinnedMesh.h:142
irr::scene::ISkinnedMesh::SJoint::Animatedposition
core::vector3df Animatedposition
Definition ISkinnedMesh.h:160
irr::scene::ISkinnedMesh::SPositionKey
Animation keyframe which describes a new position.
Definition ISkinnedMesh.h:105
irr::scene::ISkinnedMesh::SPositionKey::position
core::vector3df position
Definition ISkinnedMesh.h:107
irr::scene::ISkinnedMesh::SPositionKey::frame
f32 frame
Definition ISkinnedMesh.h:106
irr::scene::ISkinnedMesh::SRotationKey
Animation keyframe which describes a new rotation.
Definition ISkinnedMesh.h:119
irr::scene::ISkinnedMesh::SRotationKey::rotation
core::quaternion rotation
Definition ISkinnedMesh.h:121
irr::scene::ISkinnedMesh::SRotationKey::frame
f32 frame
Definition ISkinnedMesh.h:120
irr::scene::ISkinnedMesh::SScaleKey
Animation keyframe which describes a new scale.
Definition ISkinnedMesh.h:112
irr::scene::ISkinnedMesh::SScaleKey::frame
f32 frame
Definition ISkinnedMesh.h:113
irr::scene::ISkinnedMesh::SScaleKey::scale
core::vector3df scale
Definition ISkinnedMesh.h:114
irr::scene::ISkinnedMesh::SWeight
A vertex weight.
Definition ISkinnedMesh.h:84
irr::scene::ISkinnedMesh::SWeight::strength
f32 strength
Weight Strength/Percentage (0-1).
Definition ISkinnedMesh.h:92
irr::scene::ISkinnedMesh::SWeight::CSkinnedMesh
friend class CSkinnedMesh
Internal members used by CSkinnedMesh.
Definition ISkinnedMesh.h:96
irr::scene::ISkinnedMesh::SWeight::buffer_id
u16 buffer_id
Index of the mesh buffer.
Definition ISkinnedMesh.h:86
irr::scene::ISkinnedMesh::SWeight::vertex_id
u32 vertex_id
Index of the vertex.
Definition ISkinnedMesh.h:89
irr::scene::SSkinMeshBuffer
A mesh buffer able to choose between S3DVertex2TCoords, S3DVertex and S3DVertexTangents at runtime.
Definition SSkinMeshBuffer.h:20
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0