Changeset 6222 in orxonox.OLD for trunk/src/lib/graphics/importer/md2Model.h
- Timestamp:
- Dec 21, 2005, 1:49:06 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
Makefile.in
Makefile
configure
*.kdevelop
Doxyfile
config.log
config.h
config.status
stamp-h1
autom4te.cache
aclocal.m4
-
Property
svn:ignore
set to
-
trunk/src
-
Property
svn:ignore
set to
.deps
orxonox
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/src/lib
-
Property
svn:ignore
set to
Makefile
Makefile.in
.deps
libORXlibs.a
-
Property
svn:ignore
set to
-
trunk/src/lib/graphics
-
Property
svn:ignore
set to
Makefile
Makefile.in
.deps
libORX*
-
Property
svn:ignore
set to
-
trunk/src/lib/graphics/importer
-
Property
svn:ignore
set to
Makefile
Makefile.in
.deps
libORX*
-
Property
svn:ignore
set to
-
trunk/src/lib/graphics/importer/md2Model.h
r6022 r6222 65 65 }; 66 66 67 68 //! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading 69 typedef struct 70 { 71 unsigned char v[3]; //!< the vector of the vertex 72 unsigned char lightNormalIndex; //!< the index of the light normal 73 } sVertex; 74 75 76 //! compressed texture offset data: coords scaled by the texture size. Only for loading 77 typedef struct 78 { 79 short s; //!< the s,t coordinates of a texture 80 short t; //!< the s,t coordinates of a texture 81 } sTexCoor; 82 83 84 //! holds tha informations about a md2 frame 85 typedef struct 86 { 87 sVec3D scale; //!< scales values of the model 88 sVec3D translate; //!< translates the model 89 char name[16]; //!< frame name: something like "run32" 90 sVertex pVertices[1]; //!< first vertex of thes frame 91 } sFrame; 92 93 94 //! holds the information about a triangle 95 typedef struct 96 { 97 unsigned short indexToVertices[3]; //!< index to the verteces of the triangle 98 unsigned short indexToTexCoor[3]; //!< index to the texture coordinates 99 } sTriangle; 100 101 102 103 //! the command list of the md2 model, very md2 specific 104 typedef struct 105 { 106 float s; //!< texture coordinate 1 107 float t; //!< texture coordinate 2 108 int vertexIndex; //!< index of the vertex in the vertex list 109 } glCommandVertex; 110 111 112 //! a md2 animation definition 113 typedef struct 114 { 115 int firstFrame; //!< first frame of the animation 116 int lastFrame; //!< last frame of the animation 117 int fps; //!< speed: number of frames per second 118 int bStoppable; //!< 1 if the animation is stoppable 0 else 119 } sAnim; 120 121 122 //! animation state definition 123 typedef struct 124 { 125 int startFrame; //!< the start frame of an animation 126 int endFrame; //!< last frame of the animation 127 int fps; //!< fps of the animaion (speed) 128 129 float localTime; //!< the local time 130 float lastTime; //!< last time stamp 131 float interpolationState; //!< the state of the animation [0..1] 132 133 int type; //!< animation type 134 135 int currentFrame; //!< the current frame 136 int nextFrame; //!< the next frame in the list 137 int numPlays; //!< the number of times, this has been played in series 138 } sAnimState; 67 139 68 140 … … 143 215 virtual ~MD2Model(); 144 216 145 void draw(); 217 virtual void draw() const; 218 void renderFrameTriangles() const; 219 146 220 147 221 void setAnim(int type); 148 /** 149 * scales the current model 150 * @param scaleFactor: the factor [0..1] to use for scaling 151 */ 222 /** returns the current animation @returns animation type */ 223 inline int MD2Model::getAnim() { return this->animationState.type; } 224 /** scales the current model @param scaleFactor: the factor [0..1] to use for scaling */ 152 225 void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;} 153 226 154 v oid tick(float dtS);227 virtual void tick(float dtS); 155 228 void debug(); 156 229 157 230 158 231 private: 159 void animate( );232 void animate(float time); 160 233 void processLighting(); 161 void interpolate( sVec3D* verticesList);162 void renderFrame() ;234 void interpolate(/*sVec3D* verticesList*/); 235 void renderFrame() const ; 163 236 164 237 … … 168 241 static float anormsDots[SHADEDOT_QUANT][256]; //!< the anormals dot products 169 242 static sAnim animationList[21]; //!< the anomation list 243 //! again one of these strange id software parts 244 float* shadeDots; 170 245 171 246 MD2Data* data; //!< the md2 data pointer … … 174 249 float scaleFactor; //!< the scale factor (individual) 175 250 sAnimState animationState; //!< animation state of the model 251 sVec3D verticesList[MD2_MAX_VERTICES]; //!< place to temp sav the vert 176 252 }; 177 253
Note: See TracChangeset
for help on using the changeset viewer.