Changeset 8552 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 17, 2006, 2:57:28 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
r8551 r8552 18 18 19 19 #include "md3_data.h" 20 #include "md3_mesh.h" 21 #include "md3_tag.h" 20 22 21 23 #include "md3_animation_cfg.h" 24 25 #include "material.h" 22 26 23 27 namespace md3 … … 73 77 } 74 78 79 //draw all meshes of current frame of this model 80 for( int i = 0; i < data->meshNum; i++) { 81 MD3Mesh* mesh = data->meshes[i]; 75 82 83 // gl.glBlendFunc(mesh.GLSrcBlendFunc, mesh.GLDstBlendFunc); 84 // gl.glDepthMask(mesh.GLDepthMask); 85 86 if( mesh->header->textureNum > 0 && &mesh->material[0] != NULL) 87 mesh->material[0].select(); 88 89 // get mesh frame, do interpolation if necessary 90 sVec3D* frame; 91 if( data->animationState.interpolationFraction != 0.0 && 92 data->animationState.currentFrame != data->animationState.nextFrame) { 93 //interpolate mesh frame between the 2 current mesh frames 94 frame = this->interpolateMeshFrame(mesh, data->animationState.currentFrame, data->animationState.nextFrame, 95 data->animationState.interpolationFraction); 96 } 97 else { 98 //no interpolation needed, just draw current frame 99 frame = &mesh->meshFrames[data->animationState.currentFrame]; 100 } 101 102 this->drawMesh(mesh, frame); 103 104 //draw vertex normals 105 if( this->bDrawNormals) { 106 // get vertex normals, interpolate if necessary 107 if( data->animationState.interpolationFraction != 0.0 && 108 data->animationState.currentFrame != data->animationState.nextFrame) { 109 //interpolate vertex normals 110 this->drawVertexNormals(frame, this->interpolateVertexNormals(&mesh->normals[data->animationState.currentFrame], 111 &mesh->normals[data->animationState.nextFrame], data->animationState.interpolationFraction)); 112 } 113 else { 114 //stick with current vertex normals 115 this->drawVertexNormals(frame, &mesh->normals[data->animationState.currentFrame]); 116 } 117 } 118 } 119 120 //draw all models linked to this model 121 122 std::map<int, MD3Data*>::iterator it = data->sortedMap.begin(); 123 while( it != data->sortedMap.end()) { 124 MD3Data* child = it->second; 125 126 //build transformation array m from matrix, interpolate if necessary 127 float* m = new float[16]; 128 129 } 76 130 77 131 } 78 132 79 133 134 /** 135 * draws the mesh 136 */ 137 void MD3Model::drawMesh(MD3Mesh* mesh, sVec3D* frame) 138 {} 139 140 141 /** 142 * drawo vertex normals 143 */ 144 void MD3Model::drawVertexNormals(sVec3D* frame, MD3Normal* normals) 145 {} 146 147 148 /** 149 * interpolate bone frame 150 */ 80 151 MD3BoneFrame MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac) 81 152 {} 82 153 83 154 155 /** 156 * draw bone frame 157 */ 84 158 void MD3Model::drawBoneFrame(MD3BoneFrame* frame) 85 159 {} 86 160 87 161 162 /** 163 * interpolate mesh frame 164 */ 165 sVec3D* MD3Model::interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac) 166 {} 167 168 169 /** 170 * interpolate vertex normal 171 */ 172 MD3Normal* MD3Model::interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac) 173 {} 174 88 175 89 176 } -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8551 r8552 19 19 class MD3Data; 20 20 class MD3BoneFrame; 21 class MD3Mesh; 22 struct MD3Normal; 23 21 24 22 25 class MD3Model : public InteractiveModel … … 37 40 void draw(MD3Data* data); 38 41 42 void drawMesh(MD3Mesh* mesh, sVec3D* frame); 43 void drawVertexNormals(sVec3D* frame, MD3Normal* normals); 44 45 39 46 MD3BoneFrame* interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac); 40 47 void drawBoneFrame(MD3BoneFrame* frame); 48 49 sVec3D* interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac); 50 51 MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac); 41 52 42 53 … … 45 56 46 57 bool bDrawBones; //!< draws the bone frames too 58 bool bDrawNormals; //!< draw the normals 47 59 }; 48 60
Note: See TracChangeset
for help on using the changeset viewer.