diff --git a/VisualStudio/osgSim/osgSim.dsp b/VisualStudio/osgSim/osgSim.dsp index 8ebf7f9d2..386195051 100644 --- a/VisualStudio/osgSim/osgSim.dsp +++ b/VisualStudio/osgSim/osgSim.dsp @@ -167,6 +167,10 @@ SOURCE=..\..\src\osgSim\DOFTransform.cpp # End Source File # Begin Source File +SOURCE=..\..\src\osgSim\HeightAboveTerrain.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\osgSim\Impostor.cpp # End Source File # Begin Source File @@ -195,6 +199,10 @@ SOURCE=..\..\src\osgSim\LightPointNode.cpp # End Source File # Begin Source File +SOURCE=..\..\src\osgSim\LineOfSight.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\osgSim\MultiSwitch.cpp # End Source File # Begin Source File @@ -251,6 +259,10 @@ SOURCE=..\..\include\osgSim\Export # End Source File # Begin Source File +SOURCE=..\..\include\osgSim\HeightAboveTerrain +# End Source File +# Begin Source File + SOURCE=..\..\Include\osgSim\Impostor # End Source File # Begin Source File @@ -283,6 +295,10 @@ SOURCE=..\..\include\osgSim\LightPointSystem # End Source File # Begin Source File +SOURCE=..\..\include\osgSim\LineOfSight +# End Source File +# Begin Source File + SOURCE=..\..\include\osgSim\MultiSwitch # End Source File # Begin Source File diff --git a/examples/osgintersection/GNUmakefile b/examples/osgintersection/GNUmakefile index f02d536f7..dd2c59628 100644 --- a/examples/osgintersection/GNUmakefile +++ b/examples/osgintersection/GNUmakefile @@ -4,7 +4,7 @@ include $(TOPDIR)/Make/makedefs CXXFILES =\ osgintersection.cpp\ -LIBS += -losgText -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) +LIBS += -losgText -losgSim -losgGA -losgDB -losgUtil -losg $(GL_LIBS) $(X_LIBS) $(OTHER_LIBS) INSTFILES = \ $(CXXFILES)\ diff --git a/examples/osgintersection/osgintersection.cpp b/examples/osgintersection/osgintersection.cpp index 0f0f20a04..db226fdbc 100644 --- a/examples/osgintersection/osgintersection.cpp +++ b/examples/osgintersection/osgintersection.cpp @@ -8,6 +8,8 @@ #include +#include + #include struct MyReadCallback : public osgUtil::IntersectionVisitor::ReadCallback @@ -45,8 +47,62 @@ int main(int argc, char **argv) bool useIntersectorGroup = true; + bool useLineOfSight = true; - if (useIntersectorGroup) + if (useLineOfSight) + { + osg::Timer_t startTick = osg::Timer::instance()->tick(); + + osg::Vec3d start = bs.center() + osg::Vec3d(0.0,bs.radius(),0.0); + osg::Vec3d end = bs.center();// - osg::Vec3d(0.0, bs.radius(),0.0); + osg::Vec3d deltaRow( 0.0, 0.0, bs.radius()*0.01); + osg::Vec3d deltaColumn( bs.radius()*0.01, 0.0, 0.0); + unsigned int numRows = 50; + unsigned int numColumns = 50; + + osgSim::LineOfSight los; + + for(unsigned int r=0; rtick(); + + std::cout<<"Completed in "<delta_s(startTick,endTick)<tick(); + + los.computeIntersections(root.get()); + + endTick = osg::Timer::instance()->tick(); + + std::cout<<"Completed in "<delta_s(startTick,endTick)<tick(); diff --git a/include/osgUtil/IntersectionVisitor b/include/osgUtil/IntersectionVisitor index 5cc50fe35..2bd23a134 100644 --- a/include/osgUtil/IntersectionVisitor +++ b/include/osgUtil/IntersectionVisitor @@ -15,6 +15,7 @@ #define OSGUTIL_INTERSECTIONVISITOR 1 #include +#include #include #include diff --git a/src/osgSim/GNUmakefile b/src/osgSim/GNUmakefile index 545b3cd26..47f44ed2c 100644 --- a/src/osgSim/GNUmakefile +++ b/src/osgSim/GNUmakefile @@ -13,6 +13,8 @@ CXXFILES = \ LightPointDrawable.cpp\ LightPointSpriteDrawable.cpp\ LightPointNode.cpp\ + LineOfSight.cpp\ + HeightAboveTerrain.cpp\ MultiSwitch.cpp\ OverlayNode.cpp\ OpenFlightOptimizer.cpp\ diff --git a/src/osgUtil/IntersectionVisitor.cpp b/src/osgUtil/IntersectionVisitor.cpp index 5434d7be2..6e15c52e2 100644 --- a/src/osgUtil/IntersectionVisitor.cpp +++ b/src/osgUtil/IntersectionVisitor.cpp @@ -1,3 +1,16 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield + * + * This library is open source and may be redistributed and/or modified under + * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or + * (at your option) any later version. The full license is in LICENSE file + * included with this distribution, and on the openscenegraph.org website. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * OpenSceneGraph Public License for more details. +*/ + #include