bvh: Move the basic bounding volume tree functionality into core.

The basic boundignvolume implementation does only need math and
geometry. As such it is agnostic to the scenegraph being used.
Only the parts building this query structure from terrain
depend on the implementation of the terrain.
So, move this into the simgear core component.
This commit is contained in:
Mathias Froehlich 2012-08-24 21:20:40 +02:00
parent e99064ca18
commit 22878b6f89
39 changed files with 36 additions and 23 deletions

View File

@ -3,6 +3,7 @@ file(WRITE ${PROJECT_BINARY_DIR}/simgear/version.h "#define SIMGEAR_VERSION ${SI
foreach( mylibfolder foreach( mylibfolder
bucket bucket
bvh
debug debug
ephemeris ephemeris
io io

View File

@ -1,8 +1,7 @@
include (SimGearComponent) include (SimGearComponent)
set(HEADERS set(HEADERS
BVHBoundingBoxVisitor.hxx BVHBoundingBoxVisitor.hxx
BVHDebugCollectVisitor.hxx
BVHGroup.hxx BVHGroup.hxx
BVHLineGeometry.hxx BVHLineGeometry.hxx
BVHLineSegmentVisitor.hxx BVHLineSegmentVisitor.hxx
@ -19,9 +18,9 @@ set(HEADERS
BVHSubTreeCollector.hxx BVHSubTreeCollector.hxx
BVHTransform.hxx BVHTransform.hxx
BVHVisitor.hxx BVHVisitor.hxx
) )
set(SOURCES set(SOURCES
BVHGroup.cxx BVHGroup.cxx
BVHLineGeometry.cxx BVHLineGeometry.cxx
BVHLineSegmentVisitor.cxx BVHLineSegmentVisitor.cxx
@ -33,7 +32,19 @@ set(SOURCES
BVHStaticNode.cxx BVHStaticNode.cxx
BVHStaticTriangle.cxx BVHStaticTriangle.cxx
BVHSubTreeCollector.cxx BVHSubTreeCollector.cxx
BVHTransform.cxx BVHTransform.cxx
) )
simgear_scene_component(bvh scene/bvh "${SOURCES}" "${HEADERS}") simgear_component(bvh bvh "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
if (SIMGEAR_SHARED)
set(TEST_LIBS SimGearCore)
else()
set(TEST_LIBS sgbvh sgmath sgstructure sgdebug)
endif()
add_executable(bvhtest bvhtest.cxx)
target_link_libraries(bvhtest ${TEST_LIBS})
add_test(bvhtest ${EXECUTABLE_OUTPUT_PATH}/bvhtest)
endif(ENABLE_TESTS)

View File

@ -3,7 +3,6 @@ include (SimGearComponent)
include_directories(${PROJECT_SOURCE_DIR}) include_directories(${PROJECT_SOURCE_DIR})
foreach( mylibfolder foreach( mylibfolder
bvh
material material
model model
sky sky

View File

@ -32,21 +32,22 @@
#include <osg/StateSet> #include <osg/StateSet>
#include <simgear/math/SGGeometry.hxx> #include <simgear/math/SGGeometry.hxx>
#include <simgear/scene/util/OsgMath.hxx>
#include "BVHVisitor.hxx" #include <simgear/bvh/BVHVisitor.hxx>
#include "BVHNode.hxx" #include <simgear/bvh/BVHNode.hxx>
#include "BVHGroup.hxx" #include <simgear/bvh/BVHGroup.hxx>
#include "BVHTransform.hxx" #include <simgear/bvh/BVHTransform.hxx>
#include "BVHMotionTransform.hxx" #include <simgear/bvh/BVHMotionTransform.hxx>
#include "BVHStaticGeometry.hxx" #include <simgear/bvh/BVHStaticGeometry.hxx>
#include "BVHStaticData.hxx" #include <simgear/bvh/BVHStaticData.hxx>
#include "BVHStaticNode.hxx" #include <simgear/bvh/BVHStaticNode.hxx>
#include "BVHStaticTriangle.hxx" #include <simgear/bvh/BVHStaticTriangle.hxx>
#include "BVHStaticBinary.hxx" #include <simgear/bvh/BVHStaticBinary.hxx>
#include "BVHBoundingBoxVisitor.hxx" #include <simgear/bvh/BVHBoundingBoxVisitor.hxx>
namespace simgear { namespace simgear {

View File

@ -33,7 +33,7 @@
#include <simgear/scene/util/SGSceneUserData.hxx> #include <simgear/scene/util/SGSceneUserData.hxx>
#include <simgear/math/SGGeometry.hxx> #include <simgear/math/SGGeometry.hxx>
#include <simgear/scene/bvh/BVHStaticGeometryBuilder.hxx> #include <simgear/bvh/BVHStaticGeometryBuilder.hxx>
namespace simgear { namespace simgear {

View File

@ -2,6 +2,7 @@ include (SimGearComponent)
set(HEADERS set(HEADERS
BoundingVolumeBuildVisitor.hxx BoundingVolumeBuildVisitor.hxx
BVHDebugCollectVisitor.hxx
CheckSceneryVisitor.hxx CheckSceneryVisitor.hxx
ConditionNode.hxx ConditionNode.hxx
ModelRegistry.hxx ModelRegistry.hxx

View File

@ -26,10 +26,10 @@
#include <osg/NodeVisitor> #include <osg/NodeVisitor>
#include <osg/TemplatePrimitiveFunctor> #include <osg/TemplatePrimitiveFunctor>
#include <simgear/bvh/BVHGroup.hxx>
#include <simgear/bvh/BVHLineGeometry.hxx>
#include <simgear/scene/util/OsgMath.hxx> #include <simgear/scene/util/OsgMath.hxx>
#include <simgear/scene/util/SGSceneUserData.hxx> #include <simgear/scene/util/SGSceneUserData.hxx>
#include <simgear/scene/bvh/BVHGroup.hxx>
#include <simgear/scene/bvh/BVHLineGeometry.hxx>
class SGInteractionAnimation::LineCollector : public osg::NodeVisitor { class SGInteractionAnimation::LineCollector : public osg::NodeVisitor {
struct LinePrimitiveFunctor { struct LinePrimitiveFunctor {

View File

@ -25,7 +25,7 @@
#include <vector> #include <vector>
#include <osg/Node> #include <osg/Node>
#include <osg/Object> #include <osg/Object>
#include <simgear/scene/bvh/BVHNode.hxx> #include <simgear/bvh/BVHNode.hxx>
#include "SGPickCallback.hxx" #include "SGPickCallback.hxx"
class SGSceneUserData : public osg::Object { class SGSceneUserData : public osg::Object {