Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4671 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 23, 2005, 6:54:34 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: the blended boxes get rendered correctly

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/obb_tree.cc

    r4670 r4671  
    5151    transparentMaterial[i] = new Material();
    5252    transparentMaterial[i]->setIllum(3);
    53     transparentMaterial[i]->setTransparency(0.5);
     53    transparentMaterial[i]->setTransparency(0.2);
    5454  }
    5555  transparentMaterial[0]->setAmbient(0.0, 0.3, 0.0);
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4670 r4671  
    761761    glEnd();
    762762
     763
     764    if( drawMode & DRAW_BV_BLENDED)
     765    {
     766      glBegin(GL_QUADS);
     767      glVertex3f(cen.x - axis[0].x * len[0] + axis[1].x * len[1] - axis[2].x * len[2],
     768                 cen.y - axis[0].y * len[0] + axis[1].y * len[1] - axis[2].y * len[2],
     769                 cen.z - axis[0].z * len[0] + axis[1].z * len[1] - axis[2].z * len[2]);
     770      glVertex3f(cen.x + axis[0].x * len[0] + axis[1].x * len[1] - axis[2].x * len[2],
     771                 cen.y + axis[0].y * len[0] + axis[1].y * len[1] - axis[2].y * len[2],
     772                 cen.z + axis[0].z * len[0] + axis[1].z * len[1] - axis[2].z * len[2]);
     773      glVertex3f(cen.x + axis[0].x * len[0] - axis[1].x * len[1] - axis[2].x * len[2],
     774                 cen.y + axis[0].y * len[0] - axis[1].y * len[1] - axis[2].y * len[2],
     775                 cen.z + axis[0].z * len[0] - axis[1].z * len[1] - axis[2].z * len[2]);
     776      glVertex3f(cen.x - axis[0].x * len[0] - axis[1].x * len[1] - axis[2].x * len[2],
     777                 cen.y - axis[0].y * len[0] - axis[1].y * len[1] - axis[2].y * len[2],
     778                 cen.z - axis[0].z * len[0] - axis[1].z * len[1] - axis[2].z * len[2]);
     779      glEnd();
     780
     781      glBegin(GL_QUADS);
     782      glVertex3f(cen.x - axis[0].x * len[0] + axis[1].x * len[1] + axis[2].x * len[2],
     783                 cen.y - axis[0].y * len[0] + axis[1].y * len[1] + axis[2].y * len[2],
     784                 cen.z - axis[0].z * len[0] + axis[1].z * len[1] + axis[2].z * len[2]);
     785      glVertex3f(cen.x + axis[0].x * len[0] + axis[1].x * len[1] + axis[2].x * len[2],
     786                 cen.y + axis[0].y * len[0] + axis[1].y * len[1] + axis[2].y * len[2],
     787                 cen.z + axis[0].z * len[0] + axis[1].z * len[1] + axis[2].z * len[2]);
     788      glVertex3f(cen.x + axis[0].x * len[0] - axis[1].x * len[1] + axis[2].x * len[2],
     789                 cen.y + axis[0].y * len[0] - axis[1].y * len[1] + axis[2].y * len[2],
     790                 cen.z + axis[0].z * len[0] - axis[1].z * len[1] + axis[2].z * len[2]);
     791      glVertex3f(cen.x - axis[0].x * len[0] - axis[1].x * len[1] + axis[2].x * len[2],
     792                 cen.y - axis[0].y * len[0] - axis[1].y * len[1] + axis[2].y * len[2],
     793                 cen.z - axis[0].z * len[0] - axis[1].z * len[1] + axis[2].z * len[2]);
     794      glEnd();
     795    }
     796
     797
    763798    if( drawMode & DRAW_BV_BLENDED)
    764799      this->obbTree->getMaterial(treeIndex)->select();
     
    771806    if( !(drawMode & DRAW_SINGLE && depth != 0))
    772807    {
     808      if( drawMode & DRAW_BV_BLENDED)
     809        this->obbTree->getTransparentMaterial(treeIndex)->select();
     810
    773811    /* now draw the separation plane */
    774812    Vector a1 = this->bvElement->axis[(this->longestAxisIndex + 1)%3];
     
    783821    glVertex3f(c.x + a1.x * l1 - a2.x * l2, c.y + a1.y * l1- a2.y * l2, c.z + a1.z * l1 - a2.z * l2);
    784822    glEnd();
     823
     824    if( drawMode & DRAW_BV_BLENDED)
     825      this->obbTree->getMaterial(treeIndex)->select();
     826
    785827    }
    786828  }
  • orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc

    r4661 r4671  
    232232}
    233233
     234
     235int blendedBox(GtkWidget* nonInterest, void* widget)
     236{
     237  if(drawMode & DRAW_BV_BLENDED)
     238  {
     239    int temp = drawMode & DRAW_BV_BLENDED;
     240    drawMode ^= temp;
     241    printf("Removing OBB Polygons\n");
     242  }
     243  else
     244  {
     245    drawMode |= DRAW_BV_BLENDED;
     246    printf("Drawing OBB Polygons\n");
     247  }
     248}
     249
     250
    234251int treeDepth(GtkWidget* nonInterest, void* widget)
    235252{
     
    258275    Box* windowBox = new Box('v');
    259276    {
    260       CheckButton* BoxPolygons = new CheckButton("BoxPolygons");
     277      CheckButton* BoxPolygons = new CheckButton("Draw OBB Polygons");
    261278      BoxPolygons->connectSignal("clicked", (void*)BoxPolygons, boxPolygons);
    262279      windowBox->fill(BoxPolygons);
     280
     281
     282      CheckButton* BlendedBox = new CheckButton("Draw OBB Blended");
     283      BlendedBox->connectSignal("clicked", (void*)BlendedBox, blendedBox);
     284      windowBox->fill(BlendedBox);
    263285
    264286
     
    266288      SeperatingPlanes->connectSignal("clicked", (void*)SeperatingPlanes, seperatingPlanes);
    267289      windowBox->fill(SeperatingPlanes);
     290
    268291
    269292      Slider* TreeDepth = new Slider("TreeDepth", 0, 5);
Note: See TracChangeset for help on using the changeset viewer.