Update vwr and use cloonel as the enclosing namespace for it.

This commit is contained in:
King_DuckZ 2017-03-04 00:21:50 +00:00
parent 012daa47d7
commit 65b6269cea
5 changed files with 13 additions and 66 deletions

View file

@ -21,6 +21,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CLOONEL_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(CLOONEL_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(CLOONEL_VECTORWRAPPER_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/lib/vectorwrapper/include)
target_architecture(TARGET_ARCH) target_architecture(TARGET_ARCH)
message (STATUS "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} target_include_directories(${PROJECT_NAME}
INTERFACE "${PROJECT_BINARY_DIR}" INTERFACE "${PROJECT_BINARY_DIR}"
INTERFACE lib/vectorwrapper/include
INTERFACE lib/tree-3.1/src INTERFACE lib/tree-3.1/src
) )
target_compile_definitions(${PROJECT_NAME} target_compile_definitions(${PROJECT_NAME}
INTERFACE VWR_STATIC_CAST_RESULTS INTERFACE VWR_STATIC_CAST_RESULTS
INTERFACE VWR_SIZE_TYPE=uint32_t INTERFACE VWR_SIZE_TYPE=uint32_t
INTERFACE VWR_OUTER_NAMESPACE=cloonel
INTERFACE ${PNG_DEFINITIONS} INTERFACE ${PNG_DEFINITIONS}
) )

@ -1 +1 @@
Subproject commit 2f4d31967541c9c4a87b2511fb0c6d3792c72c2d Subproject commit db7b9becd5758f572530e92182313a64e4e44f5b

View file

@ -22,4 +22,9 @@ target_include_directories(${PROJECT_NAME}
PRIVATE ${PNG_INCLUDE_DIRS} PRIVATE ${PNG_INCLUDE_DIRS}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${PHYSFS_INCLUDE_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)

View file

@ -41,6 +41,7 @@
} \ } \
} }
namespace cloonel {
namespace vwr { namespace vwr {
SPECIALIZE_ARRAY_VECTOR(float, 2); SPECIALIZE_ARRAY_VECTOR(float, 2);
SPECIALIZE_ARRAY_VECTOR(uint16_t, 2); SPECIALIZE_ARRAY_VECTOR(uint16_t, 2);
@ -60,75 +61,13 @@ namespace vwr {
return parStream; return parStream;
} }
#endif #endif
template <typename V>
Vec<V> operator+ (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) a_pure;
template <typename V>
Vec<V> operator- (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) a_pure;
template <typename V>
Vec<V> operator* (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) a_pure;
template <typename V>
Vec<V> operator/ (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) a_pure;
template <typename V>
Vec<V> operator+ (typename VectorWrapperInfo<V>::scalar_type parLeft, Vec<V> parRight) a_pure;
template <typename V>
Vec<V> operator* (typename VectorWrapperInfo<V>::scalar_type parLeft, Vec<V> parRight) a_pure;
template <typename V>
inline
Vec<V> operator+ (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) {
for (uint32_t z = 0; z < Vec<V>::dimensions; ++z) {
parLeft[z] += parRight;
}
return parLeft;
}
template <typename V>
inline
Vec<V> operator- (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) {
for (uint32_t z = 0; z < Vec<V>::dimensions; ++z) {
parLeft[z] -= parRight;
}
return parLeft;
}
template <typename V>
inline
Vec<V> operator* (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) {
for (uint32_t z = 0; z < Vec<V>::dimensions; ++z) {
parLeft[z] *= parRight;
}
return parLeft;
}
template <typename V>
inline
Vec<V> operator/ (Vec<V> parLeft, typename VectorWrapperInfo<V>::scalar_type parRight) {
for (uint32_t z = 0; z < Vec<V>::dimensions; ++z) {
parLeft[z] /= parRight;
}
return parLeft;
}
template <typename V>
inline
Vec<V> operator+ (typename VectorWrapperInfo<V>::scalar_type parLeft, Vec<V> parRight) {
for (uint32_t z = 0; z < Vec<V>::dimensions; ++z) {
parRight[z] += parLeft;
}
return parRight;
}
template <typename V>
inline
Vec<V> operator* (typename VectorWrapperInfo<V>::scalar_type parLeft, Vec<V> parRight) {
for (uint32_t z = 0; z < Vec<V>::dimensions; ++z) {
parRight[z] *= parLeft;
}
return parRight;
}
} //namespace vwr } //namespace vwr
} //namespace cloonel
//make stuff from CloonelJump compile happily //make stuff from CloonelJump compile happily
namespace cloonel { namespace cloonel {
template <typename T, uint32_t S> template <typename T, uint32_t S>
using Vector = ::vwr::Vec<std::array<T, std::size_t(S)>, S>; using Vector = vwr::Vec<std::array<T, std::size_t(S)>, S>;
using ushort2 = Vector<uint16_t, 2>; using ushort2 = Vector<uint16_t, 2>;
#if !defined(NDEBUG) #if !defined(NDEBUG)

View file

@ -26,6 +26,7 @@
#include <ciso646> #include <ciso646>
#include <cstdint> #include <cstdint>
namespace cloonel {
namespace vwr { namespace vwr {
template <typename T> template <typename T>
struct VectorWrapperInfo<std::array<cloonel::Vector<T, 2>, 2>> { struct VectorWrapperInfo<std::array<cloonel::Vector<T, 2>, 2>> {
@ -37,6 +38,7 @@ namespace vwr {
} }
}; };
} //namespace vwr } //namespace vwr
} //namespace cloonel
namespace cloonel { namespace cloonel {
template <typename T, uint32_t S> template <typename T, uint32_t S>