Show
Ignore:
Timestamp:
07/04/08 17:57:48 (6 years ago)
Author:
robert
Message:

Added prelimnary KdTree? data structure and automatic kdtree build support
into osgDB::Registry/osgTerrain so that newly created subgraphs can have
KdTree? built on all osg::Geometry automatically on load/creation.

Files:
1 modified

Legend:

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

    r8532 r8535  
    3838#include <osgSim/ElevationSlice> 
    3939 
     40#include <osgViewer/Viewer> 
     41 
    4042#include "fixeddivision.h" 
    4143#include "variabledivision.h" 
    4244 
     45#include <osg/KdTree> 
    4346 
    4447int main(int argc, char **argv) 
     
    5558    while (arguments.read("--points")) processTriangles = false; 
    5659    while (arguments.read("--triangles")) processTriangles = true; 
     60     
     61    osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES); 
    5762     
    5863    osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments); 
     
    8994        osg::notify(osg::NOTICE)<<"build speed "<<(double(builder._numVerticesProcessed)/time)/1000000.0<<"M vertices per second"<<std::endl; 
    9095    } 
    91     else 
     96    else if (arguments.read("--vd")) 
    9297    { 
    9398        variabledivision::KDTreeBuilder builder; 
     
    108113        osg::notify(osg::NOTICE)<<"build speed "<<(double(builder._numVerticesProcessed)/time)/1000000.0<<"M vertices per second"<<std::endl; 
    109114    }     
     115    else 
     116    { 
     117        osgViewer::Viewer viewer; 
     118        viewer.setSceneData(scene.get()); 
     119        return viewer.run(); 
     120    }     
    110121     
    111122    return 0;