diff --git a/CMakeLists.txt b/CMakeLists.txt index bce84941..342fd9e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ endif() FIND_PACKAGE(Doxygen) -ADD_SUBDIRECTORY(library) +ADD_SUBDIRECTORY(include) @@ -90,6 +90,7 @@ ENDIF() ADD_SUBDIRECTORY(documentation) +ADD_SUBDIRECTORY(bindings) set_package_properties(Doxygen PROPERTIES URL http://www.doxygen.org DESCRIPTION "API documentation generator" TYPE OPTIONAL PURPOSE "Building the API documentation") set_package_properties(Qt4 PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org) diff --git a/library/bindings/Array.i b/bindings/Array.i similarity index 100% rename from library/bindings/Array.i rename to bindings/Array.i diff --git a/library/bindings/BaseVolume.i b/bindings/BaseVolume.i similarity index 100% rename from library/bindings/BaseVolume.i rename to bindings/BaseVolume.i diff --git a/library/bindings/Block.i b/bindings/Block.i similarity index 100% rename from library/bindings/Block.i rename to bindings/Block.i diff --git a/library/bindings/BlockCompressor.i b/bindings/BlockCompressor.i similarity index 100% rename from library/bindings/BlockCompressor.i rename to bindings/BlockCompressor.i diff --git a/library/bindings/CMakeLists.txt b/bindings/CMakeLists.txt similarity index 100% rename from library/bindings/CMakeLists.txt rename to bindings/CMakeLists.txt diff --git a/library/bindings/Chunk.i b/bindings/Chunk.i similarity index 100% rename from library/bindings/Chunk.i rename to bindings/Chunk.i diff --git a/library/bindings/CleanCSharpBindings.bat b/bindings/CleanCSharpBindings.bat similarity index 100% rename from library/bindings/CleanCSharpBindings.bat rename to bindings/CleanCSharpBindings.bat diff --git a/library/bindings/CompressedBlock.i b/bindings/CompressedBlock.i similarity index 100% rename from library/bindings/CompressedBlock.i rename to bindings/CompressedBlock.i diff --git a/library/bindings/CubicSurfaceExtractor.i b/bindings/CubicSurfaceExtractor.i similarity index 100% rename from library/bindings/CubicSurfaceExtractor.i rename to bindings/CubicSurfaceExtractor.i diff --git a/library/bindings/CubicSurfaceExtractorWithNormals.i b/bindings/CubicSurfaceExtractorWithNormals.i similarity index 100% rename from library/bindings/CubicSurfaceExtractorWithNormals.i rename to bindings/CubicSurfaceExtractorWithNormals.i diff --git a/library/bindings/DefaultMarchingCubesController.i b/bindings/DefaultMarchingCubesController.i similarity index 100% rename from library/bindings/DefaultMarchingCubesController.i rename to bindings/DefaultMarchingCubesController.i diff --git a/library/bindings/FilePager.i b/bindings/FilePager.i similarity index 100% rename from library/bindings/FilePager.i rename to bindings/FilePager.i diff --git a/library/bindings/LargeVolume.i b/bindings/LargeVolume.i similarity index 100% rename from library/bindings/LargeVolume.i rename to bindings/LargeVolume.i diff --git a/library/bindings/MakeCSharpBindings.bat b/bindings/MakeCSharpBindings.bat similarity index 100% rename from library/bindings/MakeCSharpBindings.bat rename to bindings/MakeCSharpBindings.bat diff --git a/library/bindings/MarchingCubesSurfaceExtractor.i b/bindings/MarchingCubesSurfaceExtractor.i similarity index 100% rename from library/bindings/MarchingCubesSurfaceExtractor.i rename to bindings/MarchingCubesSurfaceExtractor.i diff --git a/library/bindings/MeshDecimator.i b/bindings/MeshDecimator.i similarity index 100% rename from library/bindings/MeshDecimator.i rename to bindings/MeshDecimator.i diff --git a/library/bindings/MinizBlockCompressor.i b/bindings/MinizBlockCompressor.i similarity index 100% rename from library/bindings/MinizBlockCompressor.i rename to bindings/MinizBlockCompressor.i diff --git a/library/bindings/PagedVolume.i b/bindings/PagedVolume.i similarity index 100% rename from library/bindings/PagedVolume.i rename to bindings/PagedVolume.i diff --git a/library/bindings/Pager.i b/bindings/Pager.i similarity index 100% rename from library/bindings/Pager.i rename to bindings/Pager.i diff --git a/library/bindings/Picking.i b/bindings/Picking.i similarity index 100% rename from library/bindings/Picking.i rename to bindings/Picking.i diff --git a/library/bindings/PolyVoxCore.i b/bindings/PolyVoxCore.i similarity index 100% rename from library/bindings/PolyVoxCore.i rename to bindings/PolyVoxCore.i diff --git a/library/bindings/RLEBlockCompressor.i b/bindings/RLEBlockCompressor.i similarity index 100% rename from library/bindings/RLEBlockCompressor.i rename to bindings/RLEBlockCompressor.i diff --git a/library/bindings/RawVolume.i b/bindings/RawVolume.i similarity index 100% rename from library/bindings/RawVolume.i rename to bindings/RawVolume.i diff --git a/library/bindings/Raycast.i b/bindings/Raycast.i similarity index 100% rename from library/bindings/Raycast.i rename to bindings/Raycast.i diff --git a/library/bindings/Region.i b/bindings/Region.i similarity index 100% rename from library/bindings/Region.i rename to bindings/Region.i diff --git a/library/bindings/SimpleVolume.i b/bindings/SimpleVolume.i similarity index 100% rename from library/bindings/SimpleVolume.i rename to bindings/SimpleVolume.i diff --git a/library/bindings/SimpleVolumeSampler.i b/bindings/SimpleVolumeSampler.i similarity index 100% rename from library/bindings/SimpleVolumeSampler.i rename to bindings/SimpleVolumeSampler.i diff --git a/library/bindings/SubArray.i b/bindings/SubArray.i similarity index 100% rename from library/bindings/SubArray.i rename to bindings/SubArray.i diff --git a/library/bindings/SurfaceMesh.i b/bindings/SurfaceMesh.i similarity index 100% rename from library/bindings/SurfaceMesh.i rename to bindings/SurfaceMesh.i diff --git a/library/bindings/TypeDef.i b/bindings/TypeDef.i similarity index 100% rename from library/bindings/TypeDef.i rename to bindings/TypeDef.i diff --git a/library/bindings/UncompressedBlock.i b/bindings/UncompressedBlock.i similarity index 100% rename from library/bindings/UncompressedBlock.i rename to bindings/UncompressedBlock.i diff --git a/library/bindings/Vector.i b/bindings/Vector.i similarity index 100% rename from library/bindings/Vector.i rename to bindings/Vector.i diff --git a/library/bindings/VertexTypes.i b/bindings/VertexTypes.i similarity index 100% rename from library/bindings/VertexTypes.i rename to bindings/VertexTypes.i diff --git a/examples/Basic/CMakeLists.txt b/examples/Basic/CMakeLists.txt index 66546f66..43cd16b7 100644 --- a/examples/Basic/CMakeLists.txt +++ b/examples/Basic/CMakeLists.txt @@ -39,8 +39,7 @@ add_definitions(-DGLEW_STATIC) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${GLEW_SOURCE_DIR}) -LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR}) #This will include the shader files inside the compiled binary QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc) @@ -53,7 +52,7 @@ ADD_EXECUTABLE(BasicExample ${SRC_FILES} ${COMMON_RESOURCES_RCC}) IF(MSVC) SET_TARGET_PROPERTIES(BasicExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") ENDIF(MSVC) -TARGET_LINK_LIBRARIES(BasicExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} PolyVoxCore) +TARGET_LINK_LIBRARIES(BasicExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) SET_PROPERTY(TARGET BasicExample PROPERTY FOLDER "Examples") #Install - Only install the example in Windows @@ -64,11 +63,4 @@ IF(WIN32) ARCHIVE DESTINATION Examples/OpenGL/lib COMPONENT example ) - - #.dlls should be installed in shared builds. - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) ENDIF(WIN32) diff --git a/examples/Basic/main.cpp b/examples/Basic/main.cpp index b2d7bb3d..3fba8964 100644 --- a/examples/Basic/main.cpp +++ b/examples/Basic/main.cpp @@ -23,10 +23,10 @@ freely, subject to the following restrictions: #include "OpenGLWidget.h" -#include "PolyVoxCore/CubicSurfaceExtractor.h" -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h" -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/CubicSurfaceExtractor.h" +#include "PolyVox/MarchingCubesSurfaceExtractor.h" +#include "PolyVox/Mesh.h" +#include "PolyVox/PagedVolume.h" #include diff --git a/examples/DecodeOnGPU/CMakeLists.txt b/examples/DecodeOnGPU/CMakeLists.txt index a812c2b5..071ba223 100644 --- a/examples/DecodeOnGPU/CMakeLists.txt +++ b/examples/DecodeOnGPU/CMakeLists.txt @@ -39,8 +39,7 @@ add_definitions(-DGLEW_STATIC) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${GLEW_SOURCE_DIR}) -LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR}) #This will include the shader files inside the compiled binary QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc) @@ -54,7 +53,7 @@ ADD_EXECUTABLE(DecodeOnGPUExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${DECODE_ IF(MSVC) SET_TARGET_PROPERTIES(DecodeOnGPUExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") ENDIF(MSVC) -TARGET_LINK_LIBRARIES(DecodeOnGPUExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} PolyVoxCore) +TARGET_LINK_LIBRARIES(DecodeOnGPUExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) SET_PROPERTY(TARGET DecodeOnGPUExample PROPERTY FOLDER "Examples") #Install - Only install the example in Windows @@ -65,11 +64,4 @@ IF(WIN32) ARCHIVE DESTINATION Examples/OpenGL/lib COMPONENT example ) - - #.dlls should be installed in shared builds. - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) ENDIF(WIN32) diff --git a/examples/DecodeOnGPU/main.cpp b/examples/DecodeOnGPU/main.cpp index a13dd677..52091119 100644 --- a/examples/DecodeOnGPU/main.cpp +++ b/examples/DecodeOnGPU/main.cpp @@ -23,10 +23,10 @@ freely, subject to the following restrictions: #include "OpenGLWidget.h" -#include "PolyVoxCore/CubicSurfaceExtractor.h" -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h" -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/CubicSurfaceExtractor.h" +#include "PolyVox/MarchingCubesSurfaceExtractor.h" +#include "PolyVox/Mesh.h" +#include "PolyVox/PagedVolume.h" #include diff --git a/examples/OpenGL/CMakeLists.txt b/examples/OpenGL/CMakeLists.txt index 910ea0fb..86770566 100644 --- a/examples/OpenGL/CMakeLists.txt +++ b/examples/OpenGL/CMakeLists.txt @@ -41,8 +41,7 @@ add_definitions(-DGLEW_STATIC) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${GLEW_SOURCE_DIR}) -LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR}) #This will include the shader files inside the compiled binary QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc) @@ -56,7 +55,7 @@ ADD_EXECUTABLE(OpenGLExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${OPENGLEXAMPL IF(MSVC) SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") ENDIF(MSVC) -TARGET_LINK_LIBRARIES(OpenGLExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} PolyVoxCore) +TARGET_LINK_LIBRARIES(OpenGLExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) SET_PROPERTY(TARGET OpenGLExample PROPERTY FOLDER "Examples") #Install - Only install the example in Windows @@ -67,11 +66,4 @@ IF(WIN32) ARCHIVE DESTINATION Examples/OpenGL/lib COMPONENT example ) - - #.dlls should be installed in shared builds. - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) ENDIF(WIN32) diff --git a/examples/OpenGL/Shapes.cpp b/examples/OpenGL/Shapes.cpp index 434ff1ca..1ebe6e58 100644 --- a/examples/OpenGL/Shapes.cpp +++ b/examples/OpenGL/Shapes.cpp @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "Shapes.h" -#include "PolyVoxCore/MaterialDensityPair.h" +#include "PolyVox/MaterialDensityPair.h" using namespace PolyVox; diff --git a/examples/OpenGL/Shapes.h b/examples/OpenGL/Shapes.h index 140fdea3..f2f5b193 100644 --- a/examples/OpenGL/Shapes.h +++ b/examples/OpenGL/Shapes.h @@ -24,8 +24,8 @@ freely, subject to the following restrictions: #ifndef __OpenGLExample_Shapes_H__ #define __OpenGLExample_Shapes_H__ -#include "PolyVoxCore/PagedVolume.h" -#include "PolyVoxCore/MaterialDensityPair.h" +#include "PolyVox/PagedVolume.h" +#include "PolyVox/MaterialDensityPair.h" void createSphereInVolume(PolyVox::LargeVolume& volData, float fRadius, uint8_t uValue); void createCubeInVolume(PolyVox::LargeVolume& volData, PolyVox::Vector3DInt32 lowerCorner, PolyVox::Vector3DInt32 upperCorner, uint8_t uValue); diff --git a/examples/OpenGL/main.cpp b/examples/OpenGL/main.cpp index a76c2800..6e94c5b8 100644 --- a/examples/OpenGL/main.cpp +++ b/examples/OpenGL/main.cpp @@ -21,13 +21,13 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/FilePager.h" -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h" -#include "PolyVoxCore/MaterialDensityPair.h" -#include "PolyVoxCore/LowPassFilter.h" -#include "PolyVoxCore/RawVolume.h" -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/Impl/Utility.h" +#include "PolyVox/FilePager.h" +#include "PolyVox/MarchingCubesSurfaceExtractor.h" +#include "PolyVox/MaterialDensityPair.h" +#include "PolyVox/LowPassFilter.h" +#include "PolyVox/RawVolume.h" +#include "PolyVox/Mesh.h" +#include "PolyVox/Impl/Utility.h" #include "Shapes.h" diff --git a/examples/Paging/CMakeLists.txt b/examples/Paging/CMakeLists.txt index db2f9028..f6a099d5 100644 --- a/examples/Paging/CMakeLists.txt +++ b/examples/Paging/CMakeLists.txt @@ -41,8 +41,7 @@ add_definitions(-DGLEW_STATIC) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${GLEW_SOURCE_DIR}) -LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR}) #This will include the shader files inside the compiled binary QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc) @@ -55,7 +54,7 @@ ADD_EXECUTABLE(PagingExample ${SRC_FILES} ${COMMON_RESOURCES_RCC}) IF(MSVC) SET_TARGET_PROPERTIES(PagingExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") ENDIF(MSVC) -TARGET_LINK_LIBRARIES(PagingExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} PolyVoxCore) +TARGET_LINK_LIBRARIES(PagingExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) SET_PROPERTY(TARGET PagingExample PROPERTY FOLDER "Examples") configure_file(../common/example.vert example.vert COPYONLY) @@ -69,11 +68,4 @@ IF(WIN32) ARCHIVE DESTINATION Examples/OpenGL/lib COMPONENT example ) - - #.dlls should be installed in shared builds. - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) ENDIF(WIN32) diff --git a/examples/Paging/main.cpp b/examples/Paging/main.cpp index 86e52aff..09b325d8 100644 --- a/examples/Paging/main.cpp +++ b/examples/Paging/main.cpp @@ -24,11 +24,11 @@ freely, subject to the following restrictions: #include "OpenGLWidget.h" #include "Perlin.h" -#include "PolyVoxCore/MaterialDensityPair.h" -#include "PolyVoxCore/CubicSurfaceExtractor.h" -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h" -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/MaterialDensityPair.h" +#include "PolyVox/CubicSurfaceExtractor.h" +#include "PolyVox/MarchingCubesSurfaceExtractor.h" +#include "PolyVox/Mesh.h" +#include "PolyVox/PagedVolume.h" #include @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) openGLWidget.show(); PerlinNoisePager* pager = new PerlinNoisePager(); - PagedVolume volData(PolyVox::Region::MaxRegion, pager, 64); + PagedVolume volData(PolyVox::Region::MaxRegion(), pager, 64); volData.setMemoryUsageLimit(8 * 1024 * 1024); // 8Mb //createSphereInVolume(volData, 30); diff --git a/examples/SmoothLOD/CMakeLists.txt b/examples/SmoothLOD/CMakeLists.txt index 15bbd4b9..d4e32582 100644 --- a/examples/SmoothLOD/CMakeLists.txt +++ b/examples/SmoothLOD/CMakeLists.txt @@ -39,8 +39,7 @@ add_definitions(-DGLEW_STATIC) FIND_PACKAGE(OpenGL REQUIRED) #Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include ${GLEW_SOURCE_DIR}) -LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR}) #This will include the shader files inside the compiled binary QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc) @@ -53,7 +52,7 @@ ADD_EXECUTABLE(SmoothLODExample ${SRC_FILES} ${COMMON_RESOURCES_RCC}) IF(MSVC) SET_TARGET_PROPERTIES(SmoothLODExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings ENDIF(MSVC) -TARGET_LINK_LIBRARIES(SmoothLODExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} PolyVoxCore) +TARGET_LINK_LIBRARIES(SmoothLODExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) SET_PROPERTY(TARGET SmoothLODExample PROPERTY FOLDER "Examples") configure_file(../common/example.vert example.vert COPYONLY) @@ -67,11 +66,4 @@ IF(WIN32) ARCHIVE DESTINATION Examples/OpenGL/lib COMPONENT example ) - - #.dlls should be installed in shared builds. - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../release/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Release) - - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxCore.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) - #INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../debug/PolyVoxUtil.dll DESTINATION Examples/OpenGL/bin CONFIGURATIONS Debug) ENDIF(WIN32) diff --git a/examples/SmoothLOD/main.cpp b/examples/SmoothLOD/main.cpp index da90282c..b8c56f08 100644 --- a/examples/SmoothLOD/main.cpp +++ b/examples/SmoothLOD/main.cpp @@ -23,12 +23,12 @@ freely, subject to the following restrictions: #include "OpenGLWidget.h" -#include "PolyVoxCore/Density.h" -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h" -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/RawVolume.h" -#include "PolyVoxCore/PagedVolume.h" -#include "PolyVoxCore/VolumeResampler.h" +#include "PolyVox/Density.h" +#include "PolyVox/MarchingCubesSurfaceExtractor.h" +#include "PolyVox/Mesh.h" +#include "PolyVox/RawVolume.h" +#include "PolyVox/PagedVolume.h" +#include "PolyVox/VolumeResampler.h" #include diff --git a/examples/common/OpenGLWidget.h b/examples/common/OpenGLWidget.h index 4112a2fa..ba8fdedc 100644 --- a/examples/common/OpenGLWidget.h +++ b/examples/common/OpenGLWidget.h @@ -24,7 +24,7 @@ distribution. #ifndef __BasicExample_OpenGLWidget_H__ #define __BasicExample_OpenGLWidget_H__ -#include "PolyVoxCore/Mesh.h" +#include "PolyVox/Mesh.h" #include "glew/glew.h" diff --git a/library/CMakeLists.txt b/include/CMakeLists.txt similarity index 54% rename from library/CMakeLists.txt rename to include/CMakeLists.txt index 79467307..ce37965f 100644 --- a/library/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -22,26 +22,108 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(PolyVox) +PROJECT(PolyVoxHeaders) -add_subdirectory(PolyVoxCore) -add_subdirectory(PolyVoxUtil) -add_subdirectory(bindings) +#Projects headers files +SET(CORE_INC_FILES + PolyVox/AmbientOcclusionCalculator.h + PolyVox/AmbientOcclusionCalculator.inl + PolyVox/Array.h + PolyVox/AStarPathfinder.h + PolyVox/AStarPathfinder.inl + PolyVox/BaseVolume.h + PolyVox/BaseVolume.inl + PolyVox/BaseVolumeSampler.inl + PolyVox/CubicSurfaceExtractor.h + PolyVox/CubicSurfaceExtractor.inl + PolyVox/DefaultIsQuadNeeded.h + PolyVox/DefaultMarchingCubesController.h + PolyVox/Density.h + PolyVox/FilePager.h + PolyVox/GradientEstimators.h + PolyVox/GradientEstimators.inl + PolyVox/Interpolation.h + PolyVox/IteratorController.h + PolyVox/IteratorController.inl + PolyVox/LargeVolume.h + PolyVox/LowPassFilter.h + PolyVox/LowPassFilter.inl + PolyVox/MarchingCubesSurfaceExtractor.h + PolyVox/MarchingCubesSurfaceExtractor.inl + PolyVox/Material.h + PolyVox/MaterialDensityPair.h + PolyVox/Mesh.h + PolyVox/Mesh.inl + PolyVox/PagedVolume.h + PolyVox/PagedVolume.inl + PolyVox/PagedVolumeChunk.inl + PolyVox/PagedVolumeSampler.inl + PolyVox/PolyVoxForwardDeclarations.h + PolyVox/Picking.h + PolyVox/Picking.inl + PolyVox/RawVolume.h + PolyVox/RawVolume.inl + PolyVox/RawVolumeSampler.inl + PolyVox/Raycast.h + PolyVox/Raycast.inl + PolyVox/Region.h + PolyVox/Region.inl + PolyVox/SimpleVolume.h + PolyVox/Vector.h + PolyVox/Vector.inl + PolyVox/Vertex.h + PolyVox/VolumeResampler.h + PolyVox/VolumeResampler.inl + PolyVox/VoxelFilters.h + PolyVox/VoxelFilters.inl +) + +SET(IMPL_INC_FILES + PolyVox/Impl/AStarPathfinderImpl.h + PolyVox/Impl/Config.h + PolyVox/Impl/ErrorHandling.h + PolyVox/Impl/Logging.h + PolyVox/Impl/MarchingCubesTables.h + PolyVox/Impl/RandomUnitVectors.h + PolyVox/Impl/RandomVectors.h + PolyVox/Impl/Timer.h + PolyVox/Impl/TypeDef.h + PolyVox/Impl/Utility.h +) + +#NOTE: The following line should be uncommented when building shared libs. + +#"Sources" and "Headers" are the group names in Visual Studio. +#They may have other uses too... +#SOURCE_GROUP("Source Files" FILES ${CORE_SRC_FILES}) +SOURCE_GROUP("Header Files" FILES ${CORE_INC_FILES}) + +#SOURCE_GROUP("Source Files\\Impl" FILES ${IMPL_SRC_FILES}) +SOURCE_GROUP("Header Files\\Impl" FILES ${IMPL_INC_FILES}) + +#Tell CMake the paths +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include) + +#Core + +#Build +# Although we don't build anything for PolyVox, we still add this custom target (which +# doesn't do anything) so that we can browse the source code from within Visual Studio. +ADD_CUSTOM_TARGET(PolyVoxCore SOURCES ${CORE_INC_FILES}) + +#Install the core header files, including the ones in the Impl subfolder. +INSTALL(DIRECTORY PolyVox/ DESTINATION include/PolyVox COMPONENT development PATTERN "*.git*" EXCLUDE) #Set up install paths e.g. for PolyVoxConfig.cmake if(WIN32) set(CONFIG_FILE_DIR "CMake") set(PolyVoxCore_LIBRARY_INSTALL_DIRS "PolyVoxCore/lib") - set(PolyVoxUtil_LIBRARY_INSTALL_DIRS "PolyVoxUtil/lib") set(PolyVoxCore_INCLUDE_INSTALL_DIRS "PolyVoxCore/include") - set(PolyVoxUtil_INCLUDE_INSTALL_DIRS "PolyVoxUtil/include") set(PolyVox_DOC_INSTALL_DIR "PolyVox/doc") else(WIN32) set(CONFIG_FILE_DIR "share/PolyVox/cmake") set(PolyVoxCore_LIBRARY_INSTALL_DIRS "lib") - set(PolyVoxUtil_LIBRARY_INSTALL_DIRS "lib") set(PolyVoxCore_INCLUDE_INSTALL_DIRS "include/PolyVoxCore") - set(PolyVoxUtil_INCLUDE_INSTALL_DIRS "include/PolyVoxUtil") set(PolyVox_DOC_INSTALL_DIR "share/doc/packages/polyvox") endif(WIN32) diff --git a/library/Doxyfile.in b/include/Doxyfile.in similarity index 100% rename from library/Doxyfile.in rename to include/Doxyfile.in diff --git a/library/Mainpage.dox b/include/Mainpage.dox similarity index 100% rename from library/Mainpage.dox rename to include/Mainpage.dox diff --git a/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.h b/include/PolyVox/AStarPathfinder.h similarity index 89% rename from library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.h rename to include/PolyVox/AStarPathfinder.h index dce2aaf7..d453cff3 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.h +++ b/include/PolyVox/AStarPathfinder.h @@ -37,9 +37,43 @@ namespace PolyVox const float sqrt_2 = 1.4143f; const float sqrt_3 = 1.7321f; - extern const POLYVOX_API Vector3DInt32 arrayPathfinderFaces[6]; - extern const POLYVOX_API Vector3DInt32 arrayPathfinderEdges[12]; - extern const POLYVOX_API Vector3DInt32 arrayPathfinderCorners[8]; + const Vector3DInt32 arrayPathfinderFaces[6] = + { + Vector3DInt32(0, 0, -1), + Vector3DInt32(0, 0, +1), + Vector3DInt32(0, -1, 0), + Vector3DInt32(0, +1, 0), + Vector3DInt32(-1, 0, 0), + Vector3DInt32(+1, 0, 0) + }; + + const Vector3DInt32 arrayPathfinderEdges[12] = + { + Vector3DInt32(0, -1, -1), + Vector3DInt32(0, -1, +1), + Vector3DInt32(0, +1, -1), + Vector3DInt32(0, +1, +1), + Vector3DInt32(-1, 0, -1), + Vector3DInt32(-1, 0, +1), + Vector3DInt32(+1, 0, -1), + Vector3DInt32(+1, 0, +1), + Vector3DInt32(-1, -1, 0), + Vector3DInt32(-1, +1, 0), + Vector3DInt32(+1, -1, 0), + Vector3DInt32(+1, +1, 0) + }; + + const Vector3DInt32 arrayPathfinderCorners[8] = + { + Vector3DInt32(-1, -1, -1), + Vector3DInt32(-1, -1, +1), + Vector3DInt32(-1, +1, -1), + Vector3DInt32(-1, +1, +1), + Vector3DInt32(+1, -1, -1), + Vector3DInt32(+1, -1, +1), + Vector3DInt32(+1, +1, -1), + Vector3DInt32(+1, +1, +1) + }; /// This function provides the default method for checking whether a given voxel /// is valid for the path computed by the AStarPathfinder. @@ -190,6 +224,6 @@ namespace PolyVox }; } -#include "PolyVoxCore/AStarPathfinder.inl" +#include "PolyVox/AStarPathfinder.inl" #endif //__PolyVox_AStarPathfinder_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl b/include/PolyVox/AStarPathfinder.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl rename to include/PolyVox/AStarPathfinder.inl index e0c570bd..42f1cf35 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/AStarPathfinder.inl +++ b/include/PolyVox/AStarPathfinder.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/ErrorHandling.h" +#include "PolyVox/Impl/ErrorHandling.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h b/include/PolyVox/AmbientOcclusionCalculator.h similarity index 92% rename from library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h rename to include/PolyVox/AmbientOcclusionCalculator.h index b9ca636a..2560127d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.h +++ b/include/PolyVox/AmbientOcclusionCalculator.h @@ -27,13 +27,13 @@ freely, subject to the following restrictions: #include "Impl/RandomUnitVectors.h" #include "Impl/RandomVectors.h" -#include "PolyVoxCore/Array.h" -#include "PolyVoxCore/Region.h" -#include "PolyVoxCore/Raycast.h" +#include "PolyVox/Array.h" +#include "PolyVox/Region.h" +#include "PolyVox/Raycast.h" //These two should not be here! -#include "PolyVoxCore/Material.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/Material.h" +#include "PolyVox/PagedVolume.h" #include @@ -77,6 +77,6 @@ namespace PolyVox void calculateAmbientOcclusion(VolumeType* volInput, Array<3, uint8_t>* arrayResult, Region region, float fRayLength, uint8_t uNoOfSamplesPerOutputElement, IsVoxelTransparentCallback isVoxelTransparentCallback); } -#include "PolyVoxCore/AmbientOcclusionCalculator.inl" +#include "PolyVox/AmbientOcclusionCalculator.inl" #endif //__AmbientOcclusionCalculator_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.inl b/include/PolyVox/AmbientOcclusionCalculator.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/AmbientOcclusionCalculator.inl rename to include/PolyVox/AmbientOcclusionCalculator.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/Array.h b/include/PolyVox/Array.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/Array.h rename to include/PolyVox/Array.h index aa03f604..68f54db5 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Array.h +++ b/include/PolyVox/Array.h @@ -24,7 +24,7 @@ distribution. #ifndef __PolyVox_Array_H__ #define __PolyVox_Array_H__ -#include +#include #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h b/include/PolyVox/BaseVolume.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h rename to include/PolyVox/BaseVolume.h index 6947188f..57898ffb 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.h +++ b/include/PolyVox/BaseVolume.h @@ -24,8 +24,8 @@ freely, subject to the following restrictions: #ifndef __PolyVox_BaseVolume_H__ #define __PolyVox_BaseVolume_H__ -#include "PolyVoxCore/Region.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Region.h" +#include "PolyVox/Vector.h" #include @@ -211,7 +211,7 @@ namespace PolyVox }; } -#include "PolyVoxCore/BaseVolume.inl" -#include "PolyVoxCore/BaseVolumeSampler.inl" +#include "PolyVox/BaseVolume.inl" +#include "PolyVox/BaseVolumeSampler.inl" #endif //__PolyVox_BaseVolume_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolume.inl b/include/PolyVox/BaseVolume.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/BaseVolume.inl rename to include/PolyVox/BaseVolume.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl b/include/PolyVox/BaseVolumeSampler.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl rename to include/PolyVox/BaseVolumeSampler.inl index 0084f0db..993113a3 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/BaseVolumeSampler.inl +++ b/include/PolyVox/BaseVolumeSampler.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/Utility.h" +#include "PolyVox/Impl/Utility.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h b/include/PolyVox/CubicSurfaceExtractor.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h rename to include/PolyVox/CubicSurfaceExtractor.h index 6ea600e9..b0855061 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h +++ b/include/PolyVox/CubicSurfaceExtractor.h @@ -28,11 +28,11 @@ freely, subject to the following restrictions: #include "PolyVoxForwardDeclarations.h" -#include "PolyVoxCore/Array.h" -#include "PolyVoxCore/BaseVolume.h" //For wrap modes... should move these? -#include "PolyVoxCore/DefaultIsQuadNeeded.h" -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/Vertex.h" +#include "PolyVox/Array.h" +#include "PolyVox/BaseVolume.h" //For wrap modes... should move these? +#include "PolyVox/DefaultIsQuadNeeded.h" +#include "PolyVox/Mesh.h" +#include "PolyVox/Vertex.h" namespace PolyVox { @@ -223,6 +223,6 @@ namespace PolyVox } } -#include "PolyVoxCore/CubicSurfaceExtractor.inl" +#include "PolyVox/CubicSurfaceExtractor.inl" #endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl b/include/PolyVox/CubicSurfaceExtractor.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl rename to include/PolyVox/CubicSurfaceExtractor.inl index 429140e9..6eefe3ec 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl +++ b/include/PolyVox/CubicSurfaceExtractor.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/Timer.h" +#include "PolyVox/Impl/Timer.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h b/include/PolyVox/DefaultIsQuadNeeded.h similarity index 94% rename from library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h rename to include/PolyVox/DefaultIsQuadNeeded.h index ef15444e..5c25c8c1 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h +++ b/include/PolyVox/DefaultIsQuadNeeded.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_DefaultIsQuadNeeded_H__ #define __PolyVox_DefaultIsQuadNeeded_H__ -#include "PolyVoxCore/Impl/TypeDef.h" +#include "PolyVox/Impl/TypeDef.h" #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h b/include/PolyVox/DefaultMarchingCubesController.h similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h rename to include/PolyVox/DefaultMarchingCubesController.h index 2d1b6144..5e99f3ae 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DefaultMarchingCubesController.h +++ b/include/PolyVox/DefaultMarchingCubesController.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_MarchingCubesController_H__ #define __PolyVox_MarchingCubesController_H__ -#include "PolyVoxCore/BaseVolume.h" +#include "PolyVox/BaseVolume.h" #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/Density.h b/include/PolyVox/Density.h similarity index 97% rename from library/PolyVoxCore/include/PolyVoxCore/Density.h rename to include/PolyVox/Density.h index 1cb18065..22b24f85 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Density.h +++ b/include/PolyVox/Density.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Density_H__ #define __PolyVox_Density_H__ -#include "PolyVoxCore/DefaultMarchingCubesController.h" //We'll specialise the controller contained in here +#include "PolyVox/DefaultMarchingCubesController.h" //We'll specialise the controller contained in here #include "Impl/TypeDef.h" diff --git a/library/PolyVoxCore/include/PolyVoxCore/FilePager.h b/include/PolyVox/FilePager.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/FilePager.h rename to include/PolyVox/FilePager.h index ed3b7a9a..19c8ca62 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/FilePager.h +++ b/include/PolyVox/FilePager.h @@ -24,10 +24,10 @@ freely, subject to the following restrictions: #ifndef __PolyVox_FilePager_H__ #define __PolyVox_FilePager_H__ -#include "PolyVoxCore/Impl/TypeDef.h" +#include "PolyVox/Impl/TypeDef.h" -#include "PolyVoxCore/PagedVolume.h" -#include "PolyVoxCore/Region.h" +#include "PolyVox/PagedVolume.h" +#include "PolyVox/Region.h" #include #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.h b/include/PolyVox/GradientEstimators.h similarity index 95% rename from library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.h rename to include/PolyVox/GradientEstimators.h index 02b1eb0c..30ea14ab 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.h +++ b/include/PolyVox/GradientEstimators.h @@ -24,8 +24,8 @@ freely, subject to the following restrictions: #ifndef __PolyVox_GradientEstimators_H__ #define __PolyVox_GradientEstimators_H__ -#include "PolyVoxCore/Vector.h" -#include "PolyVoxCore/VoxelFilters.h" +#include "PolyVox/Vector.h" +#include "PolyVox/VoxelFilters.h" #include @@ -59,6 +59,6 @@ namespace PolyVox //POLYVOX_API Vector3DFloat computeNormal(VolumeType* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod); } -#include "PolyVoxCore/GradientEstimators.inl" +#include "PolyVox/GradientEstimators.inl" #endif //__PolyVox_GradientEstimators_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.inl b/include/PolyVox/GradientEstimators.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/GradientEstimators.inl rename to include/PolyVox/GradientEstimators.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/AStarPathfinderImpl.h b/include/PolyVox/Impl/AStarPathfinderImpl.h similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/Impl/AStarPathfinderImpl.h rename to include/PolyVox/Impl/AStarPathfinderImpl.h index f37bbfa8..37165eb9 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/AStarPathfinderImpl.h +++ b/include/PolyVox/Impl/AStarPathfinderImpl.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_AStarPathfinderImpl_H__ #define __PolyVox_AStarPathfinderImpl_H__ -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Vector.h" #include #include //For numeric_limits diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Config.h b/include/PolyVox/Impl/Config.h similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/Impl/Config.h rename to include/PolyVox/Impl/Config.h diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h b/include/PolyVox/Impl/ErrorHandling.h similarity index 81% rename from library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h rename to include/PolyVox/Impl/ErrorHandling.h index be7515a6..bab86143 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/ErrorHandling.h +++ b/include/PolyVox/Impl/ErrorHandling.h @@ -24,9 +24,9 @@ freely, subject to the following restrictions: #ifndef __PolyVox_ErrorHandling_H__ #define __PolyVox_ErrorHandling_H__ -#include "PolyVoxCore/Impl/Config.h" +#include "PolyVox/Impl/Config.h" -#include "PolyVoxCore/Impl/Logging.h" +#include "PolyVox/Impl/Logging.h" #include // For std::exit #include // For std::cerr @@ -155,8 +155,49 @@ freely, subject to the following restrictions: { typedef void (*ThrowHandler)(std::exception& e, const char* file, int line); - ThrowHandler getThrowHandler(); - void setThrowHandler(ThrowHandler newHandler); + inline void defaultThrowHandler(std::exception& e, const char* file, int line) + { + std::stringstream ss; \ + ss << "\n"; \ + ss << " PolyVox exception thrown!"; \ + ss << " ========================="; \ + ss << " PolyVox has tried to throw an exception but it was built without support"; \ + ss << " for exceptions. In this scenario PolyVox will call a 'throw handler'"; \ + ss << " and this message is being printed by the default throw handler."; \ + ss << "\n"; \ + ss << " If you don't want to enable exceptions then you should try to determine why"; \ + ss << " this exception was thrown and make sure it doesn't happen again. If it was"; \ + ss << " due to something like an invalid argument to a function then you should be"; \ + ss << " able to fix it quite easily by validating parameters as appropriate. More"; \ + ss << " complex exception scenarios (out of memory, etc) might be harder to fix and"; \ + ss << " you should replace this default handler with something which is more"; \ + ss << " meaningful to your users."; \ + ss << "\n"; \ + ss << " Exception details"; \ + ss << " -----------------"; \ + ss << " Line: " << line; \ + ss << " File: " << file; \ + ss << " Message: " << e.what(); \ + ss << "\n"; \ + PolyVox::Impl::getLoggerInstance()->logFatalMessage(ss.str()); \ + POLYVOX_HALT(); \ + } + + inline ThrowHandler& getThrowHandlerInstance() + { + static ThrowHandler s_fThrowHandler = &defaultThrowHandler; + return s_fThrowHandler; + } + + inline ThrowHandler getThrowHandler() + { + return getThrowHandlerInstance(); + } + + inline void setThrowHandler(ThrowHandler fNewHandler) + { + getThrowHandlerInstance() = fNewHandler; + } } #define POLYVOX_THROW_IF(condition, type, message) \ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Logging.h b/include/PolyVox/Impl/Logging.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/Impl/Logging.h rename to include/PolyVox/Impl/Logging.h index e86537c6..ca8cb3cb 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Logging.h +++ b/include/PolyVox/Impl/Logging.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Logging_H__ #define __PolyVox_Logging_H__ -#include "PolyVoxCore/Impl/Config.h" +#include "PolyVox/Impl/Config.h" #include #include @@ -70,10 +70,17 @@ namespace PolyVox namespace Impl { - Logger*& getLoggerInstance(); + inline Logger*& getLoggerInstance() + { + static Logger* s_pLogger = new DefaultLogger; + return s_pLogger; + } } - void setLogger(Logger* pLogger); + inline void setLogger(Logger* pLogger) + { + Impl::getLoggerInstance() = pLogger; + } } #ifdef POLYVOX_LOG_TRACE_ENABLED diff --git a/include/PolyVox/Impl/MarchingCubesTables.h b/include/PolyVox/Impl/MarchingCubesTables.h new file mode 100644 index 00000000..793208d3 --- /dev/null +++ b/include/PolyVox/Impl/MarchingCubesTables.h @@ -0,0 +1,335 @@ +/******************************************************************************* +Copyright (c) 2005-2009 David Williams + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. +*******************************************************************************/ + +#ifndef __PolyVox_MarchingCubeTables_H__ +#define __PolyVox_MarchingCubeTables_H__ + +#include "PolyVox/Impl/TypeDef.h" + +#include + +namespace PolyVox +{ + //These tables were based on the article "Polygonising a scalar field". + //They have been optimised to allow a more efficient algorithm via bitwise operations. + + // http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/index.html + + const uint16_t edgeTable[256] = + { + 0x000, 0x109, 0x203, 0x30a, 0x80c, 0x905, 0xa0f, 0xb06, + 0x406, 0x50f, 0x605, 0x70c, 0xc0a, 0xd03, 0xe09, 0xf00, + 0x190, 0x099, 0x393, 0x29a, 0x99c, 0x895, 0xb9f, 0xa96, + 0x596, 0x49f, 0x795, 0x69c, 0xd9a, 0xc93, 0xf99, 0xe90, + 0x230, 0x339, 0x033, 0x13a, 0xa3c, 0xb35, 0x83f, 0x936, + 0x636, 0x73f, 0x435, 0x53c, 0xe3a, 0xf33, 0xc39, 0xd30, + 0x3a0, 0x2a9, 0x1a3, 0x0aa, 0xbac, 0xaa5, 0x9af, 0x8a6, + 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xfaa, 0xea3, 0xda9, 0xca0, + 0x8c0, 0x9c9, 0xac3, 0xbca, 0x0cc, 0x1c5, 0x2cf, 0x3c6, + 0xcc6, 0xdcf, 0xec5, 0xfcc, 0x4ca, 0x5c3, 0x6c9, 0x7c0, + 0x950, 0x859, 0xb53, 0xa5a, 0x15c, 0x055, 0x35f, 0x256, + 0xd56, 0xc5f, 0xf55, 0xe5c, 0x55a, 0x453, 0x759, 0x650, + 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0x2fc, 0x3f5, 0x0ff, 0x1f6, + 0xef6, 0xfff, 0xcf5, 0xdfc, 0x6fa, 0x7f3, 0x4f9, 0x5f0, + 0xb60, 0xa69, 0x963, 0x86a, 0x36c, 0x265, 0x16f, 0x066, + 0xf66, 0xe6f, 0xd65, 0xc6c, 0x76a, 0x663, 0x569, 0x460, + 0x460, 0x569, 0x663, 0x76a, 0xc6c, 0xd65, 0xe6f, 0xf66, + 0x066, 0x16f, 0x265, 0x36c, 0x86a, 0x963, 0xa69, 0xb60, + 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0xdfc, 0xcf5, 0xfff, 0xef6, + 0x1f6, 0x0ff, 0x3f5, 0x2fc, 0x9fa, 0x8f3, 0xbf9, 0xaf0, + 0x650, 0x759, 0x453, 0x55a, 0xe5c, 0xf55, 0xc5f, 0xd56, + 0x256, 0x35f, 0x055, 0x15c, 0xa5a, 0xb53, 0x859, 0x950, + 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0xfcc, 0xec5, 0xdcf, 0xcc6, + 0x3c6, 0x2cf, 0x1c5, 0x0cc, 0xbca, 0xac3, 0x9c9, 0x8c0, + 0xca0, 0xda9, 0xea3, 0xfaa, 0x4ac, 0x5a5, 0x6af, 0x7a6, + 0x8a6, 0x9af, 0xaa5, 0xbac, 0x0aa, 0x1a3, 0x2a9, 0x3a0, + 0xd30, 0xc39, 0xf33, 0xe3a, 0x53c, 0x435, 0x73f, 0x636, + 0x936, 0x83f, 0xb35, 0xa3c, 0x13a, 0x033, 0x339, 0x230, + 0xe90, 0xf99, 0xc93, 0xd9a, 0x69c, 0x795, 0x49f, 0x596, + 0xa96, 0xb9f, 0x895, 0x99c, 0x29a, 0x393, 0x099, 0x190, + 0xf00, 0xe09, 0xd03, 0xc0a, 0x70c, 0x605, 0x50f, 0x406, + 0xb06, 0xa0f, 0x905, 0x80c, 0x30a, 0x203, 0x109, 0x000 + }; + + const int8_t triTable[256][16] = + { + { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, }, + { 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, }, + { 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, }, + { 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, }, + { 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, }, + { 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, }, + { 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, }, + { 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, }, + { 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, }, + { 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, }, + { 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, }, + { 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, }, + { 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, }, + { 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, }, + { 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, }, + { 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, }, + { 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, }, + { 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, }, + { 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, }, + { 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, }, + { 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, }, + { 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, }, + { 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, }, + { 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, }, + { 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, }, + { 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, }, + { 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, }, + { 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, }, + { 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, }, + { 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, }, + { 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, }, + { 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, }, + { 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, }, + { 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, }, + { 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, }, + { 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, }, + { 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, }, + { 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, }, + { 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, }, + { 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, }, + { 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, }, + { 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, }, + { 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, }, + { 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, }, + { 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, }, + { 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, }, + { 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, }, + { 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, }, + { 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, }, + { 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, }, + { 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, }, + { 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, }, + { 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, }, + { 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, }, + { 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, }, + { 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, }, + { 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, }, + { 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, }, + { 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, }, + { 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, }, + { 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, }, + { 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, }, + { 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, }, + { 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, }, + { 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, }, + { 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, }, + { 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, }, + { 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, }, + { 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, }, + { 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, }, + { 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, }, + { 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, }, + { 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, }, + { 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, }, + { 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, }, + { 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, }, + { 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, }, + { 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, }, + { 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, }, + { 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, }, + { 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, }, + { 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, }, + { 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, }, + { 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, }, + { 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, }, + { 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, }, + { 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, }, + { 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, }, + { 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, }, + { 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, }, + { 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, }, + { 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, }, + { 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, }, + { 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, }, + { 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, }, + { 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, }, + { 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, }, + { 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, }, + { 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, }, + { 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, }, + { 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, }, + { 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, }, + { 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, }, + { 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, }, + { 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, }, + { 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, }, + { 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, }, + { 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, }, + { 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, }, + { 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, }, + { 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, }, + { 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, }, + { 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, }, + { 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, }, + { 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, + { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, } + }; +} + +#endif diff --git a/library/PolyVoxCore/source/Impl/RandomUnitVectors.cpp b/include/PolyVox/Impl/RandomUnitVectors.h similarity index 99% rename from library/PolyVoxCore/source/Impl/RandomUnitVectors.cpp rename to include/PolyVox/Impl/RandomUnitVectors.h index f1d3aabf..95ff60e3 100644 --- a/library/PolyVoxCore/source/Impl/RandomUnitVectors.cpp +++ b/include/PolyVox/Impl/RandomUnitVectors.h @@ -21,11 +21,16 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/RandomUnitVectors.h" +#ifndef __PolyVox_RandomUnitVectors_H__ +#define __PolyVox_RandomUnitVectors_H__ + +#include "PolyVox/Impl/TypeDef.h" + +#include "PolyVox/Vector.h" namespace PolyVox { - extern const Vector3DFloat randomUnitVectors[1024] = + const Vector3DFloat randomUnitVectors[1024] = { Vector3DFloat(+0.339922f, +0.827727f, -0.446454f), Vector3DFloat(+0.084104f, -0.552666f, -0.829148f), @@ -1053,3 +1058,5 @@ namespace PolyVox Vector3DFloat(-0.526640f, +0.820445f, +0.222533f) }; } + +#endif //__PolyVox_RandomUnitVectors_H__ diff --git a/library/PolyVoxCore/source/Impl/RandomVectors.cpp b/include/PolyVox/Impl/RandomVectors.h similarity index 99% rename from library/PolyVoxCore/source/Impl/RandomVectors.cpp rename to include/PolyVox/Impl/RandomVectors.h index b6f141da..346587f6 100644 --- a/library/PolyVoxCore/source/Impl/RandomVectors.cpp +++ b/include/PolyVox/Impl/RandomVectors.h @@ -21,11 +21,16 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/RandomVectors.h" +#ifndef __PolyVox_RandomVectors_H__ +#define __PolyVox_RandomVectors_H__ + +#include "PolyVox/Impl/TypeDef.h" + +#include "PolyVox/Vector.h" namespace PolyVox { - extern const Vector3DFloat randomVectors[1024] = + const Vector3DFloat randomVectors[1024] = { Vector3DFloat(+0.348918f, -0.385662f, +0.650197f), Vector3DFloat(-0.259255f, +0.791559f, +0.920957f), @@ -1053,3 +1058,5 @@ namespace PolyVox Vector3DFloat(-0.002289f, +0.568834f, -0.069185f) }; } + +#endif //__PolyVox_RandomVectors_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Timer.h b/include/PolyVox/Impl/Timer.h similarity index 65% rename from library/PolyVoxCore/include/PolyVoxCore/Impl/Timer.h rename to include/PolyVox/Impl/Timer.h index d53feb79..9ad25bc6 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Timer.h +++ b/include/PolyVox/Impl/Timer.h @@ -26,33 +26,47 @@ freely, subject to the following restrictions: #include -#ifdef _MSC_VER // Don't worry about the exact version, as long as this is defied. -#include -#else #include -#endif //_MSC_VER namespace PolyVox { class Timer { public: - Timer(bool bAutoStart = true); + Timer(bool bAutoStart = true) + { + if (bAutoStart) + { + start(); + } + } - void start(void); + void start(void) + { + m_start = clock::now(); + } - float elapsedTimeInSeconds(void); - uint32_t elapsedTimeInMilliSeconds(void); - uint32_t elapsedTimeInMicroSeconds(void); + float elapsedTimeInSeconds(void) + { + std::chrono::duration elapsed_seconds = clock::now() - m_start; + return elapsed_seconds.count(); + } + + uint32_t elapsedTimeInMilliSeconds(void) + { + std::chrono::duration elapsed_milliseconds = clock::now() - m_start; + return elapsed_milliseconds.count(); + } + + uint32_t elapsedTimeInMicroSeconds(void) + { + std::chrono::duration elapsed_microseconds = clock::now() - m_start; + return elapsed_microseconds.count(); + } private: -#if defined(_MSC_VER) - double m_fPCFreq; - __int64 m_iStartTime; -#else //_MSC_VER typedef std::chrono::system_clock clock; std::chrono::time_point m_start; -#endif //_MSC_VER }; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h b/include/PolyVox/Impl/TypeDef.h similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/Impl/TypeDef.h rename to include/PolyVox/Impl/TypeDef.h diff --git a/library/PolyVoxCore/source/Impl/Utility.cpp b/include/PolyVox/Impl/Utility.h similarity index 66% rename from library/PolyVoxCore/source/Impl/Utility.cpp rename to include/PolyVox/Impl/Utility.h index 83be3b0a..2fb3e59e 100644 --- a/library/PolyVoxCore/source/Impl/Utility.cpp +++ b/include/PolyVox/Impl/Utility.h @@ -21,44 +21,47 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/ErrorHandling.h" -#include "PolyVoxCore/Impl/Utility.h" +#ifndef __PolyVox_Utility_H__ +#define __PolyVox_Utility_H__ + +#include "PolyVox/Impl/TypeDef.h" + +#include namespace PolyVox { + inline bool isPowerOf2(uint32_t uInput) + { + if (uInput == 0) + return false; + else + return ((uInput & (uInput - 1)) == 0); + } + //Note: this function only works for inputs which are a power of two and not zero //If this is not the case then the output is undefined. - uint8_t logBase2(uint32_t uInput) + inline uint8_t logBase2(uint32_t uInput) { //Release mode validation - if(uInput == 0) + if (uInput == 0) { POLYVOX_THROW(std::invalid_argument, "Cannot compute the log of zero."); } - if(!isPowerOf2(uInput)) + if (!isPowerOf2(uInput)) { POLYVOX_THROW(std::invalid_argument, "Input must be a power of two in order to compute the log."); } uint32_t uResult = 0; - while( (uInput >> uResult) != 0) + while ((uInput >> uResult) != 0) { ++uResult; } - return static_cast(uResult-1); - } - - - bool isPowerOf2(uint32_t uInput) - { - if(uInput == 0) - return false; - else - return ((uInput & (uInput-1)) == 0); + return static_cast(uResult - 1); } // http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 - uint32_t upperPowerOfTwo(uint32_t v) + inline uint32_t upperPowerOfTwo(uint32_t v) { v--; v |= v >> 1; @@ -69,4 +72,22 @@ namespace PolyVox v++; return v; } + + inline int32_t roundTowardsNegInf(float r) + { + return (r >= 0.0) ? static_cast(r) : static_cast(r - 1.0f); + } + + inline int32_t roundToNearestInteger(float r) + { + return (r >= 0.0) ? static_cast(r + 0.5f) : static_cast(r - 0.5f); + } + + template + inline Type clamp(const Type& value, const Type& low, const Type& high) + { + return (std::min)(high, (std::max)(low, value)); + } } + +#endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/Interpolation.h b/include/PolyVox/Interpolation.h similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/Interpolation.h rename to include/PolyVox/Interpolation.h diff --git a/library/PolyVoxCore/include/PolyVoxCore/IteratorController.h b/include/PolyVox/IteratorController.h similarity index 94% rename from library/PolyVoxCore/include/PolyVoxCore/IteratorController.h rename to include/PolyVox/IteratorController.h index b819fd6e..a03ffc75 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/IteratorController.h +++ b/include/PolyVox/IteratorController.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_IteratorController_H__ #define __PolyVox_IteratorController_H__ -#include "PolyVoxCore/Region.h" +#include "PolyVox/Region.h" namespace PolyVox { @@ -41,6 +41,6 @@ namespace PolyVox }; } -#include "PolyVoxCore/IteratorController.inl" +#include "PolyVox/IteratorController.inl" #endif //__PolyVox_IteratorController_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/IteratorController.inl b/include/PolyVox/IteratorController.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/IteratorController.inl rename to include/PolyVox/IteratorController.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h b/include/PolyVox/LargeVolume.h similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h rename to include/PolyVox/LargeVolume.h diff --git a/library/PolyVoxCore/include/PolyVoxCore/LowPassFilter.h b/include/PolyVox/LowPassFilter.h similarity index 90% rename from library/PolyVoxCore/include/PolyVoxCore/LowPassFilter.h rename to include/PolyVox/LowPassFilter.h index 5ec1ea71..75fcbb37 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LowPassFilter.h +++ b/include/PolyVox/LowPassFilter.h @@ -24,9 +24,9 @@ freely, subject to the following restrictions: #ifndef __PolyVox_LowPassFilter_H__ #define __PolyVox_LowPassFilter_H__ -#include "PolyVoxCore/IteratorController.h" -#include "PolyVoxCore/RawVolume.h" //Is this desirable? -#include "PolyVoxCore/Region.h" +#include "PolyVox/IteratorController.h" +#include "PolyVox/RawVolume.h" //Is this desirable? +#include "PolyVox/Region.h" namespace PolyVox { @@ -54,7 +54,7 @@ namespace PolyVox }//namespace PolyVox -#include "PolyVoxCore/LowPassFilter.inl" +#include "PolyVox/LowPassFilter.inl" #endif //__PolyVox_LowPassFilter_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/LowPassFilter.inl b/include/PolyVox/LowPassFilter.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/LowPassFilter.inl rename to include/PolyVox/LowPassFilter.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h b/include/PolyVox/MarchingCubesSurfaceExtractor.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h rename to include/PolyVox/MarchingCubesSurfaceExtractor.h index d1702f22..69ec0569 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h +++ b/include/PolyVox/MarchingCubesSurfaceExtractor.h @@ -27,11 +27,11 @@ freely, subject to the following restrictions: #include "Impl/MarchingCubesTables.h" #include "Impl/TypeDef.h" -#include "PolyVoxCore/Array.h" -#include "PolyVoxCore/BaseVolume.h" //For wrap modes... should move these? -#include "PolyVoxCore/Mesh.h" -#include "PolyVoxCore/DefaultMarchingCubesController.h" -#include "PolyVoxCore/Vertex.h" +#include "PolyVox/Array.h" +#include "PolyVox/BaseVolume.h" //For wrap modes... should move these? +#include "PolyVox/Mesh.h" +#include "PolyVox/DefaultMarchingCubesController.h" +#include "PolyVox/Vertex.h" namespace PolyVox { @@ -353,6 +353,6 @@ namespace PolyVox } } -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.inl" +#include "PolyVox/MarchingCubesSurfaceExtractor.inl" #endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl b/include/PolyVox/MarchingCubesSurfaceExtractor.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl rename to include/PolyVox/MarchingCubesSurfaceExtractor.inl index cf8dcf67..4fb98272 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl +++ b/include/PolyVox/MarchingCubesSurfaceExtractor.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/Timer.h" +#include "PolyVox/Impl/Timer.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/Material.h b/include/PolyVox/Material.h similarity index 96% rename from library/PolyVoxCore/include/PolyVoxCore/Material.h rename to include/PolyVox/Material.h index 2958d7e5..e3d98c99 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Material.h +++ b/include/PolyVox/Material.h @@ -26,7 +26,7 @@ freely, subject to the following restrictions: #include "Impl/TypeDef.h" -#include "PolyVoxCore/DefaultIsQuadNeeded.h" //we'll specialise this function for this voxel type +#include "PolyVox/DefaultIsQuadNeeded.h" //we'll specialise this function for this voxel type namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h b/include/PolyVox/MaterialDensityPair.h similarity index 96% rename from library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h rename to include/PolyVox/MaterialDensityPair.h index 83cc1739..87592ce7 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/MaterialDensityPair.h +++ b/include/PolyVox/MaterialDensityPair.h @@ -24,8 +24,8 @@ freely, subject to the following restrictions: #ifndef __PolyVox_MaterialDensityPair_H__ #define __PolyVox_MaterialDensityPair_H__ -#include "PolyVoxCore/DefaultIsQuadNeeded.h" //we'll specialise this function for this voxel type -#include "PolyVoxCore/DefaultMarchingCubesController.h" //We'll specialise the controller contained in here +#include "PolyVox/DefaultIsQuadNeeded.h" //we'll specialise this function for this voxel type +#include "PolyVox/DefaultMarchingCubesController.h" //We'll specialise the controller contained in here #include "Impl/TypeDef.h" diff --git a/library/PolyVoxCore/include/PolyVoxCore/Mesh.h b/include/PolyVox/Mesh.h similarity index 93% rename from library/PolyVoxCore/include/PolyVoxCore/Mesh.h rename to include/PolyVox/Mesh.h index 4c1b3582..08bc0d07 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Mesh.h +++ b/include/PolyVox/Mesh.h @@ -26,9 +26,9 @@ freely, subject to the following restrictions: #include "Impl/TypeDef.h" -#include "PolyVoxCore/PolyVoxForwardDeclarations.h" -#include "PolyVoxCore/Region.h" -#include "PolyVoxCore/Vertex.h" //Should probably do away with this on in the future... +#include "PolyVox/PolyVoxForwardDeclarations.h" +#include "PolyVox/Region.h" +#include "PolyVox/Vertex.h" //Should probably do away with this on in the future... #include #include @@ -98,6 +98,6 @@ namespace PolyVox } } -#include "PolyVoxCore/Mesh.inl" +#include "PolyVox/Mesh.inl" #endif /* __Mesh_H__ */ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Mesh.inl b/include/PolyVox/Mesh.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/Mesh.inl rename to include/PolyVox/Mesh.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/PagedVolume.h b/include/PolyVox/PagedVolume.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/PagedVolume.h rename to include/PolyVox/PagedVolume.h index adf27243..e5ca536f 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/PagedVolume.h +++ b/include/PolyVox/PagedVolume.h @@ -24,9 +24,9 @@ freely, subject to the following restrictions: #ifndef __PolyVox_PagedVolume_H__ #define __PolyVox_PagedVolume_H__ -#include "PolyVoxCore/BaseVolume.h" -#include "PolyVoxCore/Region.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/BaseVolume.h" +#include "PolyVox/Region.h" +#include "PolyVox/Vector.h" #include #include //For abort() @@ -359,8 +359,8 @@ namespace PolyVox }; } -#include "PolyVoxCore/PagedVolume.inl" -#include "PolyVoxCore/PagedVolumeChunk.inl" -#include "PolyVoxCore/PagedVolumeSampler.inl" +#include "PolyVox/PagedVolume.inl" +#include "PolyVox/PagedVolumeChunk.inl" +#include "PolyVox/PagedVolumeSampler.inl" #endif //__PolyVox_PagedVolume_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/PagedVolume.inl b/include/PolyVox/PagedVolume.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/PagedVolume.inl rename to include/PolyVox/PagedVolume.inl index 6ee86f1c..e6c5b04b 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/PagedVolume.inl +++ b/include/PolyVox/PagedVolume.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/ErrorHandling.h" +#include "PolyVox/Impl/ErrorHandling.h" #include #include @@ -52,7 +52,7 @@ namespace PolyVox { // If the user is creating a vast (almost infinite) volume then we can bet they will be // expecting a high memory usage and will want a fair number of chunks to play around with. - if (regValid == Region::MaxRegion) + if (regValid == Region::MaxRegion()) { m_uChunkCountLimit = 1024; } diff --git a/library/PolyVoxCore/include/PolyVoxCore/PagedVolumeChunk.inl b/include/PolyVox/PagedVolumeChunk.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/PagedVolumeChunk.inl rename to include/PolyVox/PagedVolumeChunk.inl index d7e249bd..7a51c79b 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/PagedVolumeChunk.inl +++ b/include/PolyVox/PagedVolumeChunk.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Impl/Utility.h" +#include "PolyVox/Impl/Utility.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/PagedVolumeSampler.inl b/include/PolyVox/PagedVolumeSampler.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/PagedVolumeSampler.inl rename to include/PolyVox/PagedVolumeSampler.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/Picking.h b/include/PolyVox/Picking.h similarity index 96% rename from library/PolyVoxCore/include/PolyVoxCore/Picking.h rename to include/PolyVox/Picking.h index ee757ddb..49b026ca 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Picking.h +++ b/include/PolyVox/Picking.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Picking_H__ #define __PolyVox_Picking_H__ -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Vector.h" namespace PolyVox { @@ -44,6 +44,6 @@ namespace PolyVox PickResult pickVoxel(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, const typename VolumeType::VoxelType& emptyVoxelExample); } -#include "PolyVoxCore/Picking.inl" +#include "PolyVox/Picking.inl" #endif //__PolyVox_Picking_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Picking.inl b/include/PolyVox/Picking.inl similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/Picking.inl rename to include/PolyVox/Picking.inl index c776ee00..c5829f09 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Picking.inl +++ b/include/PolyVox/Picking.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Raycast.h" +#include "PolyVox/Raycast.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/PolyVoxForwardDeclarations.h b/include/PolyVox/PolyVoxForwardDeclarations.h similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/PolyVoxForwardDeclarations.h rename to include/PolyVox/PolyVoxForwardDeclarations.h diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.h b/include/PolyVox/RawVolume.h similarity index 97% rename from library/PolyVoxCore/include/PolyVoxCore/RawVolume.h rename to include/PolyVox/RawVolume.h index 3201bb8a..73a2f1e5 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.h +++ b/include/PolyVox/RawVolume.h @@ -24,9 +24,9 @@ freely, subject to the following restrictions: #ifndef __PolyVox_RawVolume_H__ #define __PolyVox_RawVolume_H__ -#include "PolyVoxCore/BaseVolume.h" -#include "PolyVoxCore/Region.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/BaseVolume.h" +#include "PolyVox/Region.h" +#include "PolyVox/Vector.h" #include //For abort() #include @@ -167,7 +167,7 @@ namespace PolyVox }; } -#include "PolyVoxCore/RawVolume.inl" -#include "PolyVoxCore/RawVolumeSampler.inl" +#include "PolyVox/RawVolume.inl" +#include "PolyVox/RawVolumeSampler.inl" #endif //__PolyVox_RawVolume_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolume.inl b/include/PolyVox/RawVolume.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/RawVolume.inl rename to include/PolyVox/RawVolume.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl b/include/PolyVox/RawVolumeSampler.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl rename to include/PolyVox/RawVolumeSampler.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/Raycast.h b/include/PolyVox/Raycast.h similarity index 98% rename from library/PolyVoxCore/include/PolyVoxCore/Raycast.h rename to include/PolyVox/Raycast.h index 3adb28c4..4d4888b8 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Raycast.h +++ b/include/PolyVox/Raycast.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Raycast_H__ #define __PolyVox_Raycast_H__ -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Vector.h" namespace PolyVox { @@ -98,6 +98,6 @@ namespace PolyVox RaycastResult raycastWithDirection(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, Callback& callback); } -#include "PolyVoxCore/Raycast.inl" +#include "PolyVox/Raycast.inl" #endif //__PolyVox_Raycast_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Raycast.inl b/include/PolyVox/Raycast.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/Raycast.inl rename to include/PolyVox/Raycast.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/Region.h b/include/PolyVox/Region.h similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/Region.h rename to include/PolyVox/Region.h index 2e8d113b..71cdb09f 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Region.h +++ b/include/PolyVox/Region.h @@ -26,7 +26,7 @@ freely, subject to the following restrictions: #include "Impl/TypeDef.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Vector.h" namespace PolyVox { @@ -58,9 +58,9 @@ namespace PolyVox public: /// A Region with the lower corner set as low as possible and the upper corner set as high as possible. - static const Region MaxRegion; + static Region MaxRegion(); /// A Region with the lower corner set as high as possible and the upper corner set as low as possible. - static const Region InvertedRegion; + static Region InvertedRegion(); /// Constructor Region(); @@ -458,4 +458,6 @@ namespace PolyVox } } +#include "PolyVox/Region.inl" + #endif diff --git a/library/PolyVoxCore/source/Region.cpp b/include/PolyVox/Region.inl similarity index 83% rename from library/PolyVoxCore/source/Region.cpp rename to include/PolyVox/Region.inl index ca2d7337..e327f6f6 100644 --- a/library/PolyVoxCore/source/Region.cpp +++ b/include/PolyVox/Region.inl @@ -21,8 +21,6 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Region.h" - #include #include @@ -30,29 +28,31 @@ namespace PolyVox { /** */ - const Region Region::MaxRegion - ( - Vector3DInt32((std::numeric_limits::min)(), (std::numeric_limits::min)(), (std::numeric_limits::min)()), - Vector3DInt32((std::numeric_limits::max)(), (std::numeric_limits::max)(), (std::numeric_limits::max)()) - ); + inline Region Region::MaxRegion() + { + return Region( + (std::numeric_limits::min)(), (std::numeric_limits::min)(), (std::numeric_limits::min)(), + (std::numeric_limits::max)(), (std::numeric_limits::max)(), (std::numeric_limits::max)()); + } /** * This Region is not considered valid as defined by isValid(). It's main application * is to initialise a Region to this value and then() accumulate positions. The result * of this will be a Region which encompasses all positions specified. */ - const Region Region::InvertedRegion - ( - Vector3DInt32((std::numeric_limits::max)(), (std::numeric_limits::max)(), (std::numeric_limits::max)()), - Vector3DInt32((std::numeric_limits::min)(), (std::numeric_limits::min)(), (std::numeric_limits::min)()) - ); + inline Region Region::InvertedRegion() + { + return Region( + (std::numeric_limits::max)(), (std::numeric_limits::max)(), (std::numeric_limits::max)(), + (std::numeric_limits::min)(), (std::numeric_limits::min)(), (std::numeric_limits::min)()); + } /** * \param iX The 'x' component of the position to accumulate. * \param iY The 'y' component of the position to accumulate. * \param iZ The 'z' component of the position to accumulate. */ - void Region::accumulate(int32_t iX, int32_t iY, int32_t iZ) + inline void Region::accumulate(int32_t iX, int32_t iY, int32_t iZ) { m_iLowerX = ((std::min)(m_iLowerX, iX)); m_iLowerY = ((std::min)(m_iLowerY, iY)); @@ -65,7 +65,7 @@ namespace PolyVox /** * \param v3dPos The position to accumulate. */ - void Region::accumulate(const Vector3DInt32& v3dPos) + inline void Region::accumulate(const Vector3DInt32& v3dPos) { accumulate(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ()); } @@ -77,7 +77,7 @@ namespace PolyVox * \param reg The Region to accumulate. This must be valid as defined by the isValid() function. * \sa isValid() */ - void Region::accumulate(const Region& reg) + inline void Region::accumulate(const Region& reg) { if(!reg.isValid()) { @@ -95,7 +95,7 @@ namespace PolyVox /** * Constructs a Region and clears all extents to zero. */ - Region::Region() + inline Region::Region() :m_iLowerX(0) ,m_iLowerY(0) ,m_iLowerZ(0) @@ -110,7 +110,7 @@ namespace PolyVox * \param v3dLowerCorner The desired lower corner of the Region. * \param v3dUpperCorner The desired upper corner of the Region. */ - Region::Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner) + inline Region::Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner) :m_iLowerX(v3dLowerCorner.getX()) ,m_iLowerY(v3dLowerCorner.getY()) ,m_iLowerZ(v3dLowerCorner.getZ()) @@ -129,7 +129,7 @@ namespace PolyVox * \param iUpperY The desired upper 'y' extent of the Region. * \param iUpperZ The desired upper 'z' extent of the Region. */ - Region::Region(int32_t iLowerX, int32_t iLowerY, int32_t iLowerZ, int32_t iUpperX, int32_t iUpperY, int32_t iUpperZ) + inline Region::Region(int32_t iLowerX, int32_t iLowerY, int32_t iLowerZ, int32_t iUpperX, int32_t iUpperY, int32_t iUpperZ) :m_iLowerX(iLowerX) ,m_iLowerY(iLowerY) ,m_iLowerZ(iLowerZ) @@ -145,7 +145,7 @@ namespace PolyVox * \return true if the Regions match. * \sa operator!= */ - bool Region::operator==(const Region& rhs) const + inline bool Region::operator==(const Region& rhs) const { return ((m_iLowerX == rhs.m_iLowerX) && (m_iLowerY == rhs.m_iLowerY) && (m_iLowerZ == rhs.m_iLowerZ) && (m_iUpperX == rhs.m_iUpperX) && (m_iUpperY == rhs.m_iUpperY) && (m_iUpperZ == rhs.m_iUpperZ)); @@ -157,7 +157,7 @@ namespace PolyVox * \return true if the Regions are different. * \sa operator== */ - bool Region::operator!=(const Region& rhs) const + inline bool Region::operator!=(const Region& rhs) const { return !(*this == rhs); } @@ -171,7 +171,7 @@ namespace PolyVox * \param fZ The 'z' position of the point to test. * \param boundary The desired boundary value. */ - bool Region::containsPoint(float fX, float fY, float fZ, float boundary) const + inline bool Region::containsPoint(float fX, float fY, float fZ, float boundary) const { return (fX <= m_iUpperX - boundary) && (fY <= m_iUpperY - boundary) @@ -188,7 +188,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPoint(const Vector3DFloat& pos, float boundary) const + inline bool Region::containsPoint(const Vector3DFloat& pos, float boundary) const { return containsPoint(pos.getX(), pos.getY(), pos.getZ(), boundary); } @@ -202,7 +202,7 @@ namespace PolyVox * \param iZ The 'z' position of the point to test. * \param boundary The desired boundary value. */ - bool Region::containsPoint(int32_t iX, int32_t iY, int32_t iZ, uint8_t boundary) const + inline bool Region::containsPoint(int32_t iX, int32_t iY, int32_t iZ, uint8_t boundary) const { return (iX <= m_iUpperX - boundary) && (iY <= m_iUpperY - boundary) @@ -219,7 +219,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPoint(const Vector3DInt32& pos, uint8_t boundary) const + inline bool Region::containsPoint(const Vector3DInt32& pos, uint8_t boundary) const { return containsPoint(pos.getX(), pos.getY(), pos.getZ(), boundary); } @@ -231,7 +231,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPointInX(float pos, float boundary) const + inline bool Region::containsPointInX(float pos, float boundary) const { return (pos <= m_iUpperX - boundary) && (pos >= m_iLowerX + boundary); @@ -244,7 +244,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPointInX(int32_t pos, uint8_t boundary) const + inline bool Region::containsPointInX(int32_t pos, uint8_t boundary) const { return (pos <= m_iUpperX - boundary) && (pos >= m_iLowerX + boundary); @@ -257,7 +257,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPointInY(float pos, float boundary) const + inline bool Region::containsPointInY(float pos, float boundary) const { return (pos <= m_iUpperY - boundary) && (pos >= m_iLowerY + boundary); @@ -270,7 +270,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPointInY(int32_t pos, uint8_t boundary) const + inline bool Region::containsPointInY(int32_t pos, uint8_t boundary) const { return (pos <= m_iUpperY - boundary) && (pos >= m_iLowerY + boundary); @@ -283,7 +283,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPointInZ(float pos, float boundary) const + inline bool Region::containsPointInZ(float pos, float boundary) const { return (pos <= m_iUpperZ - boundary) && (pos >= m_iLowerZ + boundary); @@ -296,7 +296,7 @@ namespace PolyVox * \param pos The position to test. * \param boundary The desired boundary value. */ - bool Region::containsPointInZ(int32_t pos, uint8_t boundary) const + inline bool Region::containsPointInZ(int32_t pos, uint8_t boundary) const { return (pos <= m_iUpperZ - boundary) && (pos >= m_iLowerZ + boundary); @@ -309,7 +309,7 @@ namespace PolyVox * \param reg The region to test. * \param boundary The desired boundary value. */ - bool Region::containsRegion(const Region& reg, uint8_t boundary) const + inline bool Region::containsRegion(const Region& reg, uint8_t boundary) const { return (reg.m_iUpperX <= m_iUpperX - boundary) && (reg.m_iUpperY <= m_iUpperY - boundary) @@ -324,7 +324,7 @@ namespace PolyVox * of this Region and the one it was cropped to. * \param other The Region to crop to. */ - void Region::cropTo(const Region& other) + inline void Region::cropTo(const Region& other) { m_iLowerX = ((std::max)(m_iLowerX, other.m_iLowerX)); m_iLowerY = ((std::max)(m_iLowerY, other.m_iLowerY)); @@ -339,7 +339,7 @@ namespace PolyVox * is possible but you should prefer the shrink() function for clarity. * \param iAmount The amount to grow by. */ - void Region::grow(int32_t iAmount) + inline void Region::grow(int32_t iAmount) { m_iLowerX -= iAmount; m_iLowerY -= iAmount; @@ -357,7 +357,7 @@ namespace PolyVox * \param iAmountY The amount to grow by in 'y'. * \param iAmountZ The amount to grow by in 'z'. */ - void Region::grow(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) + inline void Region::grow(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) { m_iLowerX -= iAmountX; m_iLowerY -= iAmountY; @@ -373,14 +373,14 @@ namespace PolyVox * is possible but you should prefer the shrink() function for clarity. * \param v3dAmount The amount to grow by (one component for each direction). */ - void Region::grow(const Vector3DInt32& v3dAmount) + inline void Region::grow(const Vector3DInt32& v3dAmount) { grow(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); } /** */ - bool Region::isValid(void) const + inline bool Region::isValid(void) const { return (m_iUpperX >= m_iLowerX) && (m_iUpperY >= m_iLowerY) && (m_iUpperZ >= m_iLowerZ); } @@ -390,7 +390,7 @@ namespace PolyVox * \param iAmountY The amount to move the Region by in 'y'. * \param iAmountZ The amount to move the Region by in 'z'. */ - void Region::shift(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) + inline void Region::shift(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) { shiftLowerCorner(iAmountX, iAmountY, iAmountZ); shiftUpperCorner(iAmountX, iAmountY, iAmountZ); @@ -399,7 +399,7 @@ namespace PolyVox /** * \param v3dAmount The amount to move the Region by. */ - void Region::shift(const Vector3DInt32& v3dAmount) + inline void Region::shift(const Vector3DInt32& v3dAmount) { shiftLowerCorner(v3dAmount); shiftUpperCorner(v3dAmount); @@ -410,7 +410,7 @@ namespace PolyVox * \param iAmountY The amount to move the lower corner by in 'y'. * \param iAmountZ The amount to move the lower corner by in 'z'. */ - void Region::shiftLowerCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) + inline void Region::shiftLowerCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) { m_iLowerX += iAmountX; m_iLowerY += iAmountY; @@ -420,7 +420,7 @@ namespace PolyVox /** * \param v3dAmount The amount to move the lower corner by. */ - void Region::shiftLowerCorner(const Vector3DInt32& v3dAmount) + inline void Region::shiftLowerCorner(const Vector3DInt32& v3dAmount) { shiftLowerCorner(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); } @@ -430,7 +430,7 @@ namespace PolyVox * \param iAmountY The amount to move the upper corner by in 'y'. * \param iAmountZ The amount to move the upper corner by in 'z'. */ - void Region::shiftUpperCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) + inline void Region::shiftUpperCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) { m_iUpperX += iAmountX; m_iUpperY += iAmountY; @@ -440,7 +440,7 @@ namespace PolyVox /** * \param v3dAmount The amount to move the upper corner by. */ - void Region::shiftUpperCorner(const Vector3DInt32& v3dAmount) + inline void Region::shiftUpperCorner(const Vector3DInt32& v3dAmount) { shiftUpperCorner(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); } @@ -450,7 +450,7 @@ namespace PolyVox * is possible but you should prefer the grow() function for clarity. * \param iAmount The amount to shrink by. */ - void Region::shrink(int32_t iAmount) + inline void Region::shrink(int32_t iAmount) { m_iLowerX += iAmount; m_iLowerY += iAmount; @@ -468,7 +468,7 @@ namespace PolyVox * \param iAmountY The amount to shrink by in 'y'. * \param iAmountZ The amount to shrink by in 'z'. */ - void Region::shrink(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) + inline void Region::shrink(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) { m_iLowerX += iAmountX; m_iLowerY += iAmountY; @@ -484,7 +484,7 @@ namespace PolyVox * is possible but you should prefer the grow() function for clarity. * \param v3dAmount The amount to shrink by (one component for each direction). */ - void Region::shrink(const Vector3DInt32& v3dAmount) + inline void Region::shrink(const Vector3DInt32& v3dAmount) { shrink(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); } @@ -492,8 +492,7 @@ namespace PolyVox /** * This function only returns true if the regions are really intersecting and not simply touching. */ - - bool intersects(const Region& a, const Region& b) + inline bool intersects(const Region& a, const Region& b) { // No intersection if seperated along an axis. if(a.getUpperX() < b.getLowerX() || a.getLowerX() > b.getUpperX()) return false; @@ -510,7 +509,7 @@ namespace PolyVox * \param region The Region to write to the stream. * \return A reference to the output stream to allow chaining. */ - std::ostream& operator<<(std::ostream& os, const Region& region) + inline std::ostream& operator<<(std::ostream& os, const Region& region) { os << "(" << region.getLowerX() << "," << region.getLowerY() << "," << region.getLowerZ() << ") to (" << region.getUpperX() << "," << region.getUpperY() << "," << region.getUpperZ() << ")"; diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h b/include/PolyVox/SimpleVolume.h similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h rename to include/PolyVox/SimpleVolume.h diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.h b/include/PolyVox/Vector.h similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/Vector.h rename to include/PolyVox/Vector.h index 416158ed..695ce8c0 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vector.h +++ b/include/PolyVox/Vector.h @@ -242,7 +242,7 @@ namespace std } -#include "PolyVoxCore/Vector.inl" +#include "PolyVox/Vector.inl" #endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.inl b/include/PolyVox/Vector.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/Vector.inl rename to include/PolyVox/Vector.inl diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vertex.h b/include/PolyVox/Vertex.h similarity index 97% rename from library/PolyVoxCore/include/PolyVoxCore/Vertex.h rename to include/PolyVox/Vertex.h index 1eb6f429..12900c5a 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vertex.h +++ b/include/PolyVox/Vertex.h @@ -26,7 +26,7 @@ freely, subject to the following restrictions: #include "Impl/TypeDef.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Vector.h" #include #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.h b/include/PolyVox/VolumeResampler.h similarity index 95% rename from library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.h rename to include/PolyVox/VolumeResampler.h index ec7aed00..c2869262 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.h +++ b/include/PolyVox/VolumeResampler.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_VolumeResampler_H__ #define __PolyVox_VolumeResampler_H__ -#include "PolyVoxCore/Region.h" +#include "PolyVox/Region.h" namespace PolyVox { @@ -51,7 +51,7 @@ namespace PolyVox }//namespace PolyVox -#include "PolyVoxCore/VolumeResampler.inl" +#include "PolyVox/VolumeResampler.inl" #endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl b/include/PolyVox/VolumeResampler.inl similarity index 99% rename from library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl rename to include/PolyVox/VolumeResampler.inl index ae09dfb9..3360d54b 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VolumeResampler.inl +++ b/include/PolyVox/VolumeResampler.inl @@ -21,7 +21,7 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ -#include "PolyVoxCore/Interpolation.h" +#include "PolyVox/Interpolation.h" #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h b/include/PolyVox/VoxelFilters.h similarity index 96% rename from library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h rename to include/PolyVox/VoxelFilters.h index 1c54b9ea..af48dd6d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.h +++ b/include/PolyVox/VoxelFilters.h @@ -32,6 +32,6 @@ namespace PolyVox float computeSmoothedVoxel(typename VolumeType::Sampler& volIter); } -#include "PolyVoxCore/VoxelFilters.inl" +#include "PolyVox/VoxelFilters.inl" #endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.inl b/include/PolyVox/VoxelFilters.inl similarity index 100% rename from library/PolyVoxCore/include/PolyVoxCore/VoxelFilters.inl rename to include/PolyVox/VoxelFilters.inl diff --git a/library/PolyVoxConfig.cmake.in b/include/PolyVoxConfig.cmake.in similarity index 100% rename from library/PolyVoxConfig.cmake.in rename to include/PolyVoxConfig.cmake.in diff --git a/library/polyvox.qhcp.in b/include/polyvox.qhcp.in similarity index 100% rename from library/polyvox.qhcp.in rename to include/polyvox.qhcp.in diff --git a/library/PolyVoxCore/CMakeLists.txt b/library/PolyVoxCore/CMakeLists.txt deleted file mode 100644 index 35478777..00000000 --- a/library/PolyVoxCore/CMakeLists.txt +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (c) 2008-2012 Matt Williams -# Copyright (c) 2008-2012 David Williams -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# -# 3. This notice may not be removed or altered from any source -# distribution. - -PROJECT(PolyVoxCore) - -#Projects source files -SET(CORE_SRC_FILES - source/AStarPathfinder.cpp - source/Region.cpp -) - -#Projects headers files -SET(CORE_INC_FILES - include/PolyVoxCore/AmbientOcclusionCalculator.h - include/PolyVoxCore/AmbientOcclusionCalculator.inl - include/PolyVoxCore/Array.h - include/PolyVoxCore/AStarPathfinder.h - include/PolyVoxCore/AStarPathfinder.inl - include/PolyVoxCore/BaseVolume.h - include/PolyVoxCore/BaseVolume.inl - include/PolyVoxCore/BaseVolumeSampler.inl - include/PolyVoxCore/CubicSurfaceExtractor.h - include/PolyVoxCore/CubicSurfaceExtractor.inl - include/PolyVoxCore/DefaultIsQuadNeeded.h - include/PolyVoxCore/DefaultMarchingCubesController.h - include/PolyVoxCore/Density.h - include/PolyVoxCore/FilePager.h - include/PolyVoxCore/GradientEstimators.h - include/PolyVoxCore/GradientEstimators.inl - include/PolyVoxCore/Interpolation.h - include/PolyVoxCore/IteratorController.h - include/PolyVoxCore/IteratorController.inl - include/PolyVoxCore/LargeVolume.h - include/PolyVoxCore/LowPassFilter.h - include/PolyVoxCore/LowPassFilter.inl - include/PolyVoxCore/MarchingCubesSurfaceExtractor.h - include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl - include/PolyVoxCore/Material.h - include/PolyVoxCore/MaterialDensityPair.h - include/PolyVoxCore/Mesh.h - include/PolyVoxCore/Mesh.inl - include/PolyVoxCore/PagedVolume.h - include/PolyVoxCore/PagedVolume.inl - include/PolyVoxCore/PagedVolumeChunk.inl - include/PolyVoxCore/PagedVolumeSampler.inl - include/PolyVoxCore/PolyVoxForwardDeclarations.h - include/PolyVoxCore/Picking.h - include/PolyVoxCore/Picking.inl - include/PolyVoxCore/RawVolume.h - include/PolyVoxCore/RawVolume.inl - include/PolyVoxCore/RawVolumeSampler.inl - include/PolyVoxCore/Raycast.h - include/PolyVoxCore/Raycast.inl - include/PolyVoxCore/Region.h - include/PolyVoxCore/SimpleVolume.h - include/PolyVoxCore/Vector.h - include/PolyVoxCore/Vector.inl - include/PolyVoxCore/Vertex.h - include/PolyVoxCore/VolumeResampler.h - include/PolyVoxCore/VolumeResampler.inl - include/PolyVoxCore/VoxelFilters.h - include/PolyVoxCore/VoxelFilters.inl -) - -SET(IMPL_SRC_FILES - source/Impl/ErrorHandling.cpp - source/Impl/Logging.cpp - source/Impl/MarchingCubesTables.cpp - source/Impl/RandomUnitVectors.cpp - source/Impl/RandomVectors.cpp - source/Impl/Timer.cpp - source/Impl/Utility.cpp -) - -SET(IMPL_INC_FILES - include/PolyVoxCore/Impl/AStarPathfinderImpl.h - include/PolyVoxCore/Impl/Config.h - include/PolyVoxCore/Impl/ErrorHandling.h - include/PolyVoxCore/Impl/Logging.h - include/PolyVoxCore/Impl/MarchingCubesTables.h - include/PolyVoxCore/Impl/RandomUnitVectors.h - include/PolyVoxCore/Impl/RandomVectors.h - include/PolyVoxCore/Impl/Timer.h - include/PolyVoxCore/Impl/TypeDef.h - include/PolyVoxCore/Impl/Utility.h -) - -#NOTE: The following line should be uncommented when building shared libs. - -#"Sources" and "Headers" are the group names in Visual Studio. -#They may have other uses too... -SOURCE_GROUP("Source Files" FILES ${CORE_SRC_FILES}) -SOURCE_GROUP("Header Files" FILES ${CORE_INC_FILES}) - -SOURCE_GROUP("Source Files\\Impl" FILES ${IMPL_SRC_FILES}) -SOURCE_GROUP("Header Files\\Impl" FILES ${IMPL_INC_FILES}) - -#Tell CMake the paths -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include) - -#Core -#Build -IF(LIBRARY_TYPE STREQUAL "STATIC") - ADD_LIBRARY(PolyVoxCore STATIC ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES}) - IF(UNIX) - SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS -fPIC) - ENDIF() -ENDIF() -IF(LIBRARY_TYPE STREQUAL "DYNAMIC") - ADD_LIBRARY(PolyVoxCore SHARED ${CORE_SRC_FILES} ${CORE_INC_FILES} ${IMPL_SRC_FILES} ${IMPL_INC_FILES}) - SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "-DPOLYVOX_SHARED_EXPORTS") -ENDIF() -SET_PROPERTY(TARGET PolyVoxCore PROPERTY FOLDER "Library") - -SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR}) -IF(MSVC) - SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS "/W4 /wd4251") #Disable warning on STL exports -ENDIF(MSVC) - -#Install -IF(WIN32) - INSTALL(TARGETS PolyVoxCore - RUNTIME DESTINATION PolyVoxCore/bin COMPONENT library - LIBRARY DESTINATION PolyVoxCore/lib COMPONENT library - ARCHIVE DESTINATION PolyVoxCore/lib COMPONENT library - ) - - #Install the core header files, including the ones in the Impl subfolder. - INSTALL(DIRECTORY include DESTINATION PolyVoxCore COMPONENT development PATTERN "*.svn*" EXCLUDE) - - #On windows, we also install the debug information. It's unfortunate that we have to hard-code - #the 'Debug' part of the path, but CMake doesn't seem to provide a way around this. The best I - #found was: http://www.cmake.org/pipermail/cmake/2007-October/016924.html (and it is a bit ugly). - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/PolyVoxCore.pdb DESTINATION PolyVoxCore/lib CONFIGURATIONS Debug) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/PolyVoxCore.pdb DESTINATION PolyVoxCore/lib CONFIGURATIONS RelWithDebInfo) -ELSE(WIN32) - INSTALL(TARGETS PolyVoxCore - RUNTIME DESTINATION bin COMPONENT library - LIBRARY DESTINATION lib COMPONENT library - ARCHIVE DESTINATION lib COMPONENT library - ) - - #Install the core header files, including the ones in the Impl subfolder. - INSTALL(DIRECTORY include/ DESTINATION include/PolyVoxCore COMPONENT development PATTERN "*.svn*" EXCLUDE) -ENDIF(WIN32) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h deleted file mode 100644 index 2f29ae43..00000000 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/MarchingCubesTables.h +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#ifndef __PolyVox_MarchingCubeTables_H__ -#define __PolyVox_MarchingCubeTables_H__ - -#include "PolyVoxCore/Impl/TypeDef.h" - -#include - -namespace PolyVox -{ - extern const POLYVOX_API uint16_t edgeTable[256]; - extern const POLYVOX_API int8_t triTable[256][16]; -} - -#endif diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/RandomUnitVectors.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/RandomUnitVectors.h deleted file mode 100644 index 69d2af1e..00000000 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/RandomUnitVectors.h +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#ifndef __PolyVox_RandomUnitVectors_H__ -#define __PolyVox_RandomUnitVectors_H__ - -#include "PolyVoxCore/Impl/TypeDef.h" - -#include "PolyVoxCore/Vector.h" - -namespace PolyVox -{ - extern POLYVOX_API const Vector3DFloat randomUnitVectors[]; -} - -#endif //__PolyVox_RandomUnitVectors_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/RandomVectors.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/RandomVectors.h deleted file mode 100644 index a4d2d4bd..00000000 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/RandomVectors.h +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#ifndef __PolyVox_RandomVectors_H__ -#define __PolyVox_RandomVectors_H__ - -#include "PolyVoxCore/Impl/TypeDef.h" - -#include "PolyVoxCore/Vector.h" - -namespace PolyVox -{ - extern POLYVOX_API const Vector3DFloat randomVectors[]; -} - -#endif //__PolyVox_RandomVectors_H__ diff --git a/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h b/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h deleted file mode 100644 index ff9a6e7b..00000000 --- a/library/PolyVoxCore/include/PolyVoxCore/Impl/Utility.h +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#ifndef __PolyVox_Utility_H__ -#define __PolyVox_Utility_H__ - -#include "PolyVoxCore/Impl/TypeDef.h" - -#include - -namespace PolyVox -{ - POLYVOX_API uint8_t logBase2(uint32_t uInput); - POLYVOX_API bool isPowerOf2(uint32_t uInput); - - int32_t roundTowardsNegInf(float r); - int32_t roundToInteger(float r); - template - Type clamp(const Type& value, const Type& low, const Type& high); - uint32_t upperPowerOfTwo(uint32_t v); - - inline int32_t roundTowardsNegInf(float r) - { - return (r >= 0.0) ? static_cast(r) : static_cast(r - 1.0f); - } - - inline int32_t roundToNearestInteger(float r) - { - return (r >= 0.0) ? static_cast(r + 0.5f) : static_cast(r - 0.5f); - } - - template - inline Type clamp(const Type& value, const Type& low, const Type& high) - { - return (std::min)(high, (std::max)(low, value)); - } -} - -#endif diff --git a/library/PolyVoxCore/source/AStarPathfinder.cpp b/library/PolyVoxCore/source/AStarPathfinder.cpp deleted file mode 100644 index 83d42db1..00000000 --- a/library/PolyVoxCore/source/AStarPathfinder.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#include "PolyVoxCore/AStarPathfinder.h" - -using namespace PolyVox; - -namespace PolyVox -{ - const Vector3DInt32 arrayPathfinderFaces[6] = - { - Vector3DInt32(0, 0, -1), - Vector3DInt32(0, 0, +1), - Vector3DInt32(0, -1, 0), - Vector3DInt32(0, +1, 0), - Vector3DInt32(-1, 0, 0), - Vector3DInt32(+1, 0, 0) - }; - - const Vector3DInt32 arrayPathfinderEdges[12] = - { - Vector3DInt32(0, -1, -1), - Vector3DInt32(0, -1, +1), - Vector3DInt32(0, +1, -1), - Vector3DInt32(0, +1, +1), - Vector3DInt32(-1, 0, -1), - Vector3DInt32(-1, 0, +1), - Vector3DInt32(+1, 0, -1), - Vector3DInt32(+1, 0, +1), - Vector3DInt32(-1, -1, 0), - Vector3DInt32(-1, +1, 0), - Vector3DInt32(+1, -1, 0), - Vector3DInt32(+1, +1, 0) - }; - - const Vector3DInt32 arrayPathfinderCorners[8] = - { - Vector3DInt32(-1, -1, -1), - Vector3DInt32(-1, -1, +1), - Vector3DInt32(-1, +1, -1), - Vector3DInt32(-1, +1, +1), - Vector3DInt32(+1, -1, -1), - Vector3DInt32(+1, -1, +1), - Vector3DInt32(+1, +1, -1), - Vector3DInt32(+1, +1, +1) - }; -} diff --git a/library/PolyVoxCore/source/Impl/ErrorHandling.cpp b/library/PolyVoxCore/source/Impl/ErrorHandling.cpp deleted file mode 100644 index 98e03fd2..00000000 --- a/library/PolyVoxCore/source/Impl/ErrorHandling.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#include "PolyVoxCore/Impl/ErrorHandling.h" - -namespace PolyVox -{ - -#ifndef POLYVOX_THROW_ENABLED - void defaultThrowHandler(std::exception& e, const char* file, int line) - { - std::stringstream ss; \ - ss << "\n"; \ - ss << " PolyVox exception thrown!"; \ - ss << " ========================="; \ - ss << " PolyVox has tried to throw an exception but it was built without support"; \ - ss << " for exceptions. In this scenario PolyVox will call a 'throw handler'"; \ - ss << " and this message is being printed by the default throw handler."; \ - ss << "\n"; \ - ss << " If you don't want to enable exceptions then you should try to determine why"; \ - ss << " this exception was thrown and make sure it doesn't happen again. If it was"; \ - ss << " due to something like an invalid argument to a function then you should be"; \ - ss << " able to fix it quite easily by validating parameters as appropriate. More"; \ - ss << " complex exception scenarios (out of memory, etc) might be harder to fix and"; \ - ss << " you should replace this default handler with something which is more"; \ - ss << " meaningful to your users."; \ - ss << "\n"; \ - ss << " Exception details"; \ - ss << " -----------------"; \ - ss << " Line: " << line; \ - ss << " File: " << file; \ - ss << " Message: " << e.what(); \ - ss << "\n"; \ - PolyVox::Impl::getLoggerInstance()->logFatalMessage(ss.str()); \ - POLYVOX_HALT(); \ - } - - ThrowHandler& getThrowHandlerInstance() - { - static ThrowHandler s_fThrowHandler = &defaultThrowHandler; - return s_fThrowHandler; - } - - ThrowHandler getThrowHandler() - { - return getThrowHandlerInstance(); - } - - void setThrowHandler(ThrowHandler fNewHandler) - { - getThrowHandlerInstance() = fNewHandler; - } -#endif -} diff --git a/library/PolyVoxCore/source/Impl/Logging.cpp b/library/PolyVoxCore/source/Impl/Logging.cpp deleted file mode 100644 index 74712bb8..00000000 --- a/library/PolyVoxCore/source/Impl/Logging.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams and Matthew Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#include "PolyVoxCore/Impl/Logging.h" - -namespace PolyVox -{ - namespace Impl - { - // Perhaps read this note when we want to move everything - // to the header file: http://stackoverflow.com/a/7834555 - Logger*& getLoggerInstance() - { - static Logger* s_pLogger = new DefaultLogger; - return s_pLogger; - } - } - - void setLogger(Logger* pLogger) - { - Impl::getLoggerInstance() = pLogger; - } -} diff --git a/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp b/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp deleted file mode 100644 index 15769007..00000000 --- a/library/PolyVoxCore/source/Impl/MarchingCubesTables.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-2009 David Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -//These tables were based on the article "Polygonising a scalar field". -//They have been optimised to allow a more efficient algorithm via bitwise operations. - -// http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/index.html - -#include "PolyVoxCore/Impl/MarchingCubesTables.h" - -namespace PolyVox -{ - const uint16_t edgeTable[256]= - { - 0x000, 0x109, 0x203, 0x30a, 0x80c, 0x905, 0xa0f, 0xb06, - 0x406, 0x50f, 0x605, 0x70c, 0xc0a, 0xd03, 0xe09, 0xf00, - 0x190, 0x099, 0x393, 0x29a, 0x99c, 0x895, 0xb9f, 0xa96, - 0x596, 0x49f, 0x795, 0x69c, 0xd9a, 0xc93, 0xf99, 0xe90, - 0x230, 0x339, 0x033, 0x13a, 0xa3c, 0xb35, 0x83f, 0x936, - 0x636, 0x73f, 0x435, 0x53c, 0xe3a, 0xf33, 0xc39, 0xd30, - 0x3a0, 0x2a9, 0x1a3, 0x0aa, 0xbac, 0xaa5, 0x9af, 0x8a6, - 0x7a6, 0x6af, 0x5a5, 0x4ac, 0xfaa, 0xea3, 0xda9, 0xca0, - 0x8c0, 0x9c9, 0xac3, 0xbca, 0x0cc, 0x1c5, 0x2cf, 0x3c6, - 0xcc6, 0xdcf, 0xec5, 0xfcc, 0x4ca, 0x5c3, 0x6c9, 0x7c0, - 0x950, 0x859, 0xb53, 0xa5a, 0x15c, 0x055, 0x35f, 0x256, - 0xd56, 0xc5f, 0xf55, 0xe5c, 0x55a, 0x453, 0x759, 0x650, - 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0x2fc, 0x3f5, 0x0ff, 0x1f6, - 0xef6, 0xfff, 0xcf5, 0xdfc, 0x6fa, 0x7f3, 0x4f9, 0x5f0, - 0xb60, 0xa69, 0x963, 0x86a, 0x36c, 0x265, 0x16f, 0x066, - 0xf66, 0xe6f, 0xd65, 0xc6c, 0x76a, 0x663, 0x569, 0x460, - 0x460, 0x569, 0x663, 0x76a, 0xc6c, 0xd65, 0xe6f, 0xf66, - 0x066, 0x16f, 0x265, 0x36c, 0x86a, 0x963, 0xa69, 0xb60, - 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0xdfc, 0xcf5, 0xfff, 0xef6, - 0x1f6, 0x0ff, 0x3f5, 0x2fc, 0x9fa, 0x8f3, 0xbf9, 0xaf0, - 0x650, 0x759, 0x453, 0x55a, 0xe5c, 0xf55, 0xc5f, 0xd56, - 0x256, 0x35f, 0x055, 0x15c, 0xa5a, 0xb53, 0x859, 0x950, - 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0xfcc, 0xec5, 0xdcf, 0xcc6, - 0x3c6, 0x2cf, 0x1c5, 0x0cc, 0xbca, 0xac3, 0x9c9, 0x8c0, - 0xca0, 0xda9, 0xea3, 0xfaa, 0x4ac, 0x5a5, 0x6af, 0x7a6, - 0x8a6, 0x9af, 0xaa5, 0xbac, 0x0aa, 0x1a3, 0x2a9, 0x3a0, - 0xd30, 0xc39, 0xf33, 0xe3a, 0x53c, 0x435, 0x73f, 0x636, - 0x936, 0x83f, 0xb35, 0xa3c, 0x13a, 0x033, 0x339, 0x230, - 0xe90, 0xf99, 0xc93, 0xd9a, 0x69c, 0x795, 0x49f, 0x596, - 0xa96, 0xb9f, 0x895, 0x99c, 0x29a, 0x393, 0x099, 0x190, - 0xf00, 0xe09, 0xd03, 0xc0a, 0x70c, 0x605, 0x50f, 0x406, - 0xb06, 0xa0f, 0x905, 0x80c, 0x30a, 0x203, 0x109, 0x000 - }; - - const int8_t triTable[256][16] = - { - {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, }, - { 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, }, - { 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, }, - { 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, }, - { 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, }, - { 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, }, - {10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, }, - { 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, }, - { 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, }, - { 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, }, - {11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, }, - {10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, }, - { 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, }, - { 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, }, - { 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, }, - {11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, }, - {11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, }, - {10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, }, - { 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, }, - {10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, }, - {10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, }, - { 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, }, - { 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, }, - { 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, }, - { 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, }, - { 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, }, - { 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, }, - {10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, }, - { 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, }, - {10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, }, - {10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, }, - {11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, }, - { 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, }, - { 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, }, - { 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, }, - { 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, }, - { 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, }, - { 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, }, - { 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, }, - { 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, }, - { 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, }, - { 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, }, - { 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, }, - { 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, }, - { 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, }, - { 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, }, - { 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, }, - { 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, }, - {11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, }, - { 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, }, - { 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, }, - {10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, }, - { 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, }, - { 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, }, - { 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, }, - { 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, }, - { 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, }, - {10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, }, - { 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, }, - { 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, }, - { 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, }, - { 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, }, - { 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, }, - { 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, }, - { 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, }, - { 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, }, - { 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, }, - { 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, }, - {10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, }, - {10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, }, - {10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, }, - { 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, }, - { 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, }, - { 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, }, - { 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, }, - { 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, }, - { 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, }, - { 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, }, - {10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, }, - {10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, }, - { 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, }, - { 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, }, - {11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, }, - { 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, }, - { 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, }, - { 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, }, - { 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, }, - { 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, }, - {10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, }, - { 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, }, - { 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, }, - { 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, }, - {11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, }, - { 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, }, - { 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, }, - { 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, }, - { 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, }, - { 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, }, - {10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, }, - { 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, }, - { 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, }, - { 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, }, - { 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, }, - { 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, }, - { 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, }, - { 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, }, - { 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, }, - { 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, }, - { 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, }, - { 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, }, - { 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, }, - { 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, }, - { 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, }, - { 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, }, - {11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, }, - {11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, }, - { 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, }, - { 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, }, - { 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, }, - { 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, }, - { 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - { 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }, - {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, } - }; -} diff --git a/library/PolyVoxCore/source/Impl/Timer.cpp b/library/PolyVoxCore/source/Impl/Timer.cpp deleted file mode 100644 index a0d3c102..00000000 --- a/library/PolyVoxCore/source/Impl/Timer.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* -Copyright (c) 2005-20013 David Williams and Matthew Williams - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. -*******************************************************************************/ - -#include "PolyVoxCore/Impl/Timer.h" - -#include "PolyVoxCore/Impl/ErrorHandling.h" - -#include - -namespace PolyVox -{ -#if defined(_MSC_VER) - Timer::Timer(bool bAutoStart) - :m_fPCFreq(0.0) - ,m_iStartTime(0) - { - if(bAutoStart) - { - start(); - } - } - - void Timer::start(void) - { - LARGE_INTEGER li; - if(!QueryPerformanceFrequency(&li)) - { - POLYVOX_LOG_WARNING("QueryPerformanceFrequency failed!"); - m_fPCFreq = 1.0f; - } - - m_fPCFreq = double(li.QuadPart); - - QueryPerformanceCounter(&li); - m_iStartTime = li.QuadPart; - } - - float Timer::elapsedTimeInSeconds(void) - { - LARGE_INTEGER li; - QueryPerformanceCounter(&li); - double fDifference = static_cast(li.QuadPart-m_iStartTime); - return static_cast(fDifference / m_fPCFreq); - } - - uint32_t Timer::elapsedTimeInMilliSeconds(void) - { - return static_cast(elapsedTimeInSeconds() * 1000.0f); - } - - uint32_t Timer::elapsedTimeInMicroSeconds(void) - { - return static_cast(elapsedTimeInSeconds() * 1000000.0f); - } -#else //_MSC_VER - Timer::Timer(bool bAutoStart) - { - if(bAutoStart) - { - start(); - } - } - - void Timer::start(void) - { - m_start = clock::now(); - } - - float Timer::elapsedTimeInSeconds(void) - { - std::chrono::duration elapsed_seconds = clock::now() - m_start; - return elapsed_seconds.count(); - } - - uint32_t Timer::elapsedTimeInMilliSeconds(void) - { - std::chrono::duration elapsed_milliseconds = clock::now() - m_start; - return elapsed_milliseconds.count(); - } - - uint32_t Timer::elapsedTimeInMicroSeconds(void) - { - std::chrono::duration elapsed_microseconds = clock::now() - m_start; - return elapsed_microseconds.count(); - } -#endif //_MSC_VER -} diff --git a/library/PolyVoxUtil/CMakeLists.txt b/library/PolyVoxUtil/CMakeLists.txt deleted file mode 100644 index b542e068..00000000 --- a/library/PolyVoxUtil/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (c) 2008-2012 Matt Williams -# Copyright (c) 2008-2012 David Williams -# -# This software is provided 'as-is', without any express or implied -# warranty. In no event will the authors be held liable for any damages -# arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, -# including commercial applications, and to alter it and redistribute it -# freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not -# claim that you wrote the original software. If you use this software -# in a product, an acknowledgment in the product documentation would be -# appreciated but is not required. -# -# 2. Altered source versions must be plainly marked as such, and must not be -# misrepresented as being the original software. -# -# 3. This notice may not be removed or altered from any source -# distribution. - -PROJECT(PolyVoxUtil) - -#Projects source files -SET(UTIL_SRC_FILES - source/Dummy.cpp -) - -#Projects headers files -SET(UTIL_INC_FILES - #Nothing here at the moment... -) - -ADD_DEFINITIONS(-DPOLYVOX_SHARED_EXPORTS) #Export symbols in the .dll - -#"Sources" and "Headers" are the group names in Visual Studio. -#They may have other uses too... -SOURCE_GROUP("Source Files" FILES ${UTIL_SRC_FILES}) -SOURCE_GROUP("Header Files" FILES ${UTIL_INC_FILES}) - -#Tell CMake the paths -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${PolyVoxCore_BINARY_DIR}/include ${PolyVoxCore_SOURCE_DIR}/include) -#There has to be a better way! -LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR}/debug ${PolyVoxCore_BINARY_DIR}/release ${PolyVoxCore_BINARY_DIR}) - -#Util -#Build -IF(LIBRARY_TYPE STREQUAL "STATIC") - ADD_LIBRARY(PolyVoxUtil STATIC ${UTIL_SRC_FILES} ${UTIL_INC_FILES}) - IF(UNIX) - SET_TARGET_PROPERTIES(PolyVoxCore PROPERTIES COMPILE_FLAGS -fPIC) - ENDIF() -ENDIF() -IF(LIBRARY_TYPE STREQUAL "DYNAMIC") - ADD_LIBRARY(PolyVoxUtil SHARED ${UTIL_SRC_FILES} ${UTIL_INC_FILES}) - SET_TARGET_PROPERTIES(PolyVoxUtil PROPERTIES COMPILE_FLAGS "-DPOLYVOX_SHARED_EXPORTS") -ENDIF() -SET_PROPERTY(TARGET PolyVoxUtil PROPERTY FOLDER "Library") - -TARGET_LINK_LIBRARIES(PolyVoxUtil PolyVoxCore) -SET_TARGET_PROPERTIES(PolyVoxUtil PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR}) -IF(MSVC) - SET_TARGET_PROPERTIES(PolyVoxUtil PROPERTIES COMPILE_FLAGS "/W4 /wd4251 /wd4127") #Disable warning on STL exports -ENDIF(MSVC) - -#Install -IF(WIN32) - INSTALL(TARGETS PolyVoxUtil - RUNTIME DESTINATION PolyVoxUtil/bin COMPONENT library - LIBRARY DESTINATION PolyVoxUtil/lib COMPONENT library - ARCHIVE DESTINATION PolyVoxUtil/lib COMPONENT library - ) - - #Install the util header files. - INSTALL(DIRECTORY include DESTINATION PolyVoxUtil COMPONENT development PATTERN "*.svn*" EXCLUDE) - - #On windows, we also install the debug information. It's unfortunate that we have to hard-code - #the 'Debug' part of the path, but CMake doesn't seem to provide a way around this. The best I - #found was: http://www.cmake.org/pipermail/cmake/2007-October/016924.html (and it is a bit ugly). - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/PolyVoxUtil.pdb DESTINATION PolyVoxUtil/lib CONFIGURATIONS Debug) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/PolyVoxUtil.pdb DESTINATION PolyVoxUtil/lib CONFIGURATIONS RelWithDebInfo) -ELSE(WIN32) - INSTALL(TARGETS PolyVoxUtil - RUNTIME DESTINATION bin COMPONENT library - LIBRARY DESTINATION lib COMPONENT library - ARCHIVE DESTINATION lib COMPONENT library - ) - - #Install the util header files. - INSTALL(DIRECTORY include/ DESTINATION include/PolyVoxUtil COMPONENT development PATTERN "*.svn*" EXCLUDE) -ENDIF(WIN32) diff --git a/library/PolyVoxUtil/include/PolyVoxUtil/Placeholder.txt b/library/PolyVoxUtil/include/PolyVoxUtil/Placeholder.txt deleted file mode 100644 index eb0a80de..00000000 --- a/library/PolyVoxUtil/include/PolyVoxUtil/Placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -I don't think Git allows empty directories, so this is just a placeholder until we decide what to do with PolyVoxUtil. \ No newline at end of file diff --git a/library/PolyVoxUtil/source/Dummy.cpp b/library/PolyVoxUtil/source/Dummy.cpp deleted file mode 100644 index 73e5e376..00000000 --- a/library/PolyVoxUtil/source/Dummy.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "PolyVoxCore/Impl/TypeDef.h" - -namespace PolyVox -{ - class POLYVOX_API DummyClass - { - public: - int getx(void); - int x; - }; - - int DummyClass::getx(void) - { - return x; - } -} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fbffe9d9..bccadd75 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -27,9 +27,8 @@ MACRO(CREATE_TEST headerfile sourcefile executablename) UNSET(test_moc_SRCS) #clear out the MOCs from previous tests QT4_WRAP_CPP(test_moc_SRCS ${headerfile}) - LINK_DIRECTORIES(${PolyVoxCore_BINARY_DIR} ${PolyVoxUtil_BINARY_DIR}) ADD_EXECUTABLE(${executablename} ${sourcefile} ${test_moc_SRCS}) - TARGET_LINK_LIBRARIES(${executablename} PolyVoxCore PolyVoxUtil ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY}) + TARGET_LINK_LIBRARIES(${executablename} ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY}) #HACK. This is needed since everything is built in the base dir in Windows. As of 2.8 we should change this. IF(WIN32) SET(LATEST_TEST ${EXECUTABLE_OUTPUT_PATH}/${executablename}) @@ -45,7 +44,7 @@ MACRO(CREATE_TEST headerfile sourcefile executablename) ENDIF() ENDMACRO(CREATE_TEST) -INCLUDE_DIRECTORIES(${PolyVoxCore_BINARY_DIR}/include ${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR}) +INCLUDE_DIRECTORIES(${PolyVoxHeaders_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) REMOVE_DEFINITIONS(-DQT_GUI_LIB) #Make sure the tests don't link to the QtGui # Test Template. Copy and paste this template for consistant naming. diff --git a/tests/TestAStarPathfinder.cpp b/tests/TestAStarPathfinder.cpp index 15c118d7..c6c52da0 100644 --- a/tests/TestAStarPathfinder.cpp +++ b/tests/TestAStarPathfinder.cpp @@ -23,9 +23,9 @@ freely, subject to the following restrictions: #include "TestAStarPathfinder.h" -#include "PolyVoxCore/AStarPathfinder.h" -#include "PolyVoxCore/Material.h" -#include "PolyVoxCore/RawVolume.h" +#include "PolyVox/AStarPathfinder.h" +#include "PolyVox/Material.h" +#include "PolyVox/RawVolume.h" #include diff --git a/tests/TestAmbientOcclusionGenerator.cpp b/tests/TestAmbientOcclusionGenerator.cpp index 97ab7993..253af603 100644 --- a/tests/TestAmbientOcclusionGenerator.cpp +++ b/tests/TestAmbientOcclusionGenerator.cpp @@ -23,8 +23,8 @@ freely, subject to the following restrictions: #include "TestAmbientOcclusionGenerator.h" -#include "PolyVoxCore/AmbientOcclusionCalculator.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/AmbientOcclusionCalculator.h" +#include "PolyVox/PagedVolume.h" #include diff --git a/tests/TestArray.cpp b/tests/TestArray.cpp index 13aeaee1..5c3a5bfb 100644 --- a/tests/TestArray.cpp +++ b/tests/TestArray.cpp @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "TestArray.h" -#include "PolyVoxCore/Array.h" +#include "PolyVox/Array.h" #include diff --git a/tests/TestCubicSurfaceExtractor.cpp b/tests/TestCubicSurfaceExtractor.cpp index 61398777..0b12bb34 100644 --- a/tests/TestCubicSurfaceExtractor.cpp +++ b/tests/TestCubicSurfaceExtractor.cpp @@ -23,12 +23,12 @@ freely, subject to the following restrictions: #include "TestCubicSurfaceExtractor.h" -#include "PolyVoxCore/Density.h" -#include "PolyVoxCore/Material.h" -#include "PolyVoxCore/MaterialDensityPair.h" -#include "PolyVoxCore/RawVolume.h" -#include "PolyVoxCore/PagedVolume.h" -#include "PolyVoxCore/CubicSurfaceExtractor.h" +#include "PolyVox/Density.h" +#include "PolyVox/Material.h" +#include "PolyVox/MaterialDensityPair.h" +#include "PolyVox/RawVolume.h" +#include "PolyVox/PagedVolume.h" +#include "PolyVox/CubicSurfaceExtractor.h" #include diff --git a/tests/TestLowPassFilter.cpp b/tests/TestLowPassFilter.cpp index 5af198b9..849cf927 100644 --- a/tests/TestLowPassFilter.cpp +++ b/tests/TestLowPassFilter.cpp @@ -23,9 +23,9 @@ freely, subject to the following restrictions: #include "TestLowPassFilter.h" -#include "PolyVoxCore/Density.h" -#include "PolyVoxCore/LowPassFilter.h" -#include "PolyVoxCore/RawVolume.h" +#include "PolyVox/Density.h" +#include "PolyVox/LowPassFilter.h" +#include "PolyVox/RawVolume.h" #include diff --git a/tests/TestPicking.cpp b/tests/TestPicking.cpp index fa255b55..78f2b5c6 100644 --- a/tests/TestPicking.cpp +++ b/tests/TestPicking.cpp @@ -23,8 +23,8 @@ freely, subject to the following restrictions: #include "TestPicking.h" -#include "PolyVoxCore/Picking.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/Picking.h" +#include "PolyVox/PagedVolume.h" #include diff --git a/tests/TestRaycast.cpp b/tests/TestRaycast.cpp index a7b148fa..655d2b0b 100644 --- a/tests/TestRaycast.cpp +++ b/tests/TestRaycast.cpp @@ -23,11 +23,11 @@ freely, subject to the following restrictions: #include "TestRaycast.h" -#include "PolyVoxCore/Density.h" -#include "PolyVoxCore/Raycast.h" -#include "PolyVoxCore/PagedVolume.h" +#include "PolyVox/Density.h" +#include "PolyVox/Raycast.h" +#include "PolyVox/PagedVolume.h" -#include "PolyVoxCore/Impl/RandomUnitVectors.h" +#include "PolyVox/Impl/RandomUnitVectors.h" #include diff --git a/tests/TestRegion.cpp b/tests/TestRegion.cpp index a0f74913..12a100a1 100644 --- a/tests/TestRegion.cpp +++ b/tests/TestRegion.cpp @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "TestRegion.h" -#include "PolyVoxCore/Region.h" +#include "PolyVox/Region.h" #include diff --git a/tests/TestSurfaceExtractor.cpp b/tests/TestSurfaceExtractor.cpp index 92e28755..bbdca389 100644 --- a/tests/TestSurfaceExtractor.cpp +++ b/tests/TestSurfaceExtractor.cpp @@ -23,12 +23,12 @@ freely, subject to the following restrictions: #include "TestSurfaceExtractor.h" -#include "PolyVoxCore/Density.h" -#include "PolyVoxCore/FilePager.h" -#include "PolyVoxCore/MaterialDensityPair.h" -#include "PolyVoxCore/RawVolume.h" -#include "PolyVoxCore/PagedVolume.h" -#include "PolyVoxCore/MarchingCubesSurfaceExtractor.h" +#include "PolyVox/Density.h" +#include "PolyVox/FilePager.h" +#include "PolyVox/MaterialDensityPair.h" +#include "PolyVox/RawVolume.h" +#include "PolyVox/PagedVolume.h" +#include "PolyVox/MarchingCubesSurfaceExtractor.h" #include diff --git a/tests/TestVolumeSubclass.cpp b/tests/TestVolumeSubclass.cpp index 9be146d4..0a301e3e 100644 --- a/tests/TestVolumeSubclass.cpp +++ b/tests/TestVolumeSubclass.cpp @@ -23,12 +23,12 @@ freely, subject to the following restrictions: #include "TestVolumeSubclass.h" -#include "PolyVoxCore/Array.h" +#include "PolyVox/Array.h" -#include "PolyVoxCore/BaseVolume.h" -#include "PolyVoxCore/CubicSurfaceExtractor.h" -#include "PolyVoxCore/Material.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/BaseVolume.h" +#include "PolyVox/CubicSurfaceExtractor.h" +#include "PolyVox/Material.h" +#include "PolyVox/Vector.h" #include diff --git a/tests/testmaterial.cpp b/tests/testmaterial.cpp index a4662e34..4e8b6843 100644 --- a/tests/testmaterial.cpp +++ b/tests/testmaterial.cpp @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "testmaterial.h" -#include "PolyVoxCore/Material.h" +#include "PolyVox/Material.h" #include diff --git a/tests/testvector.cpp b/tests/testvector.cpp index 08649f28..61aa4760 100644 --- a/tests/testvector.cpp +++ b/tests/testvector.cpp @@ -23,7 +23,7 @@ freely, subject to the following restrictions: #include "testvector.h" -#include "PolyVoxCore/Vector.h" +#include "PolyVox/Vector.h" #include diff --git a/tests/testvolume.cpp b/tests/testvolume.cpp index 3eafceb2..df2a3a97 100644 --- a/tests/testvolume.cpp +++ b/tests/testvolume.cpp @@ -23,9 +23,9 @@ freely, subject to the following restrictions: #include "testvolume.h" -#include "PolyVoxCore/FilePager.h" -#include "PolyVoxCore/PagedVolume.h" -#include "PolyVoxCore/RawVolume.h" +#include "PolyVox/FilePager.h" +#include "PolyVox/PagedVolume.h" +#include "PolyVox/RawVolume.h" #include #include diff --git a/tests/testvolume.h b/tests/testvolume.h index ea1a1d0b..41ec64dd 100644 --- a/tests/testvolume.h +++ b/tests/testvolume.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_TestVolume_H__ #define __PolyVox_TestVolume_H__ -#include "PolyVoxCore/PolyVoxForwardDeclarations.h" +#include "PolyVox/PolyVoxForwardDeclarations.h" #include