Changeset 6207 in orxonox.OLD for branches/christmas_branche/src/world_entities
- Timestamp:
- Dec 21, 2005, 2:31:24 AM (19 years ago)
- Location:
- branches/christmas_branche/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.