Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 3, 2005, 10:22:30 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: BV-nodes are now renddered more efficiently.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r5449 r5481  
    2525
    2626#include <math.h>
     27#include "color.h"
    2728
    2829#include "stdincl.h"
    29 
    3030#include "lin_alg.h"
    3131#include "glincl.h"
     
    806806
    807807
    808 void OBBTreeNode::drawBV(int depth, int drawMode)
     808void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color,  bool top) const
    809809{
    810   this->obbTree->getMaterial(treeIndex)->select();
    811810
    812811  /* draw the model itself, there is some problem concerning this: the vertices are drawn multiple times */
     
    834833  }
    835834
     835  if (top)
     836  {
     837    glPushAttrib(GL_ENABLE_BIT);
     838    glDisable(GL_LIGHTING);
     839    glDisable(GL_TEXTURE_2D);
     840    glDisable(GL_BLEND);
     841  }
     842  glColor3f(color.x, color.y, color.z);
     843
    836844
    837845  /* draw world axes */
     
    839847  {
    840848    glBegin(GL_LINES);
    841     glColor3f(0.0, 0.4, 0.3);
     849    glColor3f(1.0, 0.0, 0.0);
    842850    glVertex3f(0.0, 0.0, 0.0);
    843851    glVertex3f(3.0, 0.0, 0.0);
    844852
     853    glColor3f(0.0, 1.0, 0.0);
    845854    glVertex3f(0.0, 0.0, 0.0);
    846855    glVertex3f(0.0, 3.0, 0.0);
    847856
     857    glColor3f(0.0, 0.0, 1.0);
    848858    glVertex3f(0.0, 0.0, 0.0);
    849859    glVertex3f(0.0, 0.0, 3.0);
     
    890900
    891901    if( this->bvElement->bCollided)
    892       this->obbTree->getCollisionMaterial()->select();
     902    {
     903      glColor3f(1.0, 1.0, 1.0); // COLLISION COLOR
     904    }
    893905    else if( drawMode & DRAW_BV_BLENDED)
    894       this->obbTree->getTransparentMaterial(treeIndex)->select();
     906    {
     907      glColor4f(color.x, color.y, color.z, .5);
     908    }
    895909
    896910
     
    10051019
    10061020    if( drawMode & DRAW_BV_BLENDED)
    1007       this->obbTree->getMaterial(treeIndex)->select();
     1021      glColor3f(color.x, color.y, color.z);
    10081022    }
    10091023
     
    10161030    {
    10171031      if( drawMode & DRAW_BV_BLENDED)
    1018         this->obbTree->getTransparentMaterial(treeIndex)->select();
     1032        glColor4f(color.x, color.y, color.z, .6);
    10191033
    10201034    /* now draw the separation plane */
     
    10321046
    10331047    if( drawMode & DRAW_BV_BLENDED)
    1034       this->obbTree->getMaterial(treeIndex)->select();
    1035 
    1036     }
    1037   }
    1038 
    1039 
    1040 
    1041   if( this->nodeLeft != NULL && depth != 0 )
    1042     this->nodeLeft->drawBV(depth - 1, drawMode);
    1043   if( this->nodeRight != NULL && depth != 0)
    1044     this->nodeRight->drawBV(depth - 1, drawMode);
    1045 
     1048      glColor4f(color.x, color.y, color.z, 1.0);
     1049
     1050    }
     1051  }
     1052
     1053
     1054
     1055  if (depth > 0)
     1056  {
     1057    Vector childColor =  Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(20,0,.0));
     1058    if( this->nodeLeft != NULL)
     1059      this->nodeLeft->drawBV(depth - 1, drawMode, childColor, false);
     1060    if( this->nodeRight != NULL)
     1061      this->nodeRight->drawBV(depth - 1, drawMode, childColor, false);
     1062  }
    10461063  this->bvElement->bCollided = false;
     1064
     1065  if (top)
     1066    glPopAttrib();
    10471067}
    10481068
Note: See TracChangeset for help on using the changeset viewer.