Changeset 4710 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jun 26, 2005, 10:10:48 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/cd_engine.cc
r4704 r4710 130 130 this->rootTree->spawnBVTree(depth, vertices, numVertices); 131 131 } 132 133 void CDEngine::debugDraw(int depth, int drawMode) 134 { 135 if(this-> rootTree != NULL) 136 this->rootTree->drawBV(depth, drawMode); 137 } -
orxonox/trunk/src/lib/collision_detection/cd_engine.h
r4688 r4710 52 52 void debug(); 53 53 void debugSpawnTree(int depth, sVec3D* vertices, int numVertices); 54 void debugDraw(int depth, int drawMode); 54 55 55 56 private: -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4708 r4710 114 114 115 115 116 if(this->tmpLen1 > 0)116 if(this->tmpLen1 > 2) 117 117 { 118 118 OBBTreeNode* node1 = new OBBTreeNode(); … … 125 125 } 126 126 127 if( this->tmpLen2 > 0)127 if( this->tmpLen2 > 2) 128 128 { 129 129 OBBTreeNode* node2 = new OBBTreeNode(); … … 133 133 else 134 134 { 135 PRINTF(0)("Abo arding tree walk: less than 3 vertices left\n");135 PRINTF(0)("Abording tree walk: less than 3 vertices left\n"); 136 136 } 137 137 … … 420 420 421 421 /* get the maximal dimensions of the body in all directions */ 422 maxLength[0] = 0.0f;423 minLength[0] = 0.0f;422 maxLength[0] = p0.distancePoint(vertices[0]); 423 minLength[0] = p0.distancePoint(vertices[0]); 424 424 for(int j = 0; j < length; ++j) 425 425 { … … 431 431 } 432 432 433 maxLength[1] = 0.0f;434 minLength[1] = 0.0f;433 maxLength[1] = p1.distancePoint(vertices[0]); 434 minLength[1] = p1.distancePoint(vertices[0]); 435 435 for(int j = 0; j < length; ++j) 436 436 { … … 442 442 } 443 443 444 maxLength[2] = 0.0f;445 minLength[2] = 0.0f;444 maxLength[2] = p2.distancePoint(vertices[0]); 445 minLength[2] = p2.distancePoint(vertices[0]); 446 446 for(int j = 0; j < length; ++j) 447 447 { … … 460 460 { 461 461 PRINTF(3)("max: %f, min: %f \n", maxLength[i], minLength[i]); 462 centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f; // min length is negatie463 newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative462 centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f; // min length is negatie 463 newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative 464 464 *box->center += (box->axis[i] * centerOffset[i]); // update the new center vector 465 465 halfLength[i] = newHalfLength[i]; … … 478 478 { 479 479 //if( box->halfLength[i] == 0.0) 480 PRINTF(3)("length[%i] = %f\n", i, box->halfLength[i]); 480 if(fabs(box->halfLength[i]) > 5.0f) 481 { 482 PRINTF(0)("length[%i] = %f\n", i, box->halfLength[i]); 483 PRINTF(0)("MaxLength = %f, MinLength = %f\n", maxLength[i], minLength[i]); 484 PRINTF(0)("\nVertex Data:\n"); 485 for(int i = 0; i < length; i++) 486 { 487 PRINTF(0)("vertex %i: %f, %f, %f\n", i, box->vertices[i][0], box->vertices[i][1], box->vertices[i][2]); 488 } 489 } 481 490 } 482 491 } … … 525 534 } 526 535 527 //PRINTF(3)("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);536 PRINTF(3)("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist); 528 537 529 538 … … 534 543 tList<sVec3D> partition2; //!< the vertex partition 2 535 544 545 536 546 PRINTF(3)("vertex index: %i, of %i\n", vertexIndex, box->numOfVertices); 537 547 this->separationPlane = new Plane(box->axis[axisIndex], box->vertices[vertexIndex]); //!< separation plane … … 541 551 for(int i = 0; i < box->numOfVertices; ++i) 542 552 { 543 if( this->separationPlane->distancePoint(box->vertices[i]) > 0.0f) 544 partition1.add(&box->vertices[i]); 553 if( i == vertexIndex) continue; 554 tmpDist = this->separationPlane->distancePoint(box->vertices[i]); 555 if( tmpDist > 0.0) 556 partition1.add(&box->vertices[i]); /* positive numbers plus zero */ 545 557 else 546 partition2.add(&box->vertices[i]); 558 partition2.add(&box->vertices[i]); /* negatice numbers */ 547 559 } 548 560 partition1.add(&box->vertices[vertexIndex]); 549 550 // PRINTF(3)("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize()); 561 partition2.add(&box->vertices[vertexIndex]); 562 563 PRINTF(3)("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize()); 551 564 552 565 … … 827 840 if( drawMode & DRAW_BV_POLYGON || drawMode & DRAW_ALL || drawMode & DRAW_BV_BLENDED) 828 841 { 842 if(this->nodeLeft == NULL && this->nodeRight == NULL) 843 depth = 0; 829 844 if( !(drawMode & DRAW_SINGLE && depth != 0)) 830 845 { -
orxonox/trunk/src/subprojects/collision_detection/Makefile.am
r4679 r4710 41 41 $(MAINSRCDIR)/world_entities/world_entity.cc 42 42 43 #$(MAINSRCDIR)/util/loading/load_param.cc 43 44 44 45 -
orxonox/trunk/src/subprojects/collision_detection/Makefile.in
r4679 r4710 878 878 include $(MAINSRCDIR)/defs/include_paths.am 879 879 880 #$(MAINSRCDIR)/util/loading/load_param.cc 881 880 882 # $(MAINSRCDIR)/util/loading/game_loader.cc \ 881 883 # $(MAINSRCDIR)/util/track/track_manager.cc \ -
orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
r4708 r4710 29 29 #include "test_entity.h" 30 30 #include "environment.h" 31 31 32 32 33 #include "graphics_engine.h" … … 44 45 bool drawModel; 45 46 46 Environment* a; 47 Environment* b; 47 WorldEntity* a; 48 WorldEntity* b; 49 //Terrain* c; 48 50 49 51 void Framework::moduleInit(int argc, char** argv) … … 53 55 CDEngine::getInstance(); 54 56 55 /* Simple Test */ 56 //CDEngine::getInstance()->debug(); 57 /* Primitive Data Test */ 58 // sVec3D* data = new sVec3D[6]; 59 // float tmp[6][3] = {{0.0, 4.2, 2.4}, {3.0, 3.0, 2.0}, {5.0, 1.0, 6.0}, {6.5, 1.0, 3.0}, {7.0, 3.0, 5.0}, {8.0, 6.0, 6.0}}; 60 // for(int i = 0; i < 6; ++i) 61 // { 62 // data[i][0] = tmp[i][0]; 63 // data[i][1] = tmp[i][1]; 64 // data[i][2] = tmp[i][2]; 65 // } 66 // CDEngine::getInstance()->debugSpawnTree(5, data, 6); 57 67 58 68 /* MD2 Model Test */ … … 69 79 entityList = new tList<WorldEntity>(); 70 80 71 //a = new TestEntity(); a->setName("Clown1"); 72 a = new Environment(); a->setName("Clown"); 73 b = new Environment(); b->setName("Jaeger"); 81 a = new TestEntity(); a->setName("Clown1"); 82 b = new Environment(); a->setName("Clown"); 83 //b = new Environment(); b->setName("Jaeger"); 84 //c = new Terrain(); 74 85 75 86 b->setRelCoor(0.0, 0.0, -10.0); 76 b->setRelDir(Quaternion(-M_PI/2.0f, Vector(0.0, 1.0, 0.0))); 77 78 // TestEntity* c = new TestEntity(); c->setName("Colwn2"); 79 // c->setRelCoor(0.0, 0.0, -20.0); 87 //b->setRelDir(Quaternion(-M_PI/2.0f, Vector(0.0, 1.0, 0.0))); 80 88 81 89 entityList->add(a); … … 85 93 86 94 LightManager* lightMan = LightManager::getInstance(); 87 lightMan->setAmbientColor(.1,.1,.1);95 lightMan->setAmbientColor(.1,.1,.1); 88 96 lightMan->addLight(); 89 lightMan->setPosition( 30, 30, 30);97 lightMan->setPosition(-5.0, 50.0, -40.0); 90 98 lightMan->addLight(); 91 lightMan->setPosition(-30, -30, -30); 99 lightMan->setPosition(100, 80, 60); 100 92 101 93 102 /* properties */ … … 223 232 224 233 225 b->shiftCoor(Vector(0.0, 0.0, iterata));234 //b->shiftCoor(Vector(0.0, 0.0, iterata)); 226 235 227 236 … … 239 248 void Framework::moduleDraw() const 240 249 { 250 //CDEngine::getInstance()->debugDraw(depth, drawMode); 251 241 252 tIterator<WorldEntity>* iterator = entityList->getIterator(); 242 253 WorldEntity* entity = iterator->nextElement(); … … 371 382 372 383 373 Slider* TreeDepth = new Slider("TreeDepth", 0, 5);384 Slider* TreeDepth = new Slider("TreeDepth", 0, 10); 374 385 TreeDepth->connectSignal("value_changed", (void*)TreeDepth, treeDepth); 375 386 windowBox->fill(TreeDepth); -
orxonox/trunk/src/world_entities/environment.cc
r4682 r4710 33 33 { 34 34 this->setClassID(CL_ENVIRONMENT, "Environment"); 35 this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj" , OBJ, RP_CAMPAIGN);35 this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj"/*"worlds/vulcania.obj"*/, OBJ, RP_CAMPAIGN); 36 36 37 this->obbTree = new OBBTree( 4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());37 this->obbTree = new OBBTree(10, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount()); 38 38 } 39 39
Note: See TracChangeset
for help on using the changeset viewer.