Changeset 4459 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 2, 2005, 12:14:27 AM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/md2Model.cc
r4357 r4459 25 25 using namespace std; 26 26 27 27 //! the model anorms 28 28 sVec3D MD2Model::anorms[NUM_VERTEX_NORMALS] = { 29 29 #include "anorms.h" 30 30 }; 31 31 32 //! anormal dots, no idea of how this shall work, but it does 32 33 float MD2Model::anormsDots[SHADEDOT_QUANT][256] = { 33 34 #include "anormtab.h" 34 35 }; 35 36 37 //! again one of these strange id software parts 36 38 static float *shadeDots = MD2Model::anormsDots[0]; 37 39 40 //! the angle under which the model is viewd, used internaly 38 41 float md2Angle = 0.0f; 39 42 40 43 44 //! list of all different animations a std md2model supports 41 45 sAnim MD2Model::animationList[21] = 42 46 { 43 47 // begin, end, fps 44 { 0, 39, 9 }, // STAND45 { 40, 45, 10 }, // RUN46 { 46, 53, 10 }, // ATTACK47 { 54, 57, 7 }, // PAIN_A48 { 58, 61, 7 }, // PAIN_B49 { 62, 65, 7 }, // PAIN_C50 { 66, 71, 7 }, // JUMP51 { 72, 83, 7 }, // FLIP52 { 84, 94, 7 }, // SALUTE53 { 95, 111, 10 }, // FALLBACK54 { 112, 122, 7 }, // WAVE55 { 123, 134, 6 }, // POINTT56 { 135, 153, 10 }, // CROUCH_STAND57 { 154, 159, 7 }, // CROUCH_WALK58 { 160, 168, 10 }, // CROUCH_ATTACK59 { 196, 172, 7 }, // CROUCH_PAIN60 { 173, 177, 5 }, // CROUCH_DEATH61 { 178, 183, 7 }, // DEATH_FALLBACK62 { 184, 189, 7 }, // DEATH_FALLFORWARD63 { 190, 197, 7 }, // DEATH_FALLBACKSLOW64 { 198, 198, 5 }, // BOOM48 { 0, 39, 9 }, //!< STAND 49 { 40, 45, 10 }, //!< RUN 50 { 46, 53, 10 }, //!< ATTACK 51 { 54, 57, 7 }, //!< PAIN_A 52 { 58, 61, 7 }, //!< PAIN_B 53 { 62, 65, 7 }, //!< PAIN_C 54 { 66, 71, 7 }, //!< JUMP 55 { 72, 83, 7 }, //!< FLIP 56 { 84, 94, 7 }, //!< SALUTE 57 { 95, 111, 10 }, //!< FALLBACK 58 { 112, 122, 7 }, //!< WAVE 59 { 123, 134, 6 }, //!< POINTT 60 { 135, 153, 10 }, //!< CROUCH_STAND 61 { 154, 159, 7 }, //!< CROUCH_WALK 62 { 160, 168, 10 }, //!< CROUCH_ATTACK 63 { 196, 172, 7 }, //!< CROUCH_PAIN 64 { 173, 177, 5 }, //!< CROUCH_DEATH 65 { 178, 183, 7 }, //!< DEATH_FALLBACK 66 { 184, 189, 7 }, //!< DEATH_FALLFORWARD 67 { 190, 197, 7 }, //!< DEATH_FALLBACKSLOW 68 { 198, 198, 5 }, //!< BOOM 65 69 }; 66 70 … … 68 72 69 73 /******************************************************************************** 70 * MD2Model * ********************************************************************************/ 74 * MD2Model * 75 ********************************************************************************/ 71 76 72 77 /* 73 78 \brief simple constructor initializing all variables 74 79 */ 75 MD2Model::MD2Model( )80 MD2Model::MD2Model(const char* modelFileName, const char* skinFileName) 76 81 { 77 82 /* this creates the data container via ressource manager */ 78 this->data = new MD2Data( );83 this->data = new MD2Data(modelFileName, skinFileName); 79 84 this->scaleFactor = this->data->scaleFactor; 80 85 … … 90 95 { 91 96 92 }93 94 /*95 \brief load model96 \param name of the model file97 \return true if everything worked out smoothly98 */99 bool MD2Model::loadModel(const char* fileName)100 {101 return this->data->loadModel(fileName);102 }103 104 105 /*106 \brief load the skin as a material107 \param name of the texture file108 \return true if ok109 */110 bool MD2Model::loadSkin(const char* fileName)111 {112 return this->data->loadSkin(fileName);113 97 } 114 98 … … 116 100 /** 117 101 \brief initializes an array of vert with the current frame scaled vertices 102 \param verticesList: the list of vertices to interpolate between 118 103 119 104 we won't use the pVertices array directly, since its much easier and we need … … 139 124 /* 140 125 \brief sets the animation type 141 \param animation type126 \param type: animation type 142 127 143 128 the animation types can be looked up in the animationType table … … 163 148 /* 164 149 \brief sets the time in seconds passed since the last tick 165 \param time in sec150 \param time: in sec 166 151 */ 167 152 void MD2Model::tick(float time) … … 291 276 \brief simple constructor 292 277 */ 293 MD2Data::MD2Data( )278 MD2Data::MD2Data(const char* modelFileName, const char* skinFileName) 294 279 { 295 280 this->pVertices = NULL; … … 302 287 303 288 this->scaleFactor = 1.0f; 289 290 this->loadModel(modelFileName); 291 this->loadSkin(skinFileName); 304 292 } 305 293 … … 321 309 /* 322 310 \brief this will load the whole model data (vertices, opengl command list, ...) 323 \param name to the model file311 \param fileName to the model file 324 312 \return true if success 325 313 */ … … 391 379 /* 392 380 \brief loads the skin/material stuff 393 \param name of the skin file381 \param fileName of the skin file 394 382 \return true if success 395 383 */ 396 384 bool MD2Data::loadSkin(const char* fileName) 397 385 { 386 if( fileName == NULL) 387 { 388 this->skinFileName = NULL; 389 return false; 390 } 391 398 392 this->skinFileName = new char[strlen(fileName)+1]; 399 393 strcpy(this->skinFileName, fileName); -
orxonox/trunk/src/lib/graphics/importer/md2Model.h
r4282 r4459 25 25 26 26 //! These are the needed defines for the max values when loading .MD2 files 27 #define MD2_IDENT (('2'<<24) + ('P'<<16) + ('D'<<8) + 'I') 28 #define MD2_VERSION 8 29 #define MD2_MAX_TRIANGLES 4096 30 #define MD2_MAX_VERTICES 2048 31 #define MD2_MAX_TEXCOORDS 2048 32 #define MD2_MAX_FRAMES 512 33 #define MD2_MAX_SKINS 32 34 #define MD2_MAX_FRAMESIZE (MD2_MAX_VERTICES * 4 + 128) 27 #define MD2_IDENT (('2'<<24) + ('P'<<16) + ('D'<<8) + 'I') //!< the md2 identifier tag in the bin file 28 #define MD2_VERSION 8 //!< the md2 version in the header 29 #define MD2_MAX_TRIANGLES 4096 //!< maximal triangles count 30 #define MD2_MAX_VERTICES 2048 //!< maximal vertices count 31 #define MD2_MAX_TEXCOORDS 2048 //!< maximal tex coordinates 32 #define MD2_MAX_FRAMES 512 //!< maximal frames 33 #define MD2_MAX_SKINS 32 //!< maximal skins 34 #define MD2_MAX_FRAMESIZE (MD2_MAX_VERTICES * 4 + 128) //!< maximal framesize 35 35 36 #define NUM_VERTEX_NORMALS 162 36 #define NUM_VERTEX_NORMALS 162 //!< 37 37 #define SHADEDOT_QUANT 16 38 38 … … 66 66 67 67 68 68 //! animation names enumeration 69 69 typedef enum 70 70 { … … 105 105 { 106 106 public: 107 MD2Data( );107 MD2Data(const char* modelFileName, const char* skinFileName); 108 108 virtual ~MD2Data(); 109 109 110 private: 110 111 bool loadModel(const char* fileName); 111 bool loadSkin(const char* fileName );112 bool loadSkin(const char* fileName = NULL); 112 113 114 public: 113 115 int numFrames; 114 116 int numVertices; … … 133 135 134 136 public: 135 MD2Model( );137 MD2Model(const char* modelFileName, const char* skinFileName = NULL); 136 138 virtual ~MD2Model(); 137 138 bool loadModel(const char* filename); 139 bool loadSkin(const char* filename); 140 139 141 140 void drawFrame(int frame); 142 141 void draw(); -
orxonox/trunk/src/world_entities/test_entity.cc
r4397 r4459 29 29 { 30 30 this->setClassID(CL_TEST_ENTITY, "TestEntity"); 31 this->md2Model = new MD2Model();32 this->md2Model->loadModel(ResourceManager::getFullName("models/tris.md2"));33 // this->md2Model->loadSkin(ResourceManager::getFullName("models/tris.pcx"));34 this->md2Model->loadSkin("../data/models/tris.pcx");35 31 36 32 this->md2Model = new MD2Model("../data/models/tris.md2", "../data/models/tris.pcx"); 37 33 this->md2Model->debug(); 38 34 }
Note: See TracChangeset
for help on using the changeset viewer.