diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d02f5c..83317f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CLOONEL_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") +set(CLOONEL_VECTORWRAPPER_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/lib/vectorwrapper/include) target_architecture(TARGET_ARCH) message (STATUS "Target architecture: ${TARGET_ARCH}") @@ -71,13 +72,13 @@ target_include_directories(${PROJECT_NAME} SYSTEM target_include_directories(${PROJECT_NAME} INTERFACE "${PROJECT_BINARY_DIR}" - INTERFACE lib/vectorwrapper/include INTERFACE lib/tree-3.1/src ) target_compile_definitions(${PROJECT_NAME} INTERFACE VWR_STATIC_CAST_RESULTS INTERFACE VWR_SIZE_TYPE=uint32_t + INTERFACE VWR_OUTER_NAMESPACE=cloonel INTERFACE ${PNG_DEFINITIONS} ) diff --git a/lib/vectorwrapper b/lib/vectorwrapper index 2f4d319..db7b9be 160000 --- a/lib/vectorwrapper +++ b/lib/vectorwrapper @@ -1 +1 @@ -Subproject commit 2f4d31967541c9c4a87b2511fb0c6d3792c72c2d +Subproject commit db7b9becd5758f572530e92182313a64e4e44f5b diff --git a/src/cloonelgraphics/CMakeLists.txt b/src/cloonelgraphics/CMakeLists.txt index d4a0c5e..c3448db 100644 --- a/src/cloonelgraphics/CMakeLists.txt +++ b/src/cloonelgraphics/CMakeLists.txt @@ -22,4 +22,9 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${PNG_INCLUDE_DIRS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${PHYSFS_INCLUDE_DIR} + PUBLIC ${CLOONEL_VECTORWRAPPER_INCLUDE} + PUBLIC ../../lib/tree-3.1/src ) + +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) diff --git a/src/cloonelgraphics/vectypes.hpp b/src/cloonelgraphics/vectypes.hpp index 9ff09b3..2cf1981 100644 --- a/src/cloonelgraphics/vectypes.hpp +++ b/src/cloonelgraphics/vectypes.hpp @@ -41,6 +41,7 @@ } \ } +namespace cloonel { namespace vwr { SPECIALIZE_ARRAY_VECTOR(float, 2); SPECIALIZE_ARRAY_VECTOR(uint16_t, 2); @@ -60,75 +61,13 @@ namespace vwr { return parStream; } #endif - - template - Vec operator+ (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) a_pure; - template - Vec operator- (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) a_pure; - template - Vec operator* (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) a_pure; - template - Vec operator/ (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) a_pure; - template - Vec operator+ (typename VectorWrapperInfo::scalar_type parLeft, Vec parRight) a_pure; - template - Vec operator* (typename VectorWrapperInfo::scalar_type parLeft, Vec parRight) a_pure; - - template - inline - Vec operator+ (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) { - for (uint32_t z = 0; z < Vec::dimensions; ++z) { - parLeft[z] += parRight; - } - return parLeft; - } - template - inline - Vec operator- (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) { - for (uint32_t z = 0; z < Vec::dimensions; ++z) { - parLeft[z] -= parRight; - } - return parLeft; - } - template - inline - Vec operator* (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) { - for (uint32_t z = 0; z < Vec::dimensions; ++z) { - parLeft[z] *= parRight; - } - return parLeft; - } - template - inline - Vec operator/ (Vec parLeft, typename VectorWrapperInfo::scalar_type parRight) { - for (uint32_t z = 0; z < Vec::dimensions; ++z) { - parLeft[z] /= parRight; - } - return parLeft; - } - - template - inline - Vec operator+ (typename VectorWrapperInfo::scalar_type parLeft, Vec parRight) { - for (uint32_t z = 0; z < Vec::dimensions; ++z) { - parRight[z] += parLeft; - } - return parRight; - } - template - inline - Vec operator* (typename VectorWrapperInfo::scalar_type parLeft, Vec parRight) { - for (uint32_t z = 0; z < Vec::dimensions; ++z) { - parRight[z] *= parLeft; - } - return parRight; - } } //namespace vwr +} //namespace cloonel //make stuff from CloonelJump compile happily namespace cloonel { template - using Vector = ::vwr::Vec, S>; + using Vector = vwr::Vec, S>; using ushort2 = Vector; #if !defined(NDEBUG) diff --git a/src/jumping/line.hpp b/src/jumping/line.hpp index d1dfce3..5b4e522 100644 --- a/src/jumping/line.hpp +++ b/src/jumping/line.hpp @@ -26,6 +26,7 @@ #include #include +namespace cloonel { namespace vwr { template struct VectorWrapperInfo, 2>> { @@ -37,6 +38,7 @@ namespace vwr { } }; } //namespace vwr +} //namespace cloonel namespace cloonel { template