Changeset 7711 in orxonox.OLD for trunk/src/world_entities/world_entity.cc
- Timestamp:
- May 18, 2006, 11:44:21 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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());
Note: See TracChangeset
for help on using the changeset viewer.