Changeset 6222 in orxonox.OLD for trunk/src/world_entities/test_entity.cc
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
Makefile.in
Makefile
configure
*.kdevelop
Doxyfile
config.log
config.h
config.status
stamp-h1
autom4te.cache
aclocal.m4
-
Property
svn:ignore
set to
-
trunk/src
-
Property
svn:ignore
set to
.deps
orxonox
Makefile
Makefile.in
-
Property
svn:ignore
set to
-
trunk/src/world_entities/test_entity.cc
r6142 r6222 18 18 19 19 20 #include "executor/executor.h" 21 #include "factory.h" 22 #include "load_param.h" 23 20 24 #include "test_entity.h" 21 25 #include "stdincl.h" … … 24 28 #include "obb_tree.h" 25 29 #include "state.h" 26 #include "list.h"27 30 28 31 using namespace std; 29 32 30 33 34 CREATE_FACTORY(TestEntity, CL_TEST_ENTITY); 35 31 36 32 37 TestEntity::TestEntity () 33 38 { 34 this-> setClassID(CL_TEST_ENTITY, "TestEntity");35 // TO SOME LIST!! 39 this->init(); 40 } 36 41 37 this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");38 // this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");39 // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");40 42 41 /// FIXME42 // this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);43 43 44 this->md2Model->setAnim(RUN); 45 this->md2Model->debug(); 44 TestEntity::TestEntity(const TiXmlElement* root) 45 { 46 this->init(); 47 if (root != NULL) 48 this->loadParams(root); 49 50 this->init(); 46 51 } 47 52 48 53 49 54 TestEntity::~TestEntity () 55 {} 56 57 58 59 void TestEntity::init() 50 60 { 51 delete this->md2Model; 61 this->setClassID(CL_TEST_ENTITY, "TestEntity"); 62 this->toList(OM_COMMON); 63 } 64 65 /** 66 * loads the Settings of a MD2Creature from an XML-element. 67 * @param root the XML-element to load the MD2Creature's properties from 68 */ 69 void TestEntity::loadParams(const TiXmlElement* root) 70 { 71 static_cast<WorldEntity*>(this)->loadParams(root); 72 73 LoadParam(root, "md2animation", this, TestEntity, setAnim) 74 .describe("sets the animation of the md2 model") 75 .defaultValues(1, 1); 76 52 77 } 53 78 … … 55 80 void TestEntity::setAnim(int animationIndex) 56 81 { 57 this->md2Model->setAnim(animationIndex); 82 if( likely(this->getModel(0) != NULL)) 83 ((MD2Model*)this->getModel(0))->setAnim(animationIndex); 58 84 } 59 85 … … 61 87 void TestEntity::tick (float time) 62 88 { 63 this->md2Model->tick(time); 89 if( likely(this->getModel(0) != NULL)) 90 ((MD2Model*)this->getModel(0))->tick(time); 91 64 92 } 65 93 66 94 67 95 void TestEntity::collidesWith(WorldEntity* entity, const Vector& location) 68 { 69 if (entity->isA(CL_PROJECTILE)) 70 { 71 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 72 this->setVisibiliy(false); 73 this->toList(OM_DEAD); 74 } 75 } 76 77 void TestEntity::destroy () {} 78 96 {} 79 97 80 98 … … 82 100 void TestEntity::draw () const 83 101 { 84 glMatrixMode(GL_MODELVIEW); 85 glPushMatrix(); 86 float matrix[4][4]; 87 88 89 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 90 this->getAbsDir().matrix (matrix); 91 glMultMatrixf((float*)matrix); 92 this->md2Model->draw(); 93 94 95 glPopMatrix(); 102 this->drawLODsafe(); 96 103 } 97 104
Note: See TracChangeset
for help on using the changeset viewer.