Changeset 8556 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 17, 2006, 11:19:55 AM (19 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer/md3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
r8553 r8556 37 37 38 38 MD3AnimationCfg cfg("/home/boenzlip/tmp/q3/Downloads/MOH/q3mdl-alien3/models/players/alien3/animation.cfg"); 39 40 this->tmpBoneFrame = new MD3BoneFrame(); 39 41 } 40 42 … … 42 44 43 45 MD3Model::~MD3Model() 44 {} 46 { 47 delete this->tmpBoneFrame; 48 } 45 49 46 50 … … 62 66 void MD3Model::draw(MD3Data* data) 63 67 { 68 69 // draw the bones if needed 64 70 if( this->bDrawBones) 65 71 { … … 78 84 } 79 85 86 80 87 //draw all meshes of current frame of this model 81 for( int i = 0; i < data->meshNum; i++) { 88 for( int i = 0; i < data->meshNum; i++) 89 { 82 90 MD3Mesh* mesh = data->meshes[i]; 83 91 … … 103 111 this->drawMesh(mesh, frame); 104 112 105 //draw vertex normals 113 114 // draw vertex normals if needed 106 115 if( this->bDrawNormals) { 107 116 // get vertex normals, interpolate if necessary … … 119 128 } 120 129 121 //draw all models linked to this model 122 130 131 // draw all models linked to this model 123 132 std::map<int, MD3Data*>::iterator it = data->sortedMap.begin(); 124 while( it != data->sortedMap.end()) { 133 while( it != data->sortedMap.end()) 134 { 125 135 MD3Data* child = it->second; 126 136 … … 156 166 m[15] = 1.0f; 157 167 } 168 169 //switch to child coord system 170 glPushMatrix(); 171 glMultMatrixf(m); 172 173 // and draw child 174 this->draw(child); 175 176 glPopMatrix(); 158 177 } 159 178 } … … 176 195 /** 177 196 * interpolate bone frame 197 * @param currBoneFrame Start bone frame. 198 * @param nextBoneFrame End bone frame. 199 * @param frac Interpolation fraction, in [0,1]. 178 200 */ 179 201 MD3BoneFrame* MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac) 180 {} 202 { 203 this->tmpBoneFrame->mins.x = (1.0f - frac) * currBoneFrame->mins.x + frac * nextBoneFrame->mins.x; 204 this->tmpBoneFrame->maxs.x = (1.0f - frac) * currBoneFrame->maxs.x + frac * nextBoneFrame->maxs.x; 205 this->tmpBoneFrame->position.x = (1.0f - frac) * currBoneFrame->position.x + frac * nextBoneFrame->position.x; 206 this->tmpBoneFrame->mins.y = (1.0f - frac) * currBoneFrame->mins.y + frac * nextBoneFrame->mins.y; 207 this->tmpBoneFrame->maxs.y = (1.0f - frac) * currBoneFrame->maxs.y + frac * nextBoneFrame->maxs.y; 208 this->tmpBoneFrame->position.y = (1.0f - frac) * currBoneFrame->position.y + frac * nextBoneFrame->position.y; 209 this->tmpBoneFrame->mins.z = (1.0f - frac) * currBoneFrame->mins.z + frac * nextBoneFrame->mins.z; 210 this->tmpBoneFrame->maxs.z = (1.0f - frac) * currBoneFrame->maxs.z + frac * nextBoneFrame->maxs.z; 211 this->tmpBoneFrame->position.z = (1.0f - frac) * currBoneFrame->position.z + frac * nextBoneFrame->position.z; 212 213 return this->tmpBoneFrame; 214 215 } 181 216 182 217 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8553 r8556 58 58 bool bDrawBones; //!< draws the bone frames too 59 59 bool bDrawNormals; //!< draw the normals 60 61 MD3BoneFrame* tmpBoneFrame; //!< a temporary bone frame 60 62 }; 61 63
Note: See TracChangeset
for help on using the changeset viewer.