//------------------------------------------------------------------------------
int QuadTree::buildDisplayList(QuadTreeNode* n, DisplayList* l, Camera* c) {
  if (n != NULL) {
    int r =  c->frustum.testSphere(n->boundingSphere);
    switch(r)
    {
      case -1:
        return (0);
      case 1:
        //bTestChildren = false;
        break;
      case 0:
        // check if the box is in view
        //switch(pPovCamera->Frustrum().ContainsAaBox(pNode->m_bbox)) {
        //case IN:
        //bTestChildren = false;
        //	break;
        //case OUT:
        //return;
        //}
        break;
    }

    if (n->child[0] == NULL && n->child[1] == NULL && n->child[2] == NULL && n->child[3] == NULL) {
      l->insertLast(n);
    }

    for (int i = 0; i < 4; i++) {
      buildDisplayList(n->child[i], l, c);
    }
  }

  return (0);
}
Exemple #2
0
// ============================================================================
// Constructor                                                                 
GLCube::GLCube(float _square_size, const QColor &c, bool activated ):GLObject()
{
  square_size = _square_size;
  dplist_index = glGenLists( 1 );
  buildDisplayList();
  setColor(c);
  is_activated=activated;
}
Exemple #3
0
// ============================================================================
// GLOctree::update()                                                          
// update tree with new Particles object                                       
void GLOctree::update(ParticlesData * _p_data ,
		      ParticlesSelectVector  * psv_)
{
  first=true;
  // copy pointers
  p_data = _p_data;
  psv   = psv_;
  new_data = true;

  // build Display list
  buildDisplayList();
}
Exemple #4
0
// ============================================================================
// GLOctree::update()                                                          
// update tree according store_options conditions                              
void GLOctree::update()
{
  //if (!first) return;
  setActivate(store_options->octree_display);
  // restore default object particles index
  for (int obj=0; obj< (int ) psv->size(); obj++ ) { 
    if ((*psv)[obj].vps->is_visible) {
      (*psv)[obj].vps->defaultIndexTab();
    }
  }
  if ( psv && ! store_options->octree_enable) {
    setActivate(false); // do not display tree
  } else {
    buildDisplayList();
  }
}
//------------------------------------------------------------------------------
int QuadTree::buildDisplayList(DisplayList* l, Camera* c) {
  buildDisplayList(root, l, c);
  return (0);
}