Changeset 7711 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- May 18, 2006, 11:44:21 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environment.cc
r7193 r7711 37 37 this->init(); 38 38 this->loadModel("models/ships/bolido.obj"); 39 // if(this->obbTree == NULL) 40 // this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount()); 39 41 } 40 42 -
trunk/src/world_entities/test_entity.cc
r7488 r7711 41 41 { 42 42 this->init(); 43 this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx"); 43 44 } 44 45 46 47 // this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx"); 48 // this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp"); 49 // this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices); 45 50 46 51 -
trunk/src/world_entities/world_entity.cc
r7230 r7711 36 36 SHELL_COMMAND(model, WorldEntity, loadModel) 37 37 ->describe("sets the Model of the WorldEntity") 38 ->defaultValues("models/ships/fighter.obj", 1.0 );38 ->defaultValues("models/ships/fighter.obj", 1.0f); 39 39 40 40 SHELL_COMMAND(debugEntity, WorldEntity, debugWE); … … 118 118 * @param fileName the name of the model to load 119 119 * @param scaling the Scaling of the model 120 */ 121 void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber) 120 * 121 * FIXME 122 * @todo: separate the obb tree generation from the model 123 */ 124 void WorldEntity::loadModel(const std::string& fileName, float scaling, unsigned int modelNumber, unsigned int obbTreeDepth) 122 125 { 123 126 this->modelLODName = fileName; … … 154 157 155 158 if( modelNumber == 0) 156 this->buildObbTree( 4);159 this->buildObbTree(obbTreeDepth); 157 160 } 158 161 else if(fileName.find(".md2") != std::string::npos) … … 164 167 165 168 if( m != NULL) 166 this->buildObbTree( 4);169 this->buildObbTree(obbTreeDepth); 167 170 } 168 171 } … … 207 210 * @param depth the depth to calculate 208 211 */ 209 bool WorldEntity::buildObbTree( unsignedint depth)212 bool WorldEntity::buildObbTree(int depth) 210 213 { 211 214 if (this->obbTree) … … 214 217 if (this->models[0] != NULL) 215 218 { 216 PRINTF(4)("creating obb tree\n"); 217 218 219 this->obbTree = new OBBTree(depth, (sVec3D*)this->models[0]->getVertexArray(), this->models[0]->getVertexCount()); 219 this->obbTree = new OBBTree(depth, models[0]->getModelInfo(), this); 220 220 return true; 221 221 } 222 222 else 223 223 { 224 PRINTF( 2)("could not create obb-tree, because no model was loaded yet\n");224 PRINTF(1)("could not create obb-tree, because no model was loaded yet\n"); 225 225 this->obbTree = NULL; 226 226 return false; … … 468 468 * @param drawMode the mode to draw this entity under 469 469 */ 470 void WorldEntity::drawBVTree( unsignedint depth, int drawMode) const470 void WorldEntity::drawBVTree(int depth, int drawMode) const 471 471 { 472 472 glMatrixMode(GL_MODELVIEW); … … 480 480 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 481 481 482 482 483 if (this->obbTree) 483 484 this->obbTree->drawBV(depth, drawMode); 485 486 484 487 glPopMatrix(); 485 488 } … … 571 574 std::string name = getModel( 0 )->getName(); 572 575 573 if ( name.find( ResourceManager::getInstance()->getDataDir() ) == 0 ) 576 if ( name.find( ResourceManager::getInstance()->getDataDir() ) == 0 ) 574 577 { 575 578 name.erase(ResourceManager::getInstance()->getDataDir().size()); -
trunk/src/world_entities/world_entity.h
r7460 r7711 2 2 * @file world_entity.h 3 3 * Definition of the basic WorldEntity 4 */4 */ 5 5 6 6 #ifndef _WORLD_ENTITY_H … … 35 35 virtual void loadParams(const TiXmlElement* root); 36 36 37 void loadModel(const std::string& fileName, float scaling = 1.0f, unsigned int modelNumber = 0 );37 void loadModel(const std::string& fileName, float scaling = 1.0f, unsigned int modelNumber = 0, unsigned int obbTreeDepth = 4); 38 38 void setModel(Model* model, unsigned int modelNumber = 0); 39 39 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; }; 40 40 41 41 inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; } 42 43 bool buildObbTree(unsigned int depth);44 /** @returns a reference to the obb tree of this worldentity */45 BVTree* getOBBTree() const { return this->obbTree; };46 42 47 43 /** @param visibility if the Entity should be visible (been draw) */ … … 57 53 58 54 virtual void tick (float time); 59 60 55 virtual void draw () const; 61 56 57 bool buildObbTree(int depth); 62 58 virtual void collidesWith (WorldEntity* entity, const Vector& location); 63 void drawBVTree(unsigned int depth, int drawMode) const; 64 59 /** @returns a reference to the obb tree of this worldentity */ 60 inline BVTree* getOBBTree() const { return this->obbTree; }; 61 void drawBVTree(int depth, int drawMode) const; 65 62 66 63 void debugWE() { this->debugEntity(); } … … 77 74 78 75 void toList(OM_LIST list); 76 79 77 80 78 /** @returns a Reference to the objectListNumber to set. */ … … 101 99 void setHealthMax(float healthMax); 102 100 void createHealthWidget(); 101 103 102 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity 104 103 private:
Note: See TracChangeset
for help on using the changeset viewer.