Merge branch 'feature/opengl' into develop
This commit is contained in:
commit
28c516b5ad
@ -1,5 +1,5 @@
|
|||||||
# Copyright (c) 2007-2014 Matt Williams
|
# Copyright (c) 2007-2012 Matt Williams
|
||||||
# Copyright (c) 2007-2014 David Williams
|
# Copyright (c) 2007-2012 David Williams
|
||||||
#
|
#
|
||||||
# This software is provided 'as-is', without any express or implied
|
# This software is provided 'as-is', without any express or implied
|
||||||
# warranty. In no event will the authors be held liable for any damages
|
# warranty. In no event will the authors be held liable for any damages
|
||||||
@ -24,63 +24,67 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)
|
|||||||
|
|
||||||
PROJECT(PolyVox)
|
PROJECT(PolyVox)
|
||||||
|
|
||||||
include(FeatureSummary)
|
|
||||||
|
|
||||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
||||||
|
|
||||||
#Set up for building the library itself
|
|
||||||
|
|
||||||
SET(POLYVOX_VERSION_MAJOR "0")
|
SET(POLYVOX_VERSION_MAJOR "0")
|
||||||
SET(POLYVOX_VERSION_MINOR "2")
|
SET(POLYVOX_VERSION_MINOR "2")
|
||||||
SET(POLYVOX_VERSION_PATCH "1")
|
SET(POLYVOX_VERSION_PATCH "1")
|
||||||
SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}" CACHE STRING "PolyVox version")
|
SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}" CACHE STRING "PolyVox version")
|
||||||
MARK_AS_ADVANCED(FORCE POLYVOX_VERSION)
|
MARK_AS_ADVANCED(FORCE POLYVOX_VERSION)
|
||||||
|
|
||||||
|
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
include(FeatureSummary)
|
||||||
|
|
||||||
|
FIND_PACKAGE(Doxygen)
|
||||||
|
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
||||||
|
|
||||||
SET(LIBRARY_TYPE "DYNAMIC" CACHE STRING "Should the library be STATIC or DYNAMIC")
|
SET(LIBRARY_TYPE "DYNAMIC" CACHE STRING "Should the library be STATIC or DYNAMIC")
|
||||||
SET_PROPERTY(CACHE LIBRARY_TYPE PROPERTY STRINGS DYNAMIC STATIC)
|
SET_PROPERTY(CACHE LIBRARY_TYPE PROPERTY STRINGS DYNAMIC STATIC)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(LIBRARY_TYPE "STATIC")
|
SET(LIBRARY_TYPE "STATIC")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
# Qt is required for building the tests, the example and optionally for bundling the documentation
|
||||||
|
find_package(Qt5Test 5.2)
|
||||||
|
find_package(Qt5OpenGL 5.2)
|
||||||
|
|
||||||
|
set_package_properties(Doxygen PROPERTIES URL http://www.doxygen.org DESCRIPTION "API documentation generator" TYPE OPTIONAL PURPOSE "Building the API documentation")
|
||||||
|
set_package_properties(Qt5Test PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org)
|
||||||
|
set_package_properties(Qt5Test PROPERTIES TYPE OPTIONAL PURPOSE "Building the tests")
|
||||||
|
set_package_properties(Qt5OpenGL PROPERTIES DESCRIPTION "C++ framework" URL http://qt-project.org)
|
||||||
|
set_package_properties(Qt5OpenGL PROPERTIES TYPE RECOMMENDED PURPOSE "Building the examples")
|
||||||
|
|
||||||
|
IF(CMAKE_COMPILER_IS_GNUCXX) #Maybe "OR MINGW"
|
||||||
|
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
|
||||||
|
ENDIF()
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
|
ADD_DEFINITIONS(-std=c++0x) #Enable C++0x mode
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#We need to find doxygen before building the library
|
|
||||||
FIND_PACKAGE(Doxygen)
|
|
||||||
|
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(include)
|
ADD_SUBDIRECTORY(include)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Qt is required for building the tests, the example and optionally for bundling the documentation
|
|
||||||
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtTest)
|
|
||||||
INCLUDE(${QT_USE_FILE})
|
|
||||||
|
|
||||||
#Examples
|
|
||||||
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
OPTION(ENABLE_EXAMPLES "Should the examples be built" ON)
|
||||||
IF(ENABLE_EXAMPLES AND QT_QTOPENGL_FOUND)
|
IF(ENABLE_EXAMPLES AND Qt5OpenGL_FOUND)
|
||||||
|
ADD_SUBDIRECTORY(examples/Basic)
|
||||||
|
ADD_SUBDIRECTORY(examples/Paging)
|
||||||
|
ADD_SUBDIRECTORY(examples/OpenGL)
|
||||||
|
ADD_SUBDIRECTORY(examples/SmoothLOD)
|
||||||
|
ADD_SUBDIRECTORY(examples/Python)
|
||||||
SET(BUILD_EXAMPLES ON)
|
SET(BUILD_EXAMPLES ON)
|
||||||
add_subdirectory(examples)
|
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(BUILD_EXAMPLES OFF)
|
SET(BUILD_EXAMPLES OFF)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(Packaging.cmake)
|
INCLUDE(Packaging.cmake)
|
||||||
|
|
||||||
#Tests
|
|
||||||
OPTION(ENABLE_TESTS "Should the tests be built" ON)
|
OPTION(ENABLE_TESTS "Should the tests be built" ON)
|
||||||
IF(ENABLE_TESTS AND QT_QTTEST_FOUND)
|
IF(ENABLE_TESTS AND Qt5Test_FOUND)
|
||||||
SET(BUILD_TESTS ON)
|
|
||||||
INCLUDE(CTest)
|
INCLUDE(CTest)
|
||||||
MARK_AS_ADVANCED(FORCE BUILD_TESTING)
|
MARK_AS_ADVANCED(FORCE BUILD_TESTING)
|
||||||
ADD_SUBDIRECTORY(tests)
|
ADD_SUBDIRECTORY(tests)
|
||||||
|
SET(BUILD_TESTS ON)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(BUILD_TESTS OFF)
|
SET(BUILD_TESTS OFF)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#Manual
|
|
||||||
#Check if we will building _and_ bundling the docs
|
#Check if we will building _and_ bundling the docs
|
||||||
IF(DOXYGEN_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE)
|
IF(DOXYGEN_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE)
|
||||||
SET(BUILD_AND_BUNDLE_DOCS ON)
|
SET(BUILD_AND_BUNDLE_DOCS ON)
|
||||||
@ -92,11 +96,6 @@ ADD_SUBDIRECTORY(documentation)
|
|||||||
|
|
||||||
ADD_SUBDIRECTORY(bindings)
|
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)
|
|
||||||
set_package_properties(Qt4 PROPERTIES TYPE RECOMMENDED PURPOSE "Building the examples")
|
|
||||||
set_package_properties(Qt4 PROPERTIES TYPE OPTIONAL PURPOSE "Building the tests")
|
|
||||||
|
|
||||||
add_feature_info("Examples" BUILD_EXAMPLES "Examples of PolyVox usage")
|
add_feature_info("Examples" BUILD_EXAMPLES "Examples of PolyVox usage")
|
||||||
add_feature_info("Tests" BUILD_TESTS "Unit tests")
|
add_feature_info("Tests" BUILD_TESTS "Unit tests")
|
||||||
add_feature_info("Bindings" BUILD_BINDINGS "SWIG bindings")
|
add_feature_info("Bindings" BUILD_BINDINGS "SWIG bindings")
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
# 3. This notice may not be removed or altered from any source
|
# 3. This notice may not be removed or altered from any source
|
||||||
# distribution.
|
# distribution.
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
||||||
|
|
||||||
PROJECT(BasicExample)
|
PROJECT(BasicExample)
|
||||||
|
|
||||||
#Projects source files
|
#Projects source files
|
||||||
@ -31,18 +29,19 @@ SET(SRC_FILES
|
|||||||
|
|
||||||
#Projects headers files
|
#Projects headers files
|
||||||
SET(INC_FILES
|
SET(INC_FILES
|
||||||
OpenGLWidget.h
|
../common/OpenGLWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
|
#They may have other uses too...
|
||||||
FIND_PACKAGE(OpenGL REQUIRED)
|
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||||
|
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||||
|
|
||||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||||
|
|
||||||
#This will include the shader files inside the compiled binary
|
#This will include the shader files inside the compiled binary
|
||||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
|
|
||||||
# Put the resources in a seperate folder in Visual Studio
|
# Put the resources in a seperate folder in Visual Studio
|
||||||
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
||||||
@ -50,9 +49,9 @@ SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC
|
|||||||
#Build
|
#Build
|
||||||
ADD_EXECUTABLE(BasicExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
ADD_EXECUTABLE(BasicExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(BasicExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(BasicExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
TARGET_LINK_LIBRARIES(BasicExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
TARGET_LINK_LIBRARIES(BasicExample Qt5::OpenGL)
|
||||||
SET_PROPERTY(TARGET BasicExample PROPERTY FOLDER "Examples")
|
SET_PROPERTY(TARGET BasicExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
@ -63,4 +62,11 @@ IF(WIN32)
|
|||||||
ARCHIVE DESTINATION Examples/OpenGL/lib
|
ARCHIVE DESTINATION Examples/OpenGL/lib
|
||||||
COMPONENT example
|
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)
|
ENDIF(WIN32)
|
||||||
|
@ -34,12 +34,8 @@ SET(INC_FILES
|
|||||||
OpenGLWidget.h
|
OpenGLWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
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)
|
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR})
|
||||||
|
|
||||||
#This will include the shader files inside the compiled binary
|
#This will include the shader files inside the compiled binary
|
||||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
@ -53,7 +49,7 @@ ADD_EXECUTABLE(DecodeOnGPUExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${DECODE_
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(DecodeOnGPUExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(DecodeOnGPUExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
TARGET_LINK_LIBRARIES(DecodeOnGPUExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
TARGET_LINK_LIBRARIES(DecodeOnGPUExample ${QT_LIBRARIES})
|
||||||
SET_PROPERTY(TARGET DecodeOnGPUExample PROPERTY FOLDER "Examples")
|
SET_PROPERTY(TARGET DecodeOnGPUExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
|
@ -26,36 +26,43 @@ PROJECT(OpenGLExample)
|
|||||||
#Projects source files
|
#Projects source files
|
||||||
SET(SRC_FILES
|
SET(SRC_FILES
|
||||||
main.cpp
|
main.cpp
|
||||||
|
#OpenGLImmediateModeSupport.cpp
|
||||||
|
#OpenGLSupport.cpp
|
||||||
|
#OpenGLVertexBufferObjectSupport.cpp
|
||||||
../common/OpenGLWidget.cpp
|
../common/OpenGLWidget.cpp
|
||||||
Shapes.cpp
|
Shapes.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
#Projects headers files
|
#Projects headers files
|
||||||
SET(INC_FILES
|
SET(INC_FILES
|
||||||
OpenGLWidget.h
|
#OpenGLImmediateModeSupport.h
|
||||||
|
#OpenGLSupport.h
|
||||||
|
#OpenGLVertexBufferObjectSupport.h
|
||||||
|
../common/OpenGLWidget.h
|
||||||
Shapes.h
|
Shapes.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
|
#They may have other uses too...
|
||||||
FIND_PACKAGE(OpenGL REQUIRED)
|
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||||
|
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||||
|
|
||||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||||
|
|
||||||
#This will include the shader files inside the compiled binary
|
#This will include the shader files inside the compiled binary
|
||||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
QT4_ADD_RESOURCES(OPENGLEXAMPLE_RESOURCES_RCC openglexample.qrc)
|
QT5_ADD_RESOURCES(OPENGL_EXAMPLE_RESOURCES_RCC openglexample.qrc)
|
||||||
|
|
||||||
# Put the resources in a seperate folder in Visual Studio
|
# Put the resources in a seperate folder in Visual Studio
|
||||||
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC} openglexample.qrc ${OPENGLEXAMPLE_RESOURCES_RCC})
|
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
||||||
|
|
||||||
#Build
|
#Build
|
||||||
ADD_EXECUTABLE(OpenGLExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${OPENGLEXAMPLE_RESOURCES_RCC})
|
ADD_EXECUTABLE(OpenGLExample ${SRC_FILES} ${COMMON_RESOURCES_RCC} ${OPENGL_EXAMPLE_RESOURCES_RCC})
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(OpenGLExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
TARGET_LINK_LIBRARIES(OpenGLExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
TARGET_LINK_LIBRARIES(OpenGLExample Qt5::OpenGL)
|
||||||
SET_PROPERTY(TARGET OpenGLExample PROPERTY FOLDER "Examples")
|
SET_PROPERTY(TARGET OpenGLExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
@ -66,4 +73,11 @@ IF(WIN32)
|
|||||||
ARCHIVE DESTINATION Examples/OpenGL/lib
|
ARCHIVE DESTINATION Examples/OpenGL/lib
|
||||||
COMPONENT example
|
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)
|
ENDIF(WIN32)
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
# 3. This notice may not be removed or altered from any source
|
# 3. This notice may not be removed or altered from any source
|
||||||
# distribution.
|
# distribution.
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
||||||
|
|
||||||
PROJECT(PagingExample)
|
PROJECT(PagingExample)
|
||||||
|
|
||||||
#Projects source files
|
#Projects source files
|
||||||
@ -32,19 +30,20 @@ SET(SRC_FILES
|
|||||||
|
|
||||||
#Projects headers files
|
#Projects headers files
|
||||||
SET(INC_FILES
|
SET(INC_FILES
|
||||||
OpenGLWidget.h
|
../common/OpenGLWidget.h
|
||||||
Perlin.h
|
Perlin.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
|
#They may have other uses too...
|
||||||
FIND_PACKAGE(OpenGL REQUIRED)
|
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||||
|
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||||
|
|
||||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||||
|
|
||||||
#This will include the shader files inside the compiled binary
|
#This will include the shader files inside the compiled binary
|
||||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
|
|
||||||
# Put the resources in a seperate folder in Visual Studio
|
# Put the resources in a seperate folder in Visual Studio
|
||||||
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
||||||
@ -54,12 +53,9 @@ ADD_EXECUTABLE(PagingExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(PagingExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
SET_TARGET_PROPERTIES(PagingExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127")
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
TARGET_LINK_LIBRARIES(PagingExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
TARGET_LINK_LIBRARIES(PagingExample Qt5::OpenGL)
|
||||||
SET_PROPERTY(TARGET PagingExample PROPERTY FOLDER "Examples")
|
SET_PROPERTY(TARGET PagingExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
configure_file(../common/example.vert example.vert COPYONLY)
|
|
||||||
configure_file(../common/example.frag example.frag COPYONLY)
|
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
INSTALL(TARGETS PagingExample
|
INSTALL(TARGETS PagingExample
|
||||||
@ -68,4 +64,11 @@ IF(WIN32)
|
|||||||
ARCHIVE DESTINATION Examples/OpenGL/lib
|
ARCHIVE DESTINATION Examples/OpenGL/lib
|
||||||
COMPONENT example
|
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)
|
ENDIF(WIN32)
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
# 3. This notice may not be removed or altered from any source
|
# 3. This notice may not be removed or altered from any source
|
||||||
# distribution.
|
# distribution.
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
||||||
|
|
||||||
PROJECT(SmoothLODExample)
|
PROJECT(SmoothLODExample)
|
||||||
|
|
||||||
#Projects source files
|
#Projects source files
|
||||||
@ -31,18 +29,19 @@ SET(SRC_FILES
|
|||||||
|
|
||||||
#Projects headers files
|
#Projects headers files
|
||||||
SET(INC_FILES
|
SET(INC_FILES
|
||||||
OpenGLWidget.h
|
../common/OpenGLWidget.h
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
#"Sources" and "Headers" are the group names in Visual Studio.
|
||||||
|
#They may have other uses too...
|
||||||
FIND_PACKAGE(OpenGL REQUIRED)
|
SOURCE_GROUP("Sources" FILES ${SRC_FILES})
|
||||||
|
SOURCE_GROUP("Headers" FILES ${INC_FILES})
|
||||||
|
|
||||||
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
#Tell CMake the paths for OpenGL and for PolyVox (which is just relative to our current location)
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ${GLEW_SOURCE_DIR})
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${PolyVoxHeaders_SOURCE_DIR} ../common)
|
||||||
|
|
||||||
#This will include the shader files inside the compiled binary
|
#This will include the shader files inside the compiled binary
|
||||||
QT4_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
QT5_ADD_RESOURCES(COMMON_RESOURCES_RCC ../common/example.qrc)
|
||||||
|
|
||||||
# Put the resources in a seperate folder in Visual Studio
|
# Put the resources in a seperate folder in Visual Studio
|
||||||
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
SOURCE_GROUP("Resource Files" FILES ../common/example.qrc ${COMMON_RESOURCES_RCC})
|
||||||
@ -52,12 +51,9 @@ ADD_EXECUTABLE(SmoothLODExample ${SRC_FILES} ${COMMON_RESOURCES_RCC})
|
|||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET_TARGET_PROPERTIES(SmoothLODExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
SET_TARGET_PROPERTIES(SmoothLODExample PROPERTIES COMPILE_FLAGS "/W4 /wd4127") #All warnings
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
TARGET_LINK_LIBRARIES(SmoothLODExample glew ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
TARGET_LINK_LIBRARIES(SmoothLODExample Qt5::OpenGL)
|
||||||
SET_PROPERTY(TARGET SmoothLODExample PROPERTY FOLDER "Examples")
|
SET_PROPERTY(TARGET SmoothLODExample PROPERTY FOLDER "Examples")
|
||||||
|
|
||||||
configure_file(../common/example.vert example.vert COPYONLY)
|
|
||||||
configure_file(../common/example.frag example.frag COPYONLY)
|
|
||||||
|
|
||||||
#Install - Only install the example in Windows
|
#Install - Only install the example in Windows
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
INSTALL(TARGETS SmoothLODExample
|
INSTALL(TARGETS SmoothLODExample
|
||||||
@ -66,4 +62,11 @@ IF(WIN32)
|
|||||||
ARCHIVE DESTINATION Examples/OpenGL/lib
|
ARCHIVE DESTINATION Examples/OpenGL/lib
|
||||||
COMPONENT example
|
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)
|
ENDIF(WIN32)
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
# Copyright (c) 2010-2012 Matt 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(GLEW)
|
|
||||||
|
|
||||||
set(SRC_FILES ../common/glew/glew.cpp)
|
|
||||||
|
|
||||||
add_definitions(-DGLEW_STATIC)
|
|
||||||
|
|
||||||
#find_package(OpenGL REQUIRED)
|
|
||||||
#include_directories(${OPENGL_INCLUDE_DIR})
|
|
||||||
add_library(glew STATIC ${SRC_FILES})
|
|
||||||
SET_PROPERTY(TARGET glew PROPERTY FOLDER "Examples/Common")
|
|
@ -61,11 +61,10 @@ void OpenGLWidget::mouseMoveEvent(QMouseEvent* event)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void OpenGLWidget::initializeGL()
|
void OpenGLWidget::initializeGL()
|
||||||
{
|
{
|
||||||
GLenum err = glewInit();
|
if (!initializeOpenGLFunctions())
|
||||||
if (GLEW_OK != err)
|
|
||||||
{
|
{
|
||||||
/* Problem: glewInit failed, something is seriously wrong. */
|
std::cerr << "Could not initialize OpenGL functions" << std::endl;
|
||||||
std::cout << "GLEW Error: " << glewGetErrorString(err) << std::endl;
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Print out some information about the OpenGL implementation.
|
//Print out some information about the OpenGL implementation.
|
||||||
|
@ -26,10 +26,12 @@ distribution.
|
|||||||
|
|
||||||
#include "PolyVox/Mesh.h"
|
#include "PolyVox/Mesh.h"
|
||||||
|
|
||||||
#include "glew/glew.h"
|
#include <QOpenGLFunctions_3_1>
|
||||||
|
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QGLShaderProgram>
|
#include <QGLShaderProgram>
|
||||||
|
#include <QOpenGLVertexArrayObject>
|
||||||
|
#include <QOpenGLBuffer>
|
||||||
|
|
||||||
// This structure holds all the data required
|
// This structure holds all the data required
|
||||||
// to render one of our meshes through OpenGL.
|
// to render one of our meshes through OpenGL.
|
||||||
@ -47,7 +49,7 @@ struct OpenGLMeshData
|
|||||||
// Our OpenGLWidget is used by all the examples to render the extracted meshes. It is
|
// Our OpenGLWidget is used by all the examples to render the extracted meshes. It is
|
||||||
// fairly specific to our needs (you probably won't want to use it in your own project)
|
// fairly specific to our needs (you probably won't want to use it in your own project)
|
||||||
// but should provide a useful illustration of how PolyVox meshes can be rendered.
|
// but should provide a useful illustration of how PolyVox meshes can be rendered.
|
||||||
class OpenGLWidget : public QGLWidget
|
class OpenGLWidget : public QGLWidget, protected QOpenGLFunctions_3_1
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
The OpenGL Extension Wrangler Library
|
|
||||||
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
|
||||||
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
|
||||||
Copyright (C) 2002, Lev Povalahev
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
* The name of the author may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
||||||
THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
|
|
||||||
Mesa 3-D graphics library
|
|
||||||
Version: 7.0
|
|
||||||
|
|
||||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the "Software"),
|
|
||||||
to deal in the Software without restriction, including without limitation
|
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included
|
|
||||||
in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
Copyright (c) 2007 The Khronos Group Inc.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and/or associated documentation files (the
|
|
||||||
"Materials"), to deal in the Materials without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
|
||||||
permit persons to whom the Materials are furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included
|
|
||||||
in all copies or substantial portions of the Materials.
|
|
||||||
|
|
||||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -109,7 +109,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_D
|
|||||||
#Build
|
#Build
|
||||||
# Although we don't build anything for PolyVox, we still add this custom target (which
|
# 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.
|
# doesn't do anything) so that we can browse the source code from within Visual Studio.
|
||||||
ADD_CUSTOM_TARGET(PolyVoxCore SOURCES ${CORE_INC_FILES})
|
ADD_CUSTOM_TARGET(PolyVoxHeaders SOURCES ${CORE_INC_FILES})
|
||||||
|
|
||||||
#Install the core header files, including the ones in the Impl subfolder.
|
#Install the core header files, including the ones in the Impl subfolder.
|
||||||
INSTALL(DIRECTORY PolyVox/ DESTINATION include/PolyVox COMPONENT development PATTERN "*.git*" EXCLUDE)
|
INSTALL(DIRECTORY PolyVox/ DESTINATION include/PolyVox COMPONENT development PATTERN "*.git*" EXCLUDE)
|
||||||
|
@ -24,11 +24,14 @@
|
|||||||
#
|
#
|
||||||
# Also sets LATEST_TEST to point to the output executable of the test for easy
|
# Also sets LATEST_TEST to point to the output executable of the test for easy
|
||||||
# ADD_TEST()ing
|
# ADD_TEST()ing
|
||||||
MACRO(CREATE_TEST headerfile sourcefile executablename)
|
|
||||||
|
set(CMAKE_AUTOMOC TRUE)
|
||||||
|
|
||||||
|
MACRO(CREATE_TEST sourcefile executablename)
|
||||||
UNSET(test_moc_SRCS) #clear out the MOCs from previous tests
|
UNSET(test_moc_SRCS) #clear out the MOCs from previous tests
|
||||||
QT4_WRAP_CPP(test_moc_SRCS ${headerfile})
|
|
||||||
ADD_EXECUTABLE(${executablename} ${sourcefile} ${test_moc_SRCS})
|
ADD_EXECUTABLE(${executablename} ${sourcefile} ${test_moc_SRCS})
|
||||||
TARGET_LINK_LIBRARIES(${executablename} ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY})
|
TARGET_LINK_LIBRARIES(${executablename} Qt5::Test)
|
||||||
#HACK. This is needed since everything is built in the base dir in Windows. As of 2.8 we should change this.
|
#HACK. This is needed since everything is built in the base dir in Windows. As of 2.8 we should change this.
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
SET(LATEST_TEST ${EXECUTABLE_OUTPUT_PATH}/${executablename})
|
SET(LATEST_TEST ${EXECUTABLE_OUTPUT_PATH}/${executablename})
|
||||||
@ -45,22 +48,18 @@ MACRO(CREATE_TEST headerfile sourcefile executablename)
|
|||||||
ENDMACRO(CREATE_TEST)
|
ENDMACRO(CREATE_TEST)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${PolyVoxHeaders_SOURCE_DIR} ${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
|
#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.
|
# Test Template. Copy and paste this template for consistant naming.
|
||||||
# # ClassName tests
|
# # ClassName tests
|
||||||
# CREATE_TEST(TestClassName.h TestClassName.cpp TestClassName)
|
# CREATE_TEST(TestClassName.cpp TestClassName)
|
||||||
# ADD_TEST(ClassNameFeature1Test ${LATEST_TEST} testFeature1)
|
# ADD_TEST(ClassNameFeature1Test ${LATEST_TEST} testFeature1)
|
||||||
# ADD_TEST(ClassNameFeature2Test ${LATEST_TEST} testFeature2)
|
# ADD_TEST(ClassNameFeature2Test ${LATEST_TEST} testFeature2)
|
||||||
|
|
||||||
# Python tests
|
# Python tests
|
||||||
IF(BUILD_BINDINGS)
|
IF(BUILD_BINDINGS)
|
||||||
FIND_PACKAGE(PythonInterp 3)
|
FIND_PACKAGE(PythonInterp 3)
|
||||||
IF(CMAKE_VERSION VERSION_LESS "2.8.6")
|
set_package_properties(PythonInterp PROPERTIES URL http://www.python.org DESCRIPTION "Python Interpereter" TYPE OPTIONAL PURPOSE "Running the Python tests")
|
||||||
set_package_info(PythonInterp "Python Interpereter" http://www.python.org "Running the Python tests")
|
|
||||||
ELSE()
|
|
||||||
set_package_properties(PythonInterp PROPERTIES URL http://www.python.org DESCRIPTION "Python Interpereter" TYPE OPTIONAL PURPOSE "Running the Python tests")
|
|
||||||
ENDIF()
|
|
||||||
IF(PYTHONINTERP_FOUND)
|
IF(PYTHONINTERP_FOUND)
|
||||||
ADD_TEST(PythonSurfaceExtractorTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/TestSurfaceExtractor.py)
|
ADD_TEST(PythonSurfaceExtractorTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/TestSurfaceExtractor.py)
|
||||||
ADD_TEST(PythonRaycastTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/TestRaycast.py)
|
ADD_TEST(PythonRaycastTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/TestRaycast.py)
|
||||||
@ -68,38 +67,38 @@ IF(BUILD_BINDINGS)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# AmbientOcclusionGenerator tests
|
# AmbientOcclusionGenerator tests
|
||||||
CREATE_TEST(TestAmbientOcclusionGenerator.h TestAmbientOcclusionGenerator.cpp TestAmbientOcclusionGenerator)
|
CREATE_TEST(TestAmbientOcclusionGenerator.cpp TestAmbientOcclusionGenerator)
|
||||||
|
|
||||||
# Array tests
|
# Array tests
|
||||||
CREATE_TEST(TestArray.h TestArray.cpp TestArray)
|
CREATE_TEST(TestArray.cpp TestArray)
|
||||||
|
|
||||||
# AStarPathfinder tests
|
# AStarPathfinder tests
|
||||||
CREATE_TEST(TestAStarPathfinder.h TestAStarPathfinder.cpp TestAStarPathfinder)
|
CREATE_TEST(TestAStarPathfinder.cpp TestAStarPathfinder)
|
||||||
|
|
||||||
CREATE_TEST(TestCubicSurfaceExtractor.h TestCubicSurfaceExtractor.cpp TestCubicSurfaceExtractor)
|
CREATE_TEST(TestCubicSurfaceExtractor.cpp TestCubicSurfaceExtractor)
|
||||||
|
|
||||||
# Low pass filter tests
|
# Low pass filter tests
|
||||||
CREATE_TEST(TestLowPassFilter.h TestLowPassFilter.cpp TestLowPassFilter)
|
CREATE_TEST(TestLowPassFilter.cpp TestLowPassFilter)
|
||||||
|
|
||||||
# Material tests
|
# Material tests
|
||||||
CREATE_TEST(testmaterial.h testmaterial.cpp testmaterial)
|
CREATE_TEST(testmaterial.cpp testmaterial)
|
||||||
|
|
||||||
# Raycast tests
|
# Raycast tests
|
||||||
CREATE_TEST(TestRaycast.h TestRaycast.cpp TestRaycast)
|
CREATE_TEST(TestRaycast.cpp TestRaycast)
|
||||||
|
|
||||||
# Picking tests
|
# Picking tests
|
||||||
CREATE_TEST(TestPicking.h TestPicking.cpp TestPicking)
|
CREATE_TEST(TestPicking.cpp TestPicking)
|
||||||
|
|
||||||
# Region tests
|
# Region tests
|
||||||
CREATE_TEST(TestRegion.h TestRegion.cpp TestRegion)
|
CREATE_TEST(TestRegion.cpp TestRegion)
|
||||||
|
|
||||||
CREATE_TEST(TestSurfaceExtractor.h TestSurfaceExtractor.cpp TestSurfaceExtractor)
|
CREATE_TEST(TestSurfaceExtractor.cpp TestSurfaceExtractor)
|
||||||
|
|
||||||
#Vector tests
|
#Vector tests
|
||||||
CREATE_TEST(testvector.h testvector.cpp testvector)
|
CREATE_TEST(testvector.cpp testvector)
|
||||||
|
|
||||||
# Volume tests
|
# Volume tests
|
||||||
CREATE_TEST(testvolume.h testvolume.cpp testvolume)
|
CREATE_TEST(testvolume.cpp testvolume)
|
||||||
|
|
||||||
# Volume subclass tests
|
# Volume subclass tests
|
||||||
CREATE_TEST(TestVolumeSubclass.h TestVolumeSubclass.cpp TestVolumeSubclass)
|
CREATE_TEST(TestVolumeSubclass.cpp TestVolumeSubclass)
|
||||||
|
@ -32,6 +32,8 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
using namespace PolyVox;
|
using namespace PolyVox;
|
||||||
|
|
||||||
template<typename _VoxelType>
|
template<typename _VoxelType>
|
||||||
@ -63,8 +65,8 @@ VolumeType* createAndFillVolumeWithNoise(int32_t iVolumeSideLength, typename Vol
|
|||||||
//Create empty volume
|
//Create empty volume
|
||||||
VolumeType* volData = new VolumeType(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(iVolumeSideLength - 1, iVolumeSideLength - 1, iVolumeSideLength - 1)));
|
VolumeType* volData = new VolumeType(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(iVolumeSideLength - 1, iVolumeSideLength - 1, iVolumeSideLength - 1)));
|
||||||
|
|
||||||
// Seed generator for consistency between runs.
|
// Set up a random number generator
|
||||||
srand(12345);
|
std::mt19937 rng;
|
||||||
|
|
||||||
//Fill the volume with data
|
//Fill the volume with data
|
||||||
for (int32_t z = 0; z < iVolumeSideLength; z++)
|
for (int32_t z = 0; z < iVolumeSideLength; z++)
|
||||||
@ -81,7 +83,9 @@ VolumeType* createAndFillVolumeWithNoise(int32_t iVolumeSideLength, typename Vol
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Otherwise we write random voxel values between zero and the requested maximum
|
// Otherwise we write random voxel values between zero and the requested maximum
|
||||||
int voxelValue = (rand() % (maxValue - minValue + 1)) + minValue;
|
// We can't use std distributions because they vary between platforms (breaking tests).
|
||||||
|
int voxelValue = (rng() % (maxValue - minValue + 1)) + minValue; // +1 for inclusive bounds
|
||||||
|
|
||||||
volData->setVoxelAt(x, y, z, static_cast<typename VolumeType::VoxelType>(voxelValue));
|
volData->setVoxelAt(x, y, z, static_cast<typename VolumeType::VoxelType>(voxelValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,9 +102,6 @@ VolumeType* createAndFillVolumeRealistic(int32_t iVolumeSideLength)
|
|||||||
//Create empty volume
|
//Create empty volume
|
||||||
VolumeType* volData = new VolumeType(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(iVolumeSideLength - 1, iVolumeSideLength - 1, iVolumeSideLength - 1)));
|
VolumeType* volData = new VolumeType(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(iVolumeSideLength - 1, iVolumeSideLength - 1, iVolumeSideLength - 1)));
|
||||||
|
|
||||||
// Seed generator for consistency between runs.
|
|
||||||
srand(12345);
|
|
||||||
|
|
||||||
//Fill the volume with data
|
//Fill the volume with data
|
||||||
for (int32_t z = 0; z < iVolumeSideLength; z++)
|
for (int32_t z = 0; z < iVolumeSideLength; z++)
|
||||||
{
|
{
|
||||||
@ -130,28 +131,28 @@ void TestCubicSurfaceExtractor::testBehaviour()
|
|||||||
// Test with default mesh and contoller types.
|
// Test with default mesh and contoller types.
|
||||||
auto uint8Vol = createAndFillVolumeWithNoise< PagedVolume<uint8_t> >(32, 0, 2);
|
auto uint8Vol = createAndFillVolumeWithNoise< PagedVolume<uint8_t> >(32, 0, 2);
|
||||||
auto uint8Mesh = extractCubicMesh(uint8Vol, uint8Vol->getEnclosingRegion());
|
auto uint8Mesh = extractCubicMesh(uint8Vol, uint8Vol->getEnclosingRegion());
|
||||||
QCOMPARE(uint8Mesh.getNoOfVertices(), uint32_t(57687));
|
QCOMPARE(uint8Mesh.getNoOfVertices(), uint32_t(57544));
|
||||||
QCOMPARE(uint8Mesh.getNoOfIndices(), uint32_t(216234));
|
QCOMPARE(uint8Mesh.getNoOfIndices(), uint32_t(215304));
|
||||||
|
|
||||||
// Test with default mesh type but user-provided controller.
|
// Test with default mesh type but user-provided controller.
|
||||||
auto int8Vol = createAndFillVolumeWithNoise< PagedVolume<int8_t> >(32, 0, 2);
|
auto int8Vol = createAndFillVolumeWithNoise< PagedVolume<int8_t> >(32, 0, 2);
|
||||||
auto int8Mesh = extractCubicMesh(int8Vol, int8Vol->getEnclosingRegion(), CustomIsQuadNeeded<int8_t>());
|
auto int8Mesh = extractCubicMesh(int8Vol, int8Vol->getEnclosingRegion(), CustomIsQuadNeeded<int8_t>());
|
||||||
QCOMPARE(int8Mesh.getNoOfVertices(), uint32_t(29027));
|
QCOMPARE(int8Mesh.getNoOfVertices(), uint32_t(29106));
|
||||||
QCOMPARE(int8Mesh.getNoOfIndices(), uint32_t(178356));
|
QCOMPARE(int8Mesh.getNoOfIndices(), uint32_t(178566));
|
||||||
|
|
||||||
// Test with default controller but user-provided mesh.
|
// Test with default controller but user-provided mesh.
|
||||||
auto uint32Vol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(32, 0, 2);
|
auto uint32Vol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(32, 0, 2);
|
||||||
Mesh< CubicVertex< uint32_t >, uint16_t > uint32Mesh;
|
Mesh< CubicVertex< uint32_t >, uint16_t > uint32Mesh;
|
||||||
extractCubicMeshCustom(uint32Vol, uint32Vol->getEnclosingRegion(), &uint32Mesh);
|
extractCubicMeshCustom(uint32Vol, uint32Vol->getEnclosingRegion(), &uint32Mesh);
|
||||||
QCOMPARE(uint32Mesh.getNoOfVertices(), uint16_t(57687));
|
QCOMPARE(uint32Mesh.getNoOfVertices(), uint16_t(57544));
|
||||||
QCOMPARE(uint32Mesh.getNoOfIndices(), uint32_t(216234));
|
QCOMPARE(uint32Mesh.getNoOfIndices(), uint32_t(215304));
|
||||||
|
|
||||||
// Test with both mesh and controller being provided by the user.
|
// Test with both mesh and controller being provided by the user.
|
||||||
auto int32Vol = createAndFillVolumeWithNoise< PagedVolume<int32_t> >(32, 0, 2);
|
auto int32Vol = createAndFillVolumeWithNoise< PagedVolume<int32_t> >(32, 0, 2);
|
||||||
Mesh< CubicVertex< int32_t >, uint16_t > int32Mesh;
|
Mesh< CubicVertex< int32_t >, uint16_t > int32Mesh;
|
||||||
extractCubicMeshCustom(int32Vol, int32Vol->getEnclosingRegion(), &int32Mesh, CustomIsQuadNeeded<int32_t>());
|
extractCubicMeshCustom(int32Vol, int32Vol->getEnclosingRegion(), &int32Mesh, CustomIsQuadNeeded<int32_t>());
|
||||||
QCOMPARE(int32Mesh.getNoOfVertices(), uint16_t(29027));
|
QCOMPARE(int32Mesh.getNoOfVertices(), uint16_t(29106));
|
||||||
QCOMPARE(int32Mesh.getNoOfIndices(), uint32_t(178356));
|
QCOMPARE(int32Mesh.getNoOfIndices(), uint32_t(178566));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCubicSurfaceExtractor::testEmptyVolumePerformance()
|
void TestCubicSurfaceExtractor::testEmptyVolumePerformance()
|
||||||
@ -175,7 +176,7 @@ void TestCubicSurfaceExtractor::testNoiseVolumePerformance()
|
|||||||
auto noiseVol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(128, 0, 2);
|
auto noiseVol = createAndFillVolumeWithNoise< PagedVolume<uint32_t> >(128, 0, 2);
|
||||||
Mesh< CubicVertex< uint32_t >, uint16_t > noiseMesh;
|
Mesh< CubicVertex< uint32_t >, uint16_t > noiseMesh;
|
||||||
QBENCHMARK{ extractCubicMeshCustom(noiseVol, Region(32, 32, 32, 63, 63, 63), &noiseMesh); }
|
QBENCHMARK{ extractCubicMeshCustom(noiseVol, Region(32, 32, 32, 63, 63, 63), &noiseMesh); }
|
||||||
QCOMPARE(noiseMesh.getNoOfVertices(), uint16_t(57729));
|
QCOMPARE(noiseMesh.getNoOfVertices(), uint16_t(57905));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestCubicSurfaceExtractor)
|
QTEST_MAIN(TestCubicSurfaceExtractor)
|
||||||
|
@ -32,6 +32,8 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
using namespace PolyVox;
|
using namespace PolyVox;
|
||||||
|
|
||||||
// Test our ability to modify the behaviour of the MarchingCubesSurfaceExtractor. This simple example only modifies
|
// Test our ability to modify the behaviour of the MarchingCubesSurfaceExtractor. This simple example only modifies
|
||||||
@ -126,15 +128,6 @@ VolumeType* createAndFillVolume(void)
|
|||||||
return volData;
|
return volData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// From http://stackoverflow.com/a/5289624
|
|
||||||
float randomFloat(float a, float b)
|
|
||||||
{
|
|
||||||
float random = ((float)rand()) / (float)RAND_MAX;
|
|
||||||
float diff = b - a;
|
|
||||||
float r = random * diff;
|
|
||||||
return a + r;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename VolumeType>
|
template <typename VolumeType>
|
||||||
VolumeType* createAndFillVolumeWithNoise(int32_t iVolumeSideLength, float minValue, float maxValue)
|
VolumeType* createAndFillVolumeWithNoise(int32_t iVolumeSideLength, float minValue, float maxValue)
|
||||||
{
|
{
|
||||||
@ -143,8 +136,8 @@ VolumeType* createAndFillVolumeWithNoise(int32_t iVolumeSideLength, float minVal
|
|||||||
//Create empty volume
|
//Create empty volume
|
||||||
VolumeType* volData = new VolumeType(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(iVolumeSideLength - 1, iVolumeSideLength - 1, iVolumeSideLength - 1)), pager);
|
VolumeType* volData = new VolumeType(Region(Vector3DInt32(0, 0, 0), Vector3DInt32(iVolumeSideLength - 1, iVolumeSideLength - 1, iVolumeSideLength - 1)), pager);
|
||||||
|
|
||||||
// Seed generator for consistency between runs.
|
// Set up a random number generator
|
||||||
srand(12345);
|
std::mt19937 rng;
|
||||||
|
|
||||||
// Fill
|
// Fill
|
||||||
for (int32_t z = 0; z < iVolumeSideLength; z++)
|
for (int32_t z = 0; z < iVolumeSideLength; z++)
|
||||||
@ -153,7 +146,10 @@ VolumeType* createAndFillVolumeWithNoise(int32_t iVolumeSideLength, float minVal
|
|||||||
{
|
{
|
||||||
for (int32_t x = 0; x < iVolumeSideLength; x++)
|
for (int32_t x = 0; x < iVolumeSideLength; x++)
|
||||||
{
|
{
|
||||||
float voxelValue = randomFloat(minValue, maxValue);
|
// We can't use std distributions because they vary between platforms (breaking tests)
|
||||||
|
float voxelValue = static_cast<float>(rng()) / static_cast<float>(std::numeric_limits<int32_t>::max()); // Float in range 0.0 to 1.0
|
||||||
|
voxelValue = voxelValue * (maxValue - minValue) + minValue; // Float in range minValue to maxValue
|
||||||
|
|
||||||
volData->setVoxelAt(x, y, z, voxelValue);
|
volData->setVoxelAt(x, y, z, voxelValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +226,7 @@ void TestSurfaceExtractor::testNoiseVolumePerformance()
|
|||||||
auto noiseVol = createAndFillVolumeWithNoise< PagedVolume<float> >(128, -1.0f, 1.0f);
|
auto noiseVol = createAndFillVolumeWithNoise< PagedVolume<float> >(128, -1.0f, 1.0f);
|
||||||
Mesh< MarchingCubesVertex< float >, uint16_t > noiseMesh;
|
Mesh< MarchingCubesVertex< float >, uint16_t > noiseMesh;
|
||||||
QBENCHMARK{ extractMarchingCubesMeshCustom(noiseVol, Region(32, 32, 32, 63, 63, 63), &noiseMesh); }
|
QBENCHMARK{ extractMarchingCubesMeshCustom(noiseVol, Region(32, 32, 32, 63, 63, 63), &noiseMesh); }
|
||||||
QCOMPARE(noiseMesh.getNoOfVertices(), uint16_t(48967));
|
QCOMPARE(noiseMesh.getNoOfVertices(), uint16_t(36755));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestSurfaceExtractor)
|
QTEST_MAIN(TestSurfaceExtractor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user