Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4670 in orxonox.OLD for orxonox


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

orxonox/trunk: obb tree now can get rendered transparent

Location:
orxonox/trunk/src/lib/collision_detection
Files:
3 edited

Legend:

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

    r4668 r4670  
    4444  material[3]->setAmbient(5.0, 3.0, 1.0);
    4545  material[4]->setAmbient(1.0, 0.0, 7.0);
     46
     47
     48  transparentMaterial = new Material*[5];
     49  for(int i = 0; i < 5; ++i)
     50  {
     51    transparentMaterial[i] = new Material();
     52    transparentMaterial[i]->setIllum(3);
     53    transparentMaterial[i]->setTransparency(0.5);
     54  }
     55  transparentMaterial[0]->setAmbient(0.0, 0.3, 0.0);
     56  transparentMaterial[1]->setAmbient(0.4, 0.0, 0.2);
     57  transparentMaterial[2]->setAmbient(1.0, 0.0, 0.0);
     58  transparentMaterial[3]->setAmbient(5.0, 3.0, 1.0);
     59  transparentMaterial[4]->setAmbient(1.0, 0.0, 7.0);
    4660
    4761  this->id = 0;
  • orxonox/trunk/src/lib/collision_detection/obb_tree.h

    r4638 r4670  
    3030
    3131    Material* getMaterial(unsigned int depth) { return material[depth%5]; }
     32    Material* getTransparentMaterial(unsigned int depth) { return transparentMaterial[depth%5]; }
    3233    int getID() { return ++this->id;}
    3334
     
    4243    OBBTreeNode*         rootNode;                        //!< reference to the root node of the tree
    4344    Material**           material;
     45    Material**           transparentMaterial;
    4446    int                  id;
    4547};
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4669 r4670  
    685685    float* len = this->bvElement->halfLength;
    686686
     687    if( drawMode & DRAW_BV_BLENDED)
     688      this->obbTree->getTransparentMaterial(treeIndex)->select();
     689
    687690    /* draw bounding box */
    688     glBegin(GL_QUAD_STRIP);
     691    if( drawMode & DRAW_BV_BLENDED)
     692      glBegin(GL_QUADS);
     693    else
     694      glBegin(GL_LINE_LOOP);
    689695    glVertex3f(cen.x + axis[0].x * len[0] + axis[1].x * len[1] + axis[2].x * len[2],
    690696               cen.y + axis[0].y * len[0] + axis[1].y * len[1] + axis[2].y * len[2],
     
    701707    glEnd();
    702708
    703     glBegin(GL_LINE_LOOP);
     709    if( drawMode & DRAW_BV_BLENDED)
     710      glBegin(GL_QUADS);
     711    else
     712      glBegin(GL_LINE_LOOP);
    704713    glVertex3f(cen.x + axis[0].x * len[0] - axis[1].x * len[1] + axis[2].x * len[2],
    705714               cen.y + axis[0].y * len[0] - axis[1].y * len[1] + axis[2].y * len[2],
     
    716725    glEnd();
    717726
    718     glBegin(GL_LINE_LOOP);
     727    if( drawMode & DRAW_BV_BLENDED)
     728      glBegin(GL_QUADS);
     729    else
     730      glBegin(GL_LINE_LOOP);
    719731    glVertex3f(cen.x - axis[0].x * len[0] - axis[1].x * len[1] + axis[2].x * len[2],
    720732               cen.y - axis[0].y * len[0] - axis[1].y * len[1] + axis[2].y * len[2],
     
    731743    glEnd();
    732744
    733     glBegin(GL_LINE_LOOP);
     745    if( drawMode & DRAW_BV_BLENDED)
     746      glBegin(GL_QUADS);
     747    else
     748      glBegin(GL_LINE_LOOP);
    734749    glVertex3f(cen.x - axis[0].x * len[0] + axis[1].x * len[1] - axis[2].x * len[2],
    735750               cen.y - axis[0].y * len[0] + axis[1].y * len[1] - axis[2].y * len[2],
     
    745760               cen.z + axis[0].z * len[0] + axis[1].z * len[1] - axis[2].z * len[2]);
    746761    glEnd();
     762
     763    if( drawMode & DRAW_BV_BLENDED)
     764      this->obbTree->getMaterial(treeIndex)->select();
    747765    }
    748766
Note: See TracChangeset for help on using the changeset viewer.