#ifndef __C_ANIMATED_MESH_MD2_H_INCLUDED__
#define __C_ANIMATED_MESH_MD2_H_INCLUDED__
#include "IAnimatedMeshMD2.h"
#include "IMesh.h"
#include "CMeshBuffer.h"
#include "IReadFile.h"
#include "S3DVertex.h"
#include "irrArray.h"
#include "irrString.h"
namespace irr
{
namespace scene
{
class CAnimatedMeshMD2 : public IAnimatedMeshMD2
{
public:
CAnimatedMeshMD2();
virtual ~CAnimatedMeshMD2();
virtual u32 getFrameCount() const;
virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1);
virtual u32 getMeshBufferCount() const;
virtual IMeshBuffer* getMeshBuffer(u32 nr) const;
virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const;
virtual const core::aabbox3d<f32>& getBoundingBox() const;
virtual void setBoundingBox( const core::aabbox3df& box);
virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue);
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX);
virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX);
virtual E_ANIMATED_MESH_TYPE getMeshType() const;
virtual void getFrameLoop(EMD2_ANIMATION_TYPE,
s32& outBegin, s32& outEnd, s32& outFps) const;
virtual bool getFrameLoop(const c8* name,
s32& outBegin, s32& outEnd, s32& outFps) const;
virtual s32 getAnimationCount() const;
virtual const c8* getAnimationName(s32 nr) const;
SMeshBuffer* InterpolationBuffer;
struct SAnimationData
{
core::stringc name;
s32 begin;
s32 end;
s32 fps;
};
struct SKeyFrameTransform
{
core::vector3df scale;
core::vector3df translate;
};
struct SMD2Vert
{
core::vector3d<u8> Pos;
u8 NormalIdx;
};
core::array<SKeyFrameTransform> FrameTransforms;
core::array<SMD2Vert> *FrameList;
core::array<core::aabbox3d<f32> > BoxList;
core::array< SAnimationData > AnimationData;
u32 FrameCount;
private:
void updateInterpolationBuffer(s32 frame, s32 startFrame, s32 endFrame);
};
}
}
#endif