Show
Ignore:
Timestamp:
05/12/05 16:03:22 (10 years ago)
Author:
robert
Message:

Added new Node/Drawable::s/getInitialBound and Node/Drawable::s/getComputeBoundCallback
methods and reimplement computeBound so that it passes back a bounding volume rather
than modifying the local one.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgteapot/osgteapot.cpp

    r1844 r4202  
    227227         
    228228         
    229     protected: 
    230      
    231         virtual ~Teapot() {} 
    232          
    233229        // we need to set up the bounding box of the data too, so that the scene graph knows where this 
    234230        // objects is, for both positioning the camera at start up, and most importantly for culling. 
    235         virtual bool computeBound() const 
     231        virtual osg::BoundingBox computeBound() const 
    236232        { 
    237             _bbox.init(); 
     233            osg::BoundingBox bbox; 
    238234 
    239235            // follow is some truely horrible code required to calculate the  
     
    266262                  } 
    267263                   
    268                   _bbox.expandBy(osg::Vec3(p[j][k][0],p[j][k][1],p[j][k][2])); 
    269                   _bbox.expandBy(osg::Vec3(q[j][k][0],q[j][k][1],q[j][k][2])); 
     264                  bbox.expandBy(osg::Vec3(p[j][k][0],p[j][k][1],p[j][k][2])); 
     265                  bbox.expandBy(osg::Vec3(q[j][k][0],q[j][k][1],q[j][k][2])); 
    270266 
    271267                  if (i < 6) 
    272268                  { 
    273                     _bbox.expandBy(osg::Vec3(r[j][k][0],r[j][k][1],r[j][k][2])); 
    274                     _bbox.expandBy(osg::Vec3(s[j][k][0],s[j][k][1],s[j][k][2])); 
     269                    bbox.expandBy(osg::Vec3(r[j][k][0],r[j][k][1],r[j][k][2])); 
     270                    bbox.expandBy(osg::Vec3(s[j][k][0],s[j][k][1],s[j][k][2])); 
    275271                  } 
    276272                   
     
    280276            } 
    281277 
    282             _bbox_computed = true; 
    283             return true; 
     278            return bbox; 
    284279        } 
     280 
     281    protected: 
     282     
     283        virtual ~Teapot() {} 
     284         
    285285}; 
    286286