00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __ANIMATEDMESHCOMPONENT_H__
00017 #define __ANIMATEDMESHCOMPONENT_H__
00018
00019
00020 #include "../../dependencies.h"
00021 #include "SceneComponent.h"
00022
00023
00024
00033 class AnimatedMeshComponent : public SceneComponent
00034 {
00035 public:
00036
00037
00040 AnimatedMeshComponent(Entity *parent);
00045 AnimatedMeshComponent(Entity *parent, const std::string &fileName,
00046 const vector3df &scale = vector3df(1.0f, 1.0f, 1.0f));
00052 AnimatedMeshComponent(Entity *parent, IAnimatedMesh *mesh,
00053 const vector3df &scale = vector3df(1.0f, 1.0f, 1.0f));
00055 ~AnimatedMeshComponent();
00056
00057
00060 IAnimatedMeshSceneNode* getAnimatedMeshSceneNode();
00061
00063 void animate();
00064
00066 s32 getEndFrame() const;
00068 f32 getFrame() const;
00071 IMesh* getMesh();
00074 IShadowVolumeSceneNode* getShadowVolumeSceneNode();
00076 s32 getStartFrame() const;
00077
00086 void setAnimationSpeed(f32 speed);
00095 void setCurrentFrame(f32 frame);
00105 void setFrameLoop(s32 start, s32 end);
00114 void setLoopMode(bool value);
00123 void setMD2Animation(const std::string &animationName);
00128 void setMD2Animation(EMD2_ANIMATION_TYPE anim);
00137 void setMesh(const std::string &fileName);
00141 void setMesh(IAnimatedMesh *mesh);
00145 void setShadowVolumeMesh(const std::string &fileName);
00149 void setShadowVolumeMesh(IMesh *mesh);
00161 void setShadowVolumeSceneNode(const std::string &fileName, bool zfailmethod = true,
00162 f32 infinity = 10000.0f);
00169 void setShadowVolumeSceneNode(IMesh *mesh, bool zfailmethod = true,
00170 f32 infinity = 10000.0f);
00179 void setTransitionTime(f32 time);
00180
00181
00184 void onMesh(void *p);
00187 void onShadowVolumeMesh(void *p);
00188
00189
00192 static bool parseXML(IXMLReader *file, Entity *entity);
00193
00194 private:
00195
00196
00198 void init(const vector3df &scale = vector3df(1.0f, 1.0f, 1.0f));
00199
00200
00201 IAnimatedMeshSceneNode *mAnimatedMeshSN;
00202 IShadowVolumeSceneNode *mShadowVolumeSN;
00203
00204 std::string mMeshFileName;
00205 std::string mShadowVolumeMeshFileName;
00206 };
00207
00208 #endif