Changeset 6207 in orxonox.OLD for branches/christmas_branche
- Timestamp:
- Dec 21, 2005, 2:31:24 AM (19 years ago)
- Location:
- branches/christmas_branche/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/christmas_branche/src/lib/graphics/importer/md2Model.cc
r6205 r6207 33 33 #include "anormtab.h" 34 34 }; 35 36 //! again one of these strange id software parts37 static float *shadeDots = MD2Model::anormsDots[0];38 39 40 static sVec3D verticesList[MD2_MAX_VERTICES];41 35 42 36 … … 90 84 this->scaleFactor = this->data->scaleFactor; 91 85 86 shadeDots = MD2Model::anormsDots[0]; 92 87 /* set the animation stat mannualy */ 93 88 this->animationState.type = STAND; … … 111 106 /** 112 107 * initializes an array of vert with the current frame scaled vertices 113 * @param verticesList: the list of vertices to interpolate between108 * @param this->verticesList: the list of vertices to interpolate between 114 109 115 110 we won't use the pVertices array directly, since its much easier and we need 116 111 saving of data anyway 117 112 */ 118 void MD2Model::interpolate(/*sVec3D* verticesList*/)113 void MD2Model::interpolate(/*sVec3D* this->verticesList*/) 119 114 { 120 115 sVec3D* currVec; … … 126 121 for( int i = 0; i < this->data->numVertices; ++i) 127 122 { 128 verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]);129 verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]);130 verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]);123 this->verticesList[i][0] = currVec[i][0] + this->animationState.interpolationState * (nextVec[i][0] - currVec[i][0]); 124 this->verticesList[i][1] = currVec[i][1] + this->animationState.interpolationState * (nextVec[i][1] - currVec[i][1]); 125 this->verticesList[i][2] = currVec[i][2] + this->animationState.interpolationState * (nextVec[i][2] - currVec[i][2]); 131 126 } 132 127 } … … 172 167 this->animate(time); 173 168 this->processLighting(); 174 this->interpolate(/* verticesList*/);169 this->interpolate(/*this->verticesList*/); 175 170 } 176 171 … … 185 180 glPushMatrix(); 186 181 this->renderFrame(); 187 //renderFrameTriangles();182 // renderFrameTriangles(); 188 183 glPopMatrix(); 189 184 } … … 222 217 glTexCoord2f( ((float *)pCommands)[0], ((float *)pCommands)[1] ); 223 218 glNormal3fv(anorms[this->data->pLightNormals[pCommands[2]]]); 224 glVertex3fv( verticesList[pCommands[2]]);219 glVertex3fv(this->verticesList[pCommands[2]]); 225 220 } 226 221 glEnd(); … … 234 229 void MD2Model::renderFrameTriangles() const 235 230 { 236 //static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */231 //static sVec3D this->verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */ 237 232 int* pCommands = this->data->pGLCommands; 238 233 /* some face culling stuff */ … … 243 238 // 244 239 // this->processLighting(); 245 // this->interpolate(/* verticesList*/);240 // this->interpolate(/*this->verticesList*/); 246 241 this->data->material->select(); 247 242 -
branches/christmas_branche/src/lib/graphics/importer/md2Model.h
r6199 r6207 241 241 static float anormsDots[SHADEDOT_QUANT][256]; //!< the anormals dot products 242 242 static sAnim animationList[21]; //!< the anomation list 243 //! again one of these strange id software parts 244 float* shadeDots; 243 245 244 246 MD2Data* data; //!< the md2 data pointer … … 247 249 float scaleFactor; //!< the scale factor (individual) 248 250 sAnimState animationState; //!< animation state of the model 251 sVec3D verticesList[MD2_MAX_VERTICES]; //!< place to temp sav the vert 249 252 }; 250 253 -
branches/christmas_branche/src/world_entities/test_entity.cc
r6187 r6207 18 18 19 19 20 #include "executor/executor.h" 21 #include "factory.h" 22 20 23 #include "test_entity.h" 21 24 #include "stdincl.h" … … 28 31 29 32 33 CREATE_FACTORY(TestEntity, CL_TEST_ENTITY); 34 30 35 31 36 TestEntity::TestEntity () 32 37 { 33 this-> setClassID(CL_TEST_ENTITY, "TestEntity");34 // TO SOME LIST!! 38 this->init(); 39 } 35 40 36 this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");37 // this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");38 // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");39 41 40 /// FIXME41 // this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);42 42 43 this->md2Model->setAnim(RUN); 44 this->md2Model->debug(); 43 TestEntity::TestEntity(const TiXmlElement* root) 44 { 45 this->init(); 46 if (root != NULL) 47 this->loadParams(root); 48 49 this->init(); 45 50 } 46 51 47 52 48 53 TestEntity::~TestEntity () 54 {} 55 56 57 58 void TestEntity::init() 49 59 { 50 delete this->md2Model; 60 this->setClassID(CL_TEST_ENTITY, "TestEntity"); 61 this->toList(OM_COMMON); 62 } 63 64 /** 65 * loads the Settings of a MD2Creature from an XML-element. 66 * @param root the XML-element to load the MD2Creature's properties from 67 */ 68 void TestEntity::loadParams(const TiXmlElement* root) 69 { 70 static_cast<WorldEntity*>(this)->loadParams(root); 51 71 } 52 72 53 73 54 74 void TestEntity::setAnim(int animationIndex) 55 { 56 this->md2Model->setAnim(animationIndex); 57 } 75 {} 58 76 59 77 60 78 void TestEntity::tick (float time) 61 79 { 62 this->md2Model->tick(time); 80 if( likely(this->getModel(0) != NULL)) 81 ((MD2Model*)this->getModel(0))->tick(time); 82 63 83 } 64 84 65 85 66 86 void TestEntity::collidesWith(WorldEntity* entity, const Vector& location) 67 { 68 if (entity->isA(CL_PROJECTILE)) 69 { 70 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 71 this->setVisibiliy(false); 72 this->toList(OM_DEAD); 73 } 74 } 75 76 void TestEntity::destroy () {} 77 87 {} 78 88 79 89 … … 81 91 void TestEntity::draw () const 82 92 { 83 glMatrixMode(GL_MODELVIEW); 84 glPushMatrix(); 85 float matrix[4][4]; 86 87 88 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 89 this->getAbsDir().matrix (matrix); 90 glMultMatrixf((float*)matrix); 91 this->md2Model->draw(); 92 93 94 glPopMatrix(); 93 this->drawLODsafe(); 95 94 } 96 95 -
branches/christmas_branche/src/world_entities/test_entity.h
r5500 r6207 10 10 struct t3DModel; 11 11 class Material; 12 class TiXmlElement; 12 13 13 14 class TestEntity : public WorldEntity, PhysicsInterface … … 17 18 public: 18 19 TestEntity (); 20 TestEntity(const TiXmlElement* root); 19 21 virtual ~TestEntity (); 22 23 void init(); 24 void loadParams(const TiXmlElement* root); 20 25 21 26 void setAnim(int animationIndex); 22 27 23 28 virtual void tick (float time); 24 virtual void destroy ();25 29 virtual void collidesWith(WorldEntity* entity, const Vector& location); 26 30 virtual void draw () const;
Note: See TracChangeset
for help on using the changeset viewer.