diff --git a/CMakeLists.txt b/CMakeLists.txt index f3cfd05c..48b62a80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(PolyVox) ADD_SUBDIRECTORY(PolyVoxCore) +ADD_SUBDIRECTORY(PolyVoxUtil) ADD_SUBDIRECTORY(examples/OpenGL) -ADD_DEPENDENCIES(OpenGLExample PolyVoxCore) \ No newline at end of file +ADD_DEPENDENCIES(OpenGLExample PolyVoxCore PolyVoxUtil) \ No newline at end of file diff --git a/PolyVoxCore/CMakeLists.txt b/PolyVoxCore/CMakeLists.txt index e5d887ab..d768570a 100644 --- a/PolyVoxCore/CMakeLists.txt +++ b/PolyVoxCore/CMakeLists.txt @@ -19,7 +19,6 @@ SET(SRC_FILES source/SurfaceExtractorsDecimated.cpp source/SurfaceVertex.cpp source/Utility.cpp - source/VolumeChangeTracker.cpp source/VoxelFilters.cpp ) @@ -51,7 +50,6 @@ SET(INC_FILES include/Utility.h include/Vector.h include/Vector.inl - include/VolumeChangeTracker.h include/VoxelFilters.h ) diff --git a/PolyVoxCore/include/PolyVoxForwardDeclarations.h b/PolyVoxCore/include/PolyVoxForwardDeclarations.h index 4bb7667d..1e8afd7b 100644 --- a/PolyVoxCore/include/PolyVoxForwardDeclarations.h +++ b/PolyVoxCore/include/PolyVoxForwardDeclarations.h @@ -55,7 +55,6 @@ namespace PolyVox typedef Vector<3,uint32> Vector3DUint32; //---------------------------- - class VolumeChangeTracker; template class BlockVolumeIterator; } diff --git a/PolyVoxCore/include/SurfaceExtractors.h b/PolyVoxCore/include/SurfaceExtractors.h index 8b0a95a8..95255c8b 100644 --- a/PolyVoxCore/include/SurfaceExtractors.h +++ b/PolyVoxCore/include/SurfaceExtractors.h @@ -34,8 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace PolyVox { - POLYVOX_API std::list getChangedRegionGeometry(VolumeChangeTracker& volume); - uint32 getIndex(uint32 x, uint32 y); POLYVOX_API void generateRoughMeshDataForRegion(BlockVolume* volumeData, Region region, IndexedSurfacePatch* singleMaterialPatch); diff --git a/PolyVoxCore/source/SurfaceExtractors.cpp b/PolyVoxCore/source/SurfaceExtractors.cpp index cf0d15ee..05b0bf37 100644 --- a/PolyVoxCore/source/SurfaceExtractors.cpp +++ b/PolyVoxCore/source/SurfaceExtractors.cpp @@ -8,7 +8,6 @@ #include "RegionGeometry.h" #include "SurfaceAdjusters.h" #include "SurfaceExtractorsDecimated.h" -#include "VolumeChangeTracker.h" #include "BlockVolumeIterator.h" #include @@ -17,50 +16,6 @@ using namespace std; namespace PolyVox { - std::list getChangedRegionGeometry(VolumeChangeTracker& volume) - { - std::list listChangedRegions; - volume.getChangedRegions(listChangedRegions); - - std::list listChangedRegionGeometry; - for(std::list::const_iterator iterChangedRegions = listChangedRegions.begin(); iterChangedRegions != listChangedRegions.end(); ++iterChangedRegions) - { - //Generate the surface - RegionGeometry regionGeometry; - regionGeometry.m_patchSingleMaterial = new IndexedSurfacePatch(); - regionGeometry.m_v3dRegionPosition = iterChangedRegions->getLowerCorner(); - - //generateDecimatedMeshDataForRegion(volume.getVolumeData(), 1, *iterChangedRegions, regionGeometry.m_patchSingleMaterial); - - generateReferenceMeshDataForRegion(volume.getVolumeData(), *iterChangedRegions, regionGeometry.m_patchSingleMaterial); - - //for(int ct = 0; ct < 2; ct++) - Vector3DInt32 temp = regionGeometry.m_v3dRegionPosition; - //temp /= 16; - /*if(temp.getY() % 32 == 0) - { - //smoothRegionGeometry(volume.getVolumeData(), regionGeometry); - generateDecimatedMeshDataForRegion(volume.getVolumeData(), 0, *iterChangedRegions, regionGeometry.m_patchSingleMaterial); - } - else - { - generateDecimatedMeshDataForRegion(volume.getVolumeData(), 1, *iterChangedRegions, regionGeometry.m_patchSingleMaterial); - //adjustDecimatedGeometry(volume.getVolumeData(), regionGeometry, 1); - }*/ - - //computeNormalsForVertices(volume.getVolumeData(), regionGeometry, CENTRAL_DIFFERENCE); - - //genMultiFromSingle(regionGeometry.m_patchSingleMaterial, regionGeometry.m_patchMultiMaterial); - - regionGeometry.m_bContainsSingleMaterialPatch = regionGeometry.m_patchSingleMaterial->getVertices().size() > 0; - regionGeometry.m_bIsEmpty = (regionGeometry.m_patchSingleMaterial->getVertices().size() == 0) || (regionGeometry.m_patchSingleMaterial->getIndices().size() == 0); - - listChangedRegionGeometry.push_back(regionGeometry); - } - - return listChangedRegionGeometry; - } - uint32 getIndex(uint32 x, uint32 y) { return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1)); diff --git a/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp b/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp index d83d25d2..280ad5d3 100644 --- a/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp +++ b/PolyVoxCore/source/SurfaceExtractorsDecimated.cpp @@ -6,9 +6,10 @@ #include "MarchingCubesTables.h" #include "Region.h" #include "RegionGeometry.h" -#include "VolumeChangeTracker.h" #include "BlockVolumeIterator.h" +#include "../../PolyVoxUtil/include/VolumeChangeTracker.h" + #include using namespace std; diff --git a/PolyVoxUtil/CMakeLists.txt b/PolyVoxUtil/CMakeLists.txt new file mode 100644 index 00000000..9b77032f --- /dev/null +++ b/PolyVoxUtil/CMakeLists.txt @@ -0,0 +1,48 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +PROJECT(PolyVoxUtil) + +SET(POLYVOX_VERSION_MAJOR "0") +SET(POLYVOX_VERSION_MINOR "1") +SET(POLYVOX_VERSION_PATCH "0") +SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}") + +#Projects source files +SET(SRC_FILES + source/VolumeChangeTracker.cpp +) + +#Projects headers files +SET(INC_FILES + include/VolumeChangeTracker.h +) + +ADD_DEFINITIONS(-DPOLYVOX_EXPORT) #Export symbols in the .dll + +#Appends "_d" to the generated library when in debug mode +SET(CMAKE_DEBUG_POSTFIX "_d") + +#"Sources" and "Headers" are the group names in Visual Studio. +#They may have other uses too... +SOURCE_GROUP("Sources" FILES ${SRC_FILES}) +SOURCE_GROUP("Headers" FILES ${INC_FILES}) + +#Tell CMake the paths +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) + +#Build +ADD_LIBRARY(PolyVoxUtil SHARED ${SRC_FILES} ${INC_FILES}) +TARGET_LINK_LIBRARIES(PolyVoxUtil PolyVoxCore) +SET_TARGET_PROPERTIES(PolyVoxUtil PROPERTIES VERSION ${POLYVOX_VERSION} SOVERSION ${POLYVOX_VERSION_MAJOR}) +IF(WIN32) + SET_TARGET_PROPERTIES(PolyVoxUtil PROPERTIES COMPILE_FLAGS "/wd4251") #Disable warning on STL exports +ENDIF(WIN32) + +#Install +INSTALL(TARGETS PolyVoxUtil + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +INSTALL(FILES ${INC_FILES} DESTINATION include/PolyVoxUtil) diff --git a/PolyVoxCore/include/VolumeChangeTracker.h b/PolyVoxUtil/include/VolumeChangeTracker.h similarity index 88% rename from PolyVoxCore/include/VolumeChangeTracker.h rename to PolyVoxUtil/include/VolumeChangeTracker.h index 307a5c0c..7c138173 100644 --- a/PolyVoxCore/include/VolumeChangeTracker.h +++ b/PolyVoxUtil/include/VolumeChangeTracker.h @@ -24,12 +24,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include -#include "PolyVoxCStdInt.h" - -#include "Constants.h" -#include "PolyVoxForwardDeclarations.h" -#include "Region.h" -#include "TypeDef.h" +#include "../../PolyVoxCore/include/Constants.h" +#include "../../PolyVoxCore/include/PolyVoxForwardDeclarations.h" +#include "../../PolyVoxCore/include/Region.h" +#include "../../PolyVoxCore/include/TypeDef.h" namespace PolyVox { diff --git a/PolyVoxCore/source/VolumeChangeTracker.cpp b/PolyVoxUtil/source/VolumeChangeTracker.cpp similarity index 90% rename from PolyVoxCore/source/VolumeChangeTracker.cpp rename to PolyVoxUtil/source/VolumeChangeTracker.cpp index 79431099..eb5df9c3 100644 --- a/PolyVoxCore/source/VolumeChangeTracker.cpp +++ b/PolyVoxUtil/source/VolumeChangeTracker.cpp @@ -19,18 +19,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ******************************************************************************/ #pragma endregion -#include "GradientEstimators.h" -#include "IndexedSurfacePatch.h" -#include "LinearVolume.h" -#include "MarchingCubesTables.h" #include "VolumeChangeTracker.h" -#include "RegionGeometry.h" -#include "SurfaceExtractors.h" -#include "SurfaceVertex.h" -#include "Utility.h" -#include "Vector.h" -#include "BlockVolume.h" -#include "BlockVolumeIterator.h" + +#include "../../PolyVoxCore/include/GradientEstimators.h" +#include "../../PolyVoxCore/include/IndexedSurfacePatch.h" +#include "../../PolyVoxCore/include/LinearVolume.h" +#include "../../PolyVoxCore/include/MarchingCubesTables.h" +#include "../../PolyVoxCore/include/RegionGeometry.h" +#include "../../PolyVoxCore/include/SurfaceExtractors.h" +#include "../../PolyVoxCore/include/SurfaceVertex.h" +#include "../../PolyVoxCore/include/Utility.h" +#include "../../PolyVoxCore/include/Vector.h" +#include "../../PolyVoxCore/include/BlockVolume.h" +#include "../../PolyVoxCore/include/BlockVolumeIterator.h" using namespace std;