Line data Source code
1 : // Copyright (C) 2002-2012 Nikolaus Gebhardt
2 : // This file is part of the "Irrlicht Engine".
3 : // For conditions of distribution and use, see copyright notice in irrlicht.h
4 :
5 : #ifndef __I_ANIMATED_MESH_H_INCLUDED__
6 : #define __I_ANIMATED_MESH_H_INCLUDED__
7 :
8 : #include "aabbox3d.h"
9 : #include "IMesh.h"
10 :
11 : namespace irr
12 : {
13 : namespace scene
14 : {
15 : //! Possible types of (animated) meshes.
16 : enum E_ANIMATED_MESH_TYPE
17 : {
18 : //! Unknown animated mesh type.
19 : EAMT_UNKNOWN = 0,
20 :
21 : //! Quake 2 MD2 model file
22 : EAMT_MD2,
23 :
24 : //! Quake 3 MD3 model file
25 : EAMT_MD3,
26 :
27 : //! Maya .obj static model
28 : EAMT_OBJ,
29 :
30 : //! Quake 3 .bsp static Map
31 : EAMT_BSP,
32 :
33 : //! 3D Studio .3ds file
34 : EAMT_3DS,
35 :
36 : //! My3D Mesh, the file format by Zhuck Dimitry
37 : EAMT_MY3D,
38 :
39 : //! Pulsar LMTools .lmts file. This Irrlicht loader was written by Jonas Petersen
40 : EAMT_LMTS,
41 :
42 : //! Cartography Shop .csm file. This loader was created by Saurav Mohapatra.
43 : EAMT_CSM,
44 :
45 : //! .oct file for Paul Nette's FSRad or from Murphy McCauley's Blender .oct exporter.
46 : /** The oct file format contains 3D geometry and lightmaps and
47 : can be loaded directly by Irrlicht */
48 : EAMT_OCT,
49 :
50 : //! Halflife MDL model file
51 : EAMT_MDL_HALFLIFE,
52 :
53 : //! generic skinned mesh
54 : EAMT_SKINNED
55 : };
56 :
57 : //! Interface for an animated mesh.
58 : /** There are already simple implementations of this interface available so
59 : you don't have to implement this interface on your own if you need to:
60 : You might want to use irr::scene::SAnimatedMesh, irr::scene::SMesh,
61 : irr::scene::SMeshBuffer etc. */
62 1405 : class IAnimatedMesh : public IMesh
63 : {
64 : public:
65 :
66 : //! Gets the frame count of the animated mesh.
67 : /** \return The amount of frames. If the amount is 1,
68 : it is a static, non animated mesh. */
69 : virtual u32 getFrameCount() const = 0;
70 :
71 : //! Gets the animation speed of the animated mesh.
72 : /** \return The number of frames per second to play the
73 : animation with by default. If the amount is 0,
74 : it is a static, non animated mesh. */
75 : virtual f32 getAnimationSpeed() const = 0;
76 :
77 : //! Sets the animation speed of the animated mesh.
78 : /** \param fps Number of frames per second to play the
79 : animation with by default. If the amount is 0,
80 : it is not animated. The actual speed is set in the
81 : scene node the mesh is instantiated in.*/
82 : virtual void setAnimationSpeed(f32 fps) =0;
83 :
84 : //! Returns the IMesh interface for a frame.
85 : /** \param frame: Frame number as zero based index. The maximum
86 : frame number is getFrameCount() - 1;
87 : \param detailLevel: Level of detail. 0 is the lowest, 255 the
88 : highest level of detail. Most meshes will ignore the detail level.
89 : \param startFrameLoop: Because some animated meshes (.MD2) are
90 : blended between 2 static frames, and maybe animated in a loop,
91 : the startFrameLoop and the endFrameLoop have to be defined, to
92 : prevent the animation to be blended between frames which are
93 : outside of this loop.
94 : If startFrameLoop and endFrameLoop are both -1, they are ignored.
95 : \param endFrameLoop: see startFrameLoop.
96 : \return Returns the animated mesh based on a detail level. */
97 : virtual IMesh* getMesh(s32 frame, s32 detailLevel=255, s32 startFrameLoop=-1, s32 endFrameLoop=-1) = 0;
98 :
99 : //! Returns the type of the animated mesh.
100 : /** In most cases it is not neccessary to use this method.
101 : This is useful for making a safe downcast. For example,
102 : if getMeshType() returns EAMT_MD2 it's safe to cast the
103 : IAnimatedMesh to IAnimatedMeshMD2.
104 : \returns Type of the mesh. */
105 0 : virtual E_ANIMATED_MESH_TYPE getMeshType() const
106 : {
107 0 : return EAMT_UNKNOWN;
108 : }
109 : };
110 :
111 : } // end namespace scene
112 : } // end namespace irr
113 :
114 : #endif
115 :
|