Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4712 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 26, 2005, 10:56:45 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: more draw options

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/bv_tree.h

    r4700 r4712  
    2626  DRAW_BV_BLENDED        = 1<<4,
    2727  DRAW_BV_POLYGON        = 1<<5,
    28   DRAW_MODEL             = 1<<6
     28  DRAW_MODEL             = 1<<6,
     29  DRAW_POINTS            = 1<<7
    2930};
    3031
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4711 r4712  
    472472  PRINTF(3)("-- Finished Calculating Attributes\n");
    473473
    474 
    475 
    476 //   PRINTF(3)("\nwe got length: \n");
    477   for(int i = 0; i < 3; ++i)
    478   {
    479     //if( box->halfLength[i] == 0.0)
    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     }
    490   }
    491474}
    492475
     
    626609  /* if the obb overlap, make subtests: check which node is realy overlaping  */
    627610  PRINT(3)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());
     611  //if( unlikely())
    628612  if( this->overlapTest(this->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB))
    629613  {
     
    780764    if( !(drawMode & DRAW_SINGLE && depth != 0))
    781765    {
     766      if( drawMode & DRAW_POINTS)
     767        glBegin(GL_POINTS);
    782768      for(int i = 0; i < this->bvElement->numOfVertices; ++i)
    783769      {
    784         glPushMatrix();
    785         //glMatrixMode(GL_MODELVIEW);
    786         //glVertex3f(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
    787         glTranslatef(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
    788         gluSphere(this->sphereObj, 0.1, 10, 10);
    789         //PRINTF(0)("v(%f, %f, %f)\n", this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
    790         glPopMatrix();
     770        if( drawMode & DRAW_POINTS)
     771          glVertex3f(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
     772        else
     773        {
     774          glPushMatrix();
     775          glTranslatef(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
     776          gluSphere(this->sphereObj, 0.1, 10, 10);
     777          glPopMatrix();
     778        }
    791779      }
     780      if( drawMode & DRAW_POINTS)
     781        glEnd();
    792782    }
    793783  }
  • orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc

    r4711 r4712  
    7979  entityList = new tList<WorldEntity>();
    8080
    81    a = new TestEntity(); a->setName("Clown1");
    82    b = new Environment(); a->setName("Clown");
    83   //b = new Environment(); b->setName("Jaeger");
     81  a = new TestEntity(); a->setName("Clown1");
     82  b = new Environment(); b->setName("Jaeger");
    8483  //c = new Terrain();
    8584
    86    b->setRelCoor(0.0, 0.0, -10.0);
     85  b->setRelCoor(0.0, 0.0, -10.0);
    8786  //b->setRelDir(Quaternion(-M_PI/2.0f, Vector(0.0, 1.0, 0.0)));
    8887
     
    336335
    337336
     337int drawPoints(GtkWidget* nonInterest, void* widget)
     338{
     339  if(drawMode & DRAW_POINTS)
     340  {
     341    int temp = drawMode & DRAW_POINTS;
     342    drawMode ^= temp;
     343
     344  }
     345  else
     346  {
     347    drawMode |= DRAW_POINTS;
     348    printf("Drawing OBB Polygons\n");
     349  }
     350}
     351
     352
    338353int treeDepth(GtkWidget* nonInterest, void* widget)
    339354{
     
    377392
    378393
     394      CheckButton* DrawPoints = new CheckButton("Draw Points");
     395      DrawPoints->connectSignal("clicked", (void*)DrawPoints, drawPoints);
     396      windowBox->fill(DrawPoints);
     397
     398
    379399      CheckButton* SeperatingPlanes = new CheckButton("SeperatingPlanes");
    380400      SeperatingPlanes->connectSignal("clicked", (void*)SeperatingPlanes, seperatingPlanes);
     
    382402
    383403
    384       Slider* TreeDepth = new Slider("TreeDepth", 0, 10);
     404      Slider* TreeDepth = new Slider("TreeDepth", 0, 17);
    385405      TreeDepth->connectSignal("value_changed", (void*)TreeDepth, treeDepth);
    386406      windowBox->fill(TreeDepth);
  • orxonox/trunk/src/world_entities/environment.cc

    r4710 r4712  
    3535  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj"/*"worlds/vulcania.obj"*/, OBJ, RP_CAMPAIGN);
    3636
    37   this->obbTree = new OBBTree(10, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
     37  this->obbTree = new OBBTree(15, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
    3838}
    3939
  • orxonox/trunk/src/world_entities/test_entity.cc

    r4682 r4712  
    3232
    3333  this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
    34   this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
     34  this->obbTree = new OBBTree(7, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
    3535  this->md2Model->debug();
    3636}
Note: See TracChangeset for help on using the changeset viewer.