Changeset 8562 in orxonox.OLD for branches/bsp_model/src/lib/graphics
- Timestamp:
- Jun 17, 2006, 1:27:38 PM (18 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
r8561 r8562 27 27 #include "quaternion.h" 28 28 29 #include "debug.h" 30 29 31 namespace md3 30 32 { … … 61 63 //draw current bone frame 62 64 this->draw(this->md3Data); 65 66 PRINTF(0)("draw\n"); 63 67 } 64 68 … … 190 194 */ 191 195 void MD3Model::drawMesh(MD3Mesh* mesh, sVec3D* frame) 192 {} 196 { 197 glColor3f(1.0f, 1.0f, 1.0f); 198 glBegin( GL_TRIANGLES ); 199 200 // upload all triangles in the frame to OpenGL 201 for( int t = 0; t < mesh->header->triangleNum; t++) { 202 // calc normal vector 203 this->tmpVec1.x = frame[mesh->triangles[t].vertexOffset[1]][0] - frame[mesh->triangles[t].vertexOffset[0]][0]; 204 this->tmpVec2.x = frame[mesh->triangles[t].vertexOffset[2]][0] - frame[mesh->triangles[t].vertexOffset[0]][0]; 205 206 this->tmpVec1.y = frame[mesh->triangles[t].vertexOffset[1]][1] - frame[mesh->triangles[t].vertexOffset[0]][1]; 207 this->tmpVec2.y = frame[mesh->triangles[t].vertexOffset[2]][1] - frame[mesh->triangles[t].vertexOffset[0]][1]; 208 209 this->tmpVec1.z = frame[mesh->triangles[t].vertexOffset[1]][2] - frame[mesh->triangles[t].vertexOffset[0]][2]; 210 this->tmpVec2.z = frame[mesh->triangles[t].vertexOffset[2]][2] - frame[mesh->triangles[t].vertexOffset[0]][2]; 211 212 Vector normal = this->tmpVec1.cross(tmpVec2); 213 normal.normalize(); 214 215 glNormal3f(normal.x, normal.y, normal.z); 216 //no normalization necessary, GL_NORMALIZE is enabled! 217 218 glTexCoord2fv( mesh->texVecs[mesh->triangles[t].vertexOffset[0]].textureCoord); 219 glVertex3f( frame[mesh->triangles[t].vertexOffset[0]][0], 220 frame[mesh->triangles[t].vertexOffset[0]][1], 221 frame[mesh->triangles[t].vertexOffset[0]][2]); 222 glTexCoord2fv( mesh->texVecs[mesh->triangles[t].vertexOffset[1]].textureCoord); 223 glVertex3f( frame[mesh->triangles[t].vertexOffset[1]][0], 224 frame[mesh->triangles[t].vertexOffset[1]][1], 225 frame[mesh->triangles[t].vertexOffset[1]][2]); 226 glTexCoord2fv( mesh->texVecs[mesh->triangles[t].vertexOffset[2]].textureCoord); 227 glVertex3f( frame[mesh->triangles[t].vertexOffset[2]][0], 228 frame[mesh->triangles[t].vertexOffset[2]][1], 229 frame[mesh->triangles[t].vertexOffset[2]][2]); 230 } 231 232 glEnd(); 233 } 193 234 194 235 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8560 r8562 63 63 MD3Normal* tmpNormal; //!< a temporary normals frame 64 64 float tmpMatrix[16]; //!< a temporary matrix 65 Vector tmpVec1; 66 Vector tmpVec2; 65 67 }; 66 68
Note: See TracChangeset
for help on using the changeset viewer.