root/OpenSceneGraph/trunk/examples/osgkdtree/osgkdtree.cpp @ 12292

Revision 12292, 2.2 kB (checked in by robert, 4 years ago)

Ran svn propset -R svn:eol-style native . on the OpenSceneGraph

  • Property svn:eol-style set to native
RevLine 
[8404]1/* OpenSceneGraph example, osgintersection.
2*
3*  Permission is hereby granted, free of charge, to any person obtaining a copy
4*  of this software and associated documentation files (the "Software"), to deal
5*  in the Software without restriction, including without limitation the rights
6*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7*  copies of the Software, and to permit persons to whom the Software is
8*  furnished to do so, subject to the following conditions:
9*
10*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16*  THE SOFTWARE.
17*/
18
[8410]19 
20#include <osgDB/ReadFile>
21
[8404]22#include <osg/ArgumentParser>
23#include <osg/ApplicationUsage>
24#include <osg/Timer>
25#include <osg/CoordinateSystemNode>
26#include <osg/Notify>
27#include <osg/io_utils>
[8408]28#include <osg/Geometry>
[8526]29#include <osg/TriangleIndexFunctor>
[8404]30
31
32#include <osgUtil/IntersectionVisitor>
33#include <osgUtil/LineSegmentIntersector>
[8414]34#include <osgUtil/UpdateVisitor>
[8404]35
36#include <osgSim/LineOfSight>
37#include <osgSim/HeightAboveTerrain>
38#include <osgSim/ElevationSlice>
39
[8535]40#include <osgViewer/Viewer>
41
42#include <osg/KdTree>
[8410]43
[8569]44#include <iostream>
45
[8404]46int main(int argc, char **argv)
47{
48    // use an ArgumentParser object to manage the program arguments.
49    osg::ArgumentParser arguments(&argc,argv);
50   
[8528]51    int maxNumLevels = 16;
52    int targetNumIndicesPerLeaf = 16;
[8526]53
[8528]54    while (arguments.read("--max", maxNumLevels)) {}
55    while (arguments.read("--leaf", targetNumIndicesPerLeaf)) {}
56   
[8535]57    osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
58   
[8404]59    osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
60   
61    if (!scene)
62    {
63        std::cout<<"No model loaded, please specify a valid model on the command line."<<std::endl;
64        return 0;
65    }
[8411]66
[8569]67    osgViewer::Viewer viewer;
68    viewer.setSceneData(scene.get());
69    return viewer.run();
[8404]70}
Note: See TracBrowser for help on using the browser.