From 22878b6f897abb5895cd7054f4ea666666fa6778 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Fri, 24 Aug 2012 21:20:40 +0200 Subject: [PATCH] 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. --- simgear/CMakeLists.txt | 1 + simgear/{scene => }/bvh/.gitignore | 0 .../{scene => }/bvh/BVHBoundingBoxVisitor.hxx | 0 simgear/{scene => }/bvh/BVHGroup.cxx | 0 simgear/{scene => }/bvh/BVHGroup.hxx | 0 simgear/{scene => }/bvh/BVHLineGeometry.cxx | 0 simgear/{scene => }/bvh/BVHLineGeometry.hxx | 0 .../{scene => }/bvh/BVHLineSegmentVisitor.cxx | 0 .../{scene => }/bvh/BVHLineSegmentVisitor.hxx | 0 .../{scene => }/bvh/BVHMotionTransform.cxx | 0 .../{scene => }/bvh/BVHMotionTransform.hxx | 0 .../bvh/BVHNearestPointVisitor.hxx | 0 simgear/{scene => }/bvh/BVHNode.cxx | 0 simgear/{scene => }/bvh/BVHNode.hxx | 0 simgear/{scene => }/bvh/BVHStaticBinary.cxx | 0 simgear/{scene => }/bvh/BVHStaticBinary.hxx | 0 simgear/{scene => }/bvh/BVHStaticData.hxx | 0 simgear/{scene => }/bvh/BVHStaticGeometry.cxx | 0 simgear/{scene => }/bvh/BVHStaticGeometry.hxx | 0 .../bvh/BVHStaticGeometryBuilder.hxx | 0 simgear/{scene => }/bvh/BVHStaticLeaf.cxx | 0 simgear/{scene => }/bvh/BVHStaticLeaf.hxx | 0 simgear/{scene => }/bvh/BVHStaticNode.cxx | 0 simgear/{scene => }/bvh/BVHStaticNode.hxx | 0 simgear/{scene => }/bvh/BVHStaticTriangle.cxx | 0 simgear/{scene => }/bvh/BVHStaticTriangle.hxx | 0 .../{scene => }/bvh/BVHSubTreeCollector.cxx | 0 .../{scene => }/bvh/BVHSubTreeCollector.hxx | 0 simgear/{scene => }/bvh/BVHTransform.cxx | 0 simgear/{scene => }/bvh/BVHTransform.hxx | 0 simgear/{scene => }/bvh/BVHVisitor.hxx | 0 simgear/{scene => }/bvh/CMakeLists.txt | 25 +++++++++++++------ simgear/{scene => }/bvh/bvhtest.cxx | 0 simgear/scene/CMakeLists.txt | 1 - .../{bvh => model}/BVHDebugCollectVisitor.hxx | 23 +++++++++-------- .../model/BoundingVolumeBuildVisitor.hxx | 2 +- simgear/scene/model/CMakeLists.txt | 1 + .../scene/model/SGInteractionAnimation.cxx | 4 +-- simgear/scene/util/SGSceneUserData.hxx | 2 +- 39 files changed, 36 insertions(+), 23 deletions(-) rename simgear/{scene => }/bvh/.gitignore (100%) rename simgear/{scene => }/bvh/BVHBoundingBoxVisitor.hxx (100%) rename simgear/{scene => }/bvh/BVHGroup.cxx (100%) rename simgear/{scene => }/bvh/BVHGroup.hxx (100%) rename simgear/{scene => }/bvh/BVHLineGeometry.cxx (100%) rename simgear/{scene => }/bvh/BVHLineGeometry.hxx (100%) rename simgear/{scene => }/bvh/BVHLineSegmentVisitor.cxx (100%) rename simgear/{scene => }/bvh/BVHLineSegmentVisitor.hxx (100%) rename simgear/{scene => }/bvh/BVHMotionTransform.cxx (100%) rename simgear/{scene => }/bvh/BVHMotionTransform.hxx (100%) rename simgear/{scene => }/bvh/BVHNearestPointVisitor.hxx (100%) rename simgear/{scene => }/bvh/BVHNode.cxx (100%) rename simgear/{scene => }/bvh/BVHNode.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticBinary.cxx (100%) rename simgear/{scene => }/bvh/BVHStaticBinary.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticData.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticGeometry.cxx (100%) rename simgear/{scene => }/bvh/BVHStaticGeometry.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticGeometryBuilder.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticLeaf.cxx (100%) rename simgear/{scene => }/bvh/BVHStaticLeaf.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticNode.cxx (100%) rename simgear/{scene => }/bvh/BVHStaticNode.hxx (100%) rename simgear/{scene => }/bvh/BVHStaticTriangle.cxx (100%) rename simgear/{scene => }/bvh/BVHStaticTriangle.hxx (100%) rename simgear/{scene => }/bvh/BVHSubTreeCollector.cxx (100%) rename simgear/{scene => }/bvh/BVHSubTreeCollector.hxx (100%) rename simgear/{scene => }/bvh/BVHTransform.cxx (100%) rename simgear/{scene => }/bvh/BVHTransform.hxx (100%) rename simgear/{scene => }/bvh/BVHVisitor.hxx (100%) rename simgear/{scene => }/bvh/CMakeLists.txt (63%) rename simgear/{scene => }/bvh/bvhtest.cxx (100%) rename simgear/scene/{bvh => model}/BVHDebugCollectVisitor.hxx (92%) diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 1ab291e3..a613805f 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -3,6 +3,7 @@ file(WRITE ${PROJECT_BINARY_DIR}/simgear/version.h "#define SIMGEAR_VERSION ${SI foreach( mylibfolder bucket + bvh debug ephemeris io diff --git a/simgear/scene/bvh/.gitignore b/simgear/bvh/.gitignore similarity index 100% rename from simgear/scene/bvh/.gitignore rename to simgear/bvh/.gitignore diff --git a/simgear/scene/bvh/BVHBoundingBoxVisitor.hxx b/simgear/bvh/BVHBoundingBoxVisitor.hxx similarity index 100% rename from simgear/scene/bvh/BVHBoundingBoxVisitor.hxx rename to simgear/bvh/BVHBoundingBoxVisitor.hxx diff --git a/simgear/scene/bvh/BVHGroup.cxx b/simgear/bvh/BVHGroup.cxx similarity index 100% rename from simgear/scene/bvh/BVHGroup.cxx rename to simgear/bvh/BVHGroup.cxx diff --git a/simgear/scene/bvh/BVHGroup.hxx b/simgear/bvh/BVHGroup.hxx similarity index 100% rename from simgear/scene/bvh/BVHGroup.hxx rename to simgear/bvh/BVHGroup.hxx diff --git a/simgear/scene/bvh/BVHLineGeometry.cxx b/simgear/bvh/BVHLineGeometry.cxx similarity index 100% rename from simgear/scene/bvh/BVHLineGeometry.cxx rename to simgear/bvh/BVHLineGeometry.cxx diff --git a/simgear/scene/bvh/BVHLineGeometry.hxx b/simgear/bvh/BVHLineGeometry.hxx similarity index 100% rename from simgear/scene/bvh/BVHLineGeometry.hxx rename to simgear/bvh/BVHLineGeometry.hxx diff --git a/simgear/scene/bvh/BVHLineSegmentVisitor.cxx b/simgear/bvh/BVHLineSegmentVisitor.cxx similarity index 100% rename from simgear/scene/bvh/BVHLineSegmentVisitor.cxx rename to simgear/bvh/BVHLineSegmentVisitor.cxx diff --git a/simgear/scene/bvh/BVHLineSegmentVisitor.hxx b/simgear/bvh/BVHLineSegmentVisitor.hxx similarity index 100% rename from simgear/scene/bvh/BVHLineSegmentVisitor.hxx rename to simgear/bvh/BVHLineSegmentVisitor.hxx diff --git a/simgear/scene/bvh/BVHMotionTransform.cxx b/simgear/bvh/BVHMotionTransform.cxx similarity index 100% rename from simgear/scene/bvh/BVHMotionTransform.cxx rename to simgear/bvh/BVHMotionTransform.cxx diff --git a/simgear/scene/bvh/BVHMotionTransform.hxx b/simgear/bvh/BVHMotionTransform.hxx similarity index 100% rename from simgear/scene/bvh/BVHMotionTransform.hxx rename to simgear/bvh/BVHMotionTransform.hxx diff --git a/simgear/scene/bvh/BVHNearestPointVisitor.hxx b/simgear/bvh/BVHNearestPointVisitor.hxx similarity index 100% rename from simgear/scene/bvh/BVHNearestPointVisitor.hxx rename to simgear/bvh/BVHNearestPointVisitor.hxx diff --git a/simgear/scene/bvh/BVHNode.cxx b/simgear/bvh/BVHNode.cxx similarity index 100% rename from simgear/scene/bvh/BVHNode.cxx rename to simgear/bvh/BVHNode.cxx diff --git a/simgear/scene/bvh/BVHNode.hxx b/simgear/bvh/BVHNode.hxx similarity index 100% rename from simgear/scene/bvh/BVHNode.hxx rename to simgear/bvh/BVHNode.hxx diff --git a/simgear/scene/bvh/BVHStaticBinary.cxx b/simgear/bvh/BVHStaticBinary.cxx similarity index 100% rename from simgear/scene/bvh/BVHStaticBinary.cxx rename to simgear/bvh/BVHStaticBinary.cxx diff --git a/simgear/scene/bvh/BVHStaticBinary.hxx b/simgear/bvh/BVHStaticBinary.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticBinary.hxx rename to simgear/bvh/BVHStaticBinary.hxx diff --git a/simgear/scene/bvh/BVHStaticData.hxx b/simgear/bvh/BVHStaticData.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticData.hxx rename to simgear/bvh/BVHStaticData.hxx diff --git a/simgear/scene/bvh/BVHStaticGeometry.cxx b/simgear/bvh/BVHStaticGeometry.cxx similarity index 100% rename from simgear/scene/bvh/BVHStaticGeometry.cxx rename to simgear/bvh/BVHStaticGeometry.cxx diff --git a/simgear/scene/bvh/BVHStaticGeometry.hxx b/simgear/bvh/BVHStaticGeometry.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticGeometry.hxx rename to simgear/bvh/BVHStaticGeometry.hxx diff --git a/simgear/scene/bvh/BVHStaticGeometryBuilder.hxx b/simgear/bvh/BVHStaticGeometryBuilder.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticGeometryBuilder.hxx rename to simgear/bvh/BVHStaticGeometryBuilder.hxx diff --git a/simgear/scene/bvh/BVHStaticLeaf.cxx b/simgear/bvh/BVHStaticLeaf.cxx similarity index 100% rename from simgear/scene/bvh/BVHStaticLeaf.cxx rename to simgear/bvh/BVHStaticLeaf.cxx diff --git a/simgear/scene/bvh/BVHStaticLeaf.hxx b/simgear/bvh/BVHStaticLeaf.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticLeaf.hxx rename to simgear/bvh/BVHStaticLeaf.hxx diff --git a/simgear/scene/bvh/BVHStaticNode.cxx b/simgear/bvh/BVHStaticNode.cxx similarity index 100% rename from simgear/scene/bvh/BVHStaticNode.cxx rename to simgear/bvh/BVHStaticNode.cxx diff --git a/simgear/scene/bvh/BVHStaticNode.hxx b/simgear/bvh/BVHStaticNode.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticNode.hxx rename to simgear/bvh/BVHStaticNode.hxx diff --git a/simgear/scene/bvh/BVHStaticTriangle.cxx b/simgear/bvh/BVHStaticTriangle.cxx similarity index 100% rename from simgear/scene/bvh/BVHStaticTriangle.cxx rename to simgear/bvh/BVHStaticTriangle.cxx diff --git a/simgear/scene/bvh/BVHStaticTriangle.hxx b/simgear/bvh/BVHStaticTriangle.hxx similarity index 100% rename from simgear/scene/bvh/BVHStaticTriangle.hxx rename to simgear/bvh/BVHStaticTriangle.hxx diff --git a/simgear/scene/bvh/BVHSubTreeCollector.cxx b/simgear/bvh/BVHSubTreeCollector.cxx similarity index 100% rename from simgear/scene/bvh/BVHSubTreeCollector.cxx rename to simgear/bvh/BVHSubTreeCollector.cxx diff --git a/simgear/scene/bvh/BVHSubTreeCollector.hxx b/simgear/bvh/BVHSubTreeCollector.hxx similarity index 100% rename from simgear/scene/bvh/BVHSubTreeCollector.hxx rename to simgear/bvh/BVHSubTreeCollector.hxx diff --git a/simgear/scene/bvh/BVHTransform.cxx b/simgear/bvh/BVHTransform.cxx similarity index 100% rename from simgear/scene/bvh/BVHTransform.cxx rename to simgear/bvh/BVHTransform.cxx diff --git a/simgear/scene/bvh/BVHTransform.hxx b/simgear/bvh/BVHTransform.hxx similarity index 100% rename from simgear/scene/bvh/BVHTransform.hxx rename to simgear/bvh/BVHTransform.hxx diff --git a/simgear/scene/bvh/BVHVisitor.hxx b/simgear/bvh/BVHVisitor.hxx similarity index 100% rename from simgear/scene/bvh/BVHVisitor.hxx rename to simgear/bvh/BVHVisitor.hxx diff --git a/simgear/scene/bvh/CMakeLists.txt b/simgear/bvh/CMakeLists.txt similarity index 63% rename from simgear/scene/bvh/CMakeLists.txt rename to simgear/bvh/CMakeLists.txt index 230a6bc6..f1a8340e 100644 --- a/simgear/scene/bvh/CMakeLists.txt +++ b/simgear/bvh/CMakeLists.txt @@ -1,8 +1,7 @@ include (SimGearComponent) -set(HEADERS +set(HEADERS BVHBoundingBoxVisitor.hxx - BVHDebugCollectVisitor.hxx BVHGroup.hxx BVHLineGeometry.hxx BVHLineSegmentVisitor.hxx @@ -19,9 +18,9 @@ set(HEADERS BVHSubTreeCollector.hxx BVHTransform.hxx BVHVisitor.hxx - ) +) -set(SOURCES +set(SOURCES BVHGroup.cxx BVHLineGeometry.cxx BVHLineSegmentVisitor.cxx @@ -33,7 +32,19 @@ set(SOURCES BVHStaticNode.cxx BVHStaticTriangle.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) diff --git a/simgear/scene/bvh/bvhtest.cxx b/simgear/bvh/bvhtest.cxx similarity index 100% rename from simgear/scene/bvh/bvhtest.cxx rename to simgear/bvh/bvhtest.cxx diff --git a/simgear/scene/CMakeLists.txt b/simgear/scene/CMakeLists.txt index 732798b6..73429d55 100644 --- a/simgear/scene/CMakeLists.txt +++ b/simgear/scene/CMakeLists.txt @@ -3,7 +3,6 @@ include (SimGearComponent) include_directories(${PROJECT_SOURCE_DIR}) foreach( mylibfolder - bvh material model sky diff --git a/simgear/scene/bvh/BVHDebugCollectVisitor.hxx b/simgear/scene/model/BVHDebugCollectVisitor.hxx similarity index 92% rename from simgear/scene/bvh/BVHDebugCollectVisitor.hxx rename to simgear/scene/model/BVHDebugCollectVisitor.hxx index ecbe476c..e99779ff 100644 --- a/simgear/scene/bvh/BVHDebugCollectVisitor.hxx +++ b/simgear/scene/model/BVHDebugCollectVisitor.hxx @@ -32,21 +32,22 @@ #include #include +#include -#include "BVHVisitor.hxx" -#include "BVHNode.hxx" -#include "BVHGroup.hxx" -#include "BVHTransform.hxx" -#include "BVHMotionTransform.hxx" -#include "BVHStaticGeometry.hxx" +#include +#include +#include +#include +#include +#include -#include "BVHStaticData.hxx" +#include -#include "BVHStaticNode.hxx" -#include "BVHStaticTriangle.hxx" -#include "BVHStaticBinary.hxx" +#include +#include +#include -#include "BVHBoundingBoxVisitor.hxx" +#include namespace simgear { diff --git a/simgear/scene/model/BoundingVolumeBuildVisitor.hxx b/simgear/scene/model/BoundingVolumeBuildVisitor.hxx index 9155bcec..f544606b 100644 --- a/simgear/scene/model/BoundingVolumeBuildVisitor.hxx +++ b/simgear/scene/model/BoundingVolumeBuildVisitor.hxx @@ -33,7 +33,7 @@ #include #include -#include +#include namespace simgear { diff --git a/simgear/scene/model/CMakeLists.txt b/simgear/scene/model/CMakeLists.txt index 83264bda..8f2760e0 100644 --- a/simgear/scene/model/CMakeLists.txt +++ b/simgear/scene/model/CMakeLists.txt @@ -2,6 +2,7 @@ include (SimGearComponent) set(HEADERS BoundingVolumeBuildVisitor.hxx + BVHDebugCollectVisitor.hxx CheckSceneryVisitor.hxx ConditionNode.hxx ModelRegistry.hxx diff --git a/simgear/scene/model/SGInteractionAnimation.cxx b/simgear/scene/model/SGInteractionAnimation.cxx index 171f4939..e6af9862 100644 --- a/simgear/scene/model/SGInteractionAnimation.cxx +++ b/simgear/scene/model/SGInteractionAnimation.cxx @@ -26,10 +26,10 @@ #include #include +#include +#include #include #include -#include -#include class SGInteractionAnimation::LineCollector : public osg::NodeVisitor { struct LinePrimitiveFunctor { diff --git a/simgear/scene/util/SGSceneUserData.hxx b/simgear/scene/util/SGSceneUserData.hxx index d0c69d03..c2a08352 100644 --- a/simgear/scene/util/SGSceneUserData.hxx +++ b/simgear/scene/util/SGSceneUserData.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "SGPickCallback.hxx" class SGSceneUserData : public osg::Object {