Merge branch 'develop' into feature/cubiquity-version
Conflicts: library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h
This commit is contained in:
		| @@ -69,10 +69,6 @@ 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() | ||||||
|  |  | ||||||
| if(NOT MSVC) #This is causing problems in Visual Studio so disable it for now |  | ||||||
| 	INCLUDE(cmake/Modules/CheckCXX11Features.cmake) |  | ||||||
| endif() |  | ||||||
|  |  | ||||||
| ADD_SUBDIRECTORY(library) | ADD_SUBDIRECTORY(library) | ||||||
|  |  | ||||||
| OPTION(ENABLE_EXAMPLES "Should the examples be built" ON) | OPTION(ENABLE_EXAMPLES "Should the examples be built" ON) | ||||||
|   | |||||||
| @@ -1,133 +0,0 @@ | |||||||
| # - Check which parts of the C++11 standard the compiler supports |  | ||||||
| # |  | ||||||
| # When found it will set the following variables |  | ||||||
| # |  | ||||||
| #  CXX11_COMPILER_FLAGS         - the compiler flags needed to get C++11 features |  | ||||||
| # |  | ||||||
| #  HAS_CXX11_AUTO               - auto keyword |  | ||||||
| #  HAS_CXX11_AUTO_RET_TYPE      - function declaration with deduced return types |  | ||||||
| #  HAS_CXX11_CLASS_OVERRIDE     - override and final keywords for classes and methods |  | ||||||
| #  HAS_CXX11_CONSTEXPR          - constexpr keyword |  | ||||||
| #  HAS_CXX11_CSTDINT_H          - cstdint header |  | ||||||
| #  HAS_CXX11_DECLTYPE           - decltype keyword |  | ||||||
| #  HAS_CXX11_FUNC               - __func__ preprocessor constant |  | ||||||
| #  HAS_CXX11_INITIALIZER_LIST   - initializer list |  | ||||||
| #  HAS_CXX11_LAMBDA             - lambdas |  | ||||||
| #  HAS_CXX11_LIB_REGEX          - regex library |  | ||||||
| #  HAS_CXX11_LONG_LONG          - long long signed & unsigned types |  | ||||||
| #  HAS_CXX11_NULLPTR            - nullptr |  | ||||||
| #  HAS_CXX11_RVALUE_REFERENCES  - rvalue references |  | ||||||
| #  HAS_CXX11_SIZEOF_MEMBER      - sizeof() non-static members |  | ||||||
| #  HAS_CXX11_STATIC_ASSERT      - static_assert() |  | ||||||
| #  HAS_CXX11_VARIADIC_TEMPLATES - variadic templates |  | ||||||
|  |  | ||||||
| #============================================================================= |  | ||||||
| # Copyright 2011,2012 Rolf Eike Beer <eike@sf-mail.de> |  | ||||||
| # Copyright 2012 Andreas Weis |  | ||||||
| # |  | ||||||
| # Distributed under the OSI-approved BSD License (the "License"); |  | ||||||
| # see accompanying file Copyright.txt for details. |  | ||||||
| # |  | ||||||
| # This software is distributed WITHOUT ANY WARRANTY; without even the |  | ||||||
| # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |  | ||||||
| # See the License for more information. |  | ||||||
| #============================================================================= |  | ||||||
| # (To distribute this file outside of CMake, substitute the full |  | ||||||
| #  License text for the above reference.) |  | ||||||
|  |  | ||||||
| if (NOT CMAKE_CXX_COMPILER_LOADED) |  | ||||||
|     message(FATAL_ERROR "CheckCXX11Features modules only works if language CXX is enabled") |  | ||||||
| endif () |  | ||||||
|  |  | ||||||
| cmake_minimum_required(VERSION 2.8.3) |  | ||||||
|  |  | ||||||
| # |  | ||||||
| ### Check for needed compiler flags |  | ||||||
| # |  | ||||||
| include(CheckCXXCompilerFlag) |  | ||||||
| check_cxx_compiler_flag("-std=c++11" _HAS_CXX11_FLAG) |  | ||||||
| if (NOT _HAS_CXX11_FLAG) |  | ||||||
|     check_cxx_compiler_flag("-std=c++0x" _HAS_CXX0X_FLAG) |  | ||||||
| endif () |  | ||||||
|  |  | ||||||
| if (_HAS_CXX11_FLAG) |  | ||||||
|     set(CXX11_COMPILER_FLAGS "-std=c++11") |  | ||||||
| elseif (_HAS_CXX0X_FLAG) |  | ||||||
|     set(CXX11_COMPILER_FLAGS "-std=c++0x") |  | ||||||
| endif () |  | ||||||
|  |  | ||||||
| function(cxx11_check_feature FEATURE_NAME RESULT_VAR) |  | ||||||
|     if (NOT DEFINED ${RESULT_VAR}) |  | ||||||
|         set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11_${FEATURE_NAME}") |  | ||||||
|  |  | ||||||
|         set(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/CheckCXX11Features/cxx11-test-${FEATURE_NAME}) |  | ||||||
|         set(_LOG_NAME "\"${FEATURE_NAME}\"") |  | ||||||
|         message(STATUS "Checking C++11 support for ${_LOG_NAME}") |  | ||||||
|  |  | ||||||
|         set(_SRCFILE "${_SRCFILE_BASE}.cpp") |  | ||||||
|         set(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cpp") |  | ||||||
|         set(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cpp") |  | ||||||
|  |  | ||||||
|         if (CROSS_COMPILING) |  | ||||||
|             try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}" |  | ||||||
|                         COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") |  | ||||||
|             if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) |  | ||||||
|                 try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}" |  | ||||||
|                             COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") |  | ||||||
|             endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) |  | ||||||
|         else (CROSS_COMPILING) |  | ||||||
|             try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR |  | ||||||
|                     "${_bindir}" "${_SRCFILE}" |  | ||||||
|                     COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") |  | ||||||
|             if (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) |  | ||||||
|                 set(${RESULT_VAR} TRUE) |  | ||||||
|             else (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) |  | ||||||
|                 set(${RESULT_VAR} FALSE) |  | ||||||
|             endif (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) |  | ||||||
|             if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) |  | ||||||
|                 try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR |  | ||||||
|                         "${_bindir}_fail" "${_SRCFILE_FAIL}" |  | ||||||
|                          COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") |  | ||||||
|                 if (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) |  | ||||||
|                     set(${RESULT_VAR} TRUE) |  | ||||||
|                 else (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) |  | ||||||
|                     set(${RESULT_VAR} FALSE) |  | ||||||
|                 endif (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) |  | ||||||
|             endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) |  | ||||||
|         endif (CROSS_COMPILING) |  | ||||||
|         if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) |  | ||||||
|             try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}" |  | ||||||
|                         COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") |  | ||||||
|             if (_TMP_RESULT) |  | ||||||
|                 set(${RESULT_VAR} FALSE) |  | ||||||
|             else (_TMP_RESULT) |  | ||||||
|                 set(${RESULT_VAR} TRUE) |  | ||||||
|             endif (_TMP_RESULT) |  | ||||||
|         endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) |  | ||||||
|  |  | ||||||
|         if (${RESULT_VAR}) |  | ||||||
|             message(STATUS "Checking C++11 support for ${_LOG_NAME}: works") |  | ||||||
|         else (${RESULT_VAR}) |  | ||||||
|             message(STATUS "Checking C++11 support for ${_LOG_NAME}: not supported") |  | ||||||
|         endif (${RESULT_VAR}) |  | ||||||
|         set(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++11 support for ${_LOG_NAME}") |  | ||||||
|     endif (NOT DEFINED ${RESULT_VAR}) |  | ||||||
| endfunction(cxx11_check_feature) |  | ||||||
|  |  | ||||||
| #cxx11_check_feature("__func__" HAS_CXX11_FUNC) |  | ||||||
| #cxx11_check_feature("auto" HAS_CXX11_AUTO) |  | ||||||
| #cxx11_check_feature("auto_ret_type" HAS_CXX11_AUTO_RET_TYPE) |  | ||||||
| #cxx11_check_feature("class_override_final" HAS_CXX11_CLASS_OVERRIDE) |  | ||||||
| cxx11_check_feature("constexpr" HAS_CXX11_CONSTEXPR) |  | ||||||
| cxx11_check_feature("cstdint" HAS_CXX11_CSTDINT_H) |  | ||||||
| #cxx11_check_feature("decltype" HAS_CXX11_DECLTYPE) |  | ||||||
| #cxx11_check_feature("initializer_list" HAS_CXX11_INITIALIZER_LIST) |  | ||||||
| #cxx11_check_feature("lambda" HAS_CXX11_LAMBDA) |  | ||||||
| #cxx11_check_feature("long_long" HAS_CXX11_LONG_LONG) |  | ||||||
| #cxx11_check_feature("nullptr" HAS_CXX11_NULLPTR) |  | ||||||
| #cxx11_check_feature("regex" HAS_CXX11_LIB_REGEX) |  | ||||||
| #cxx11_check_feature("rvalue-references" HAS_CXX11_RVALUE_REFERENCES) |  | ||||||
| #cxx11_check_feature("sizeof_member" HAS_CXX11_SIZEOF_MEMBER) |  | ||||||
| cxx11_check_feature("static_assert" HAS_CXX11_STATIC_ASSERT) |  | ||||||
| #cxx11_check_feature("variadic_templates" HAS_CXX11_VARIADIC_TEMPLATES) |  | ||||||
| cxx11_check_feature("shared_ptr" HAS_CXX11_SHARED_PTR) |  | ||||||
| @@ -1,8 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	if (!__func__) |  | ||||||
| 		return 1; |  | ||||||
| 	if (!(*__func__)) |  | ||||||
| 		return 1; |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	auto i = 5; |  | ||||||
| 	auto f = 3.14159f; |  | ||||||
| 	auto d = 3.14159; |  | ||||||
| 	bool ret = ( |  | ||||||
| 		(sizeof(f) < sizeof(d)) && |  | ||||||
| 		(sizeof(i) == sizeof(int)) |  | ||||||
| 	); |  | ||||||
| 	return ret ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,7 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	// must fail because there is no initializer |  | ||||||
| 	auto i; |  | ||||||
|  |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| @@ -1,8 +0,0 @@ | |||||||
| auto foo(int i) -> int { |  | ||||||
| 	return i - 1; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	return foo(1); |  | ||||||
| } |  | ||||||
| @@ -1,21 +0,0 @@ | |||||||
| class base { |  | ||||||
| public: |  | ||||||
|     virtual int foo(int a) |  | ||||||
|      { return 4 + a; } |  | ||||||
|     int bar(int a) final |  | ||||||
|      { return a - 2; } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| class sub final : public base { |  | ||||||
| public: |  | ||||||
|     virtual int foo(int a) override |  | ||||||
|      { return 8 + 2 * a; }; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     base b; |  | ||||||
|     sub s; |  | ||||||
|  |  | ||||||
|     return (b.foo(2) * 2 == s.foo(2)) ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,25 +0,0 @@ | |||||||
| class base { |  | ||||||
| public: |  | ||||||
|     virtual int foo(int a) |  | ||||||
|      { return 4 + a; } |  | ||||||
|     virtual int bar(int a) final |  | ||||||
|      { return a - 2; } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| class sub final : public base { |  | ||||||
| public: |  | ||||||
|     virtual int foo(int a) override |  | ||||||
|      { return 8 + 2 * a; }; |  | ||||||
|     virtual int bar(int a) |  | ||||||
|      { return a; } |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| class impossible : public sub { }; |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     base b; |  | ||||||
|     sub s; |  | ||||||
|  |  | ||||||
|     return 1; |  | ||||||
| } |  | ||||||
| @@ -1,19 +0,0 @@ | |||||||
| constexpr int square(int x) |  | ||||||
| { |  | ||||||
| 	return x*x; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| constexpr int the_answer() |  | ||||||
| { |  | ||||||
| 	return 42; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	int test_arr[square(3)]; |  | ||||||
| 	bool ret = ( |  | ||||||
| 		(square(the_answer()) == 1764) && |  | ||||||
| 		(sizeof(test_arr)/sizeof(test_arr[0]) == 9) |  | ||||||
| 	); |  | ||||||
| 	return ret ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,11 +0,0 @@ | |||||||
| #include <cstdint> |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	bool test = |  | ||||||
| 		(sizeof(int8_t) == 1) && |  | ||||||
| 		(sizeof(int16_t) == 2) && |  | ||||||
| 		(sizeof(int32_t) == 4) && |  | ||||||
| 		(sizeof(int64_t) == 8); |  | ||||||
| 	return test ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,10 +0,0 @@ | |||||||
| bool check_size(int i) |  | ||||||
| { |  | ||||||
| 	return sizeof(int) == sizeof(decltype(i)); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	bool ret = check_size(42); |  | ||||||
| 	return ret ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,27 +0,0 @@ | |||||||
| #include <vector> |  | ||||||
|  |  | ||||||
| class seq { |  | ||||||
| public: |  | ||||||
|     seq(std::initializer_list<int> list); |  | ||||||
|  |  | ||||||
|     int length() const; |  | ||||||
| private: |  | ||||||
|     std::vector<int> m_v; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| seq::seq(std::initializer_list<int> list) |  | ||||||
|     : m_v(list) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int seq::length() const |  | ||||||
| { |  | ||||||
|     return m_v.size(); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
|     seq a = {18, 20, 2, 0, 4, 7}; |  | ||||||
|  |  | ||||||
|     return (a.length() == 6) ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| int main() |  | ||||||
| { |  | ||||||
| 	int ret = 0; |  | ||||||
| 	return ([&ret]() -> int { return ret; })(); |  | ||||||
| } |  | ||||||
| @@ -1,7 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	long long l; |  | ||||||
| 	unsigned long long ul; |  | ||||||
|  |  | ||||||
| 	return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	void *v = nullptr; |  | ||||||
|  |  | ||||||
| 	return v ? 1 : 0; |  | ||||||
| } |  | ||||||
| @@ -1,6 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	int i = nullptr; |  | ||||||
|  |  | ||||||
| 	return 1; |  | ||||||
| } |  | ||||||
| @@ -1,26 +0,0 @@ | |||||||
| #include <algorithm> |  | ||||||
| #include <regex> |  | ||||||
|  |  | ||||||
| int parse_line(std::string const& line) |  | ||||||
| { |  | ||||||
| 	std::string tmp; |  | ||||||
| 	if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+//(-)?(\\d)+(\\s)+"))) { |  | ||||||
| 		tmp = std::regex_replace(line, std::regex("(-)?(\\d)+//(-)?(\\d)+"), std::string("V")); |  | ||||||
| 	} else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { |  | ||||||
| 		tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); |  | ||||||
| 	} else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { |  | ||||||
| 		tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); |  | ||||||
| 	} else { |  | ||||||
| 		tmp = std::regex_replace(line, std::regex("(-)?(\\d)+"), std::string("V")); |  | ||||||
| 	} |  | ||||||
| 	return static_cast<int>(std::count(tmp.begin(), tmp.end(), 'V')); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	bool test = (parse_line("f 7/7/7 -3/3/-3 2/-2/2") == 3) && |  | ||||||
| 				(parse_line("f 7//7 3//-3 -2//2") == 3) && |  | ||||||
| 				(parse_line("f 7/7 3/-3 -2/2") == 3) && |  | ||||||
| 				(parse_line("f 7 3 -2") == 3); |  | ||||||
| 	return test ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,57 +0,0 @@ | |||||||
| #include <cassert> |  | ||||||
|  |  | ||||||
| class rvmove { |  | ||||||
| public: |  | ||||||
|    void *ptr; |  | ||||||
|    char *array; |  | ||||||
|  |  | ||||||
|    rvmove() |  | ||||||
|     : ptr(0), |  | ||||||
|     array(new char[10]) |  | ||||||
|    { |  | ||||||
|      ptr = this; |  | ||||||
|    } |  | ||||||
|  |  | ||||||
|    rvmove(rvmove &&other) |  | ||||||
|     : ptr(other.ptr), |  | ||||||
|     array(other.array) |  | ||||||
|    { |  | ||||||
|     other.array = 0; |  | ||||||
|     other.ptr = 0; |  | ||||||
|    } |  | ||||||
|  |  | ||||||
|    ~rvmove() |  | ||||||
|    { |  | ||||||
|     assert(((ptr != 0) && (array != 0)) || ((ptr == 0) && (array == 0))); |  | ||||||
|     delete[] array; |  | ||||||
|    } |  | ||||||
|  |  | ||||||
|    rvmove &operator=(rvmove &&other) |  | ||||||
|    { |  | ||||||
|      delete[] array; |  | ||||||
|      ptr = other.ptr; |  | ||||||
|      array = other.array; |  | ||||||
|      other.array = 0; |  | ||||||
|      other.ptr = 0; |  | ||||||
|      return *this; |  | ||||||
|    } |  | ||||||
|  |  | ||||||
|    static rvmove create() |  | ||||||
|    { |  | ||||||
|      return rvmove(); |  | ||||||
|    } |  | ||||||
| private: |  | ||||||
|   rvmove(const rvmove &); |  | ||||||
|   rvmove &operator=(const rvmove &); |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
|   rvmove mine; |  | ||||||
|   if (mine.ptr != &mine) |  | ||||||
|     return 1; |  | ||||||
|   mine = rvmove::create(); |  | ||||||
|   if (mine.ptr == &mine) |  | ||||||
|     return 1; |  | ||||||
|   return 0; |  | ||||||
| } |  | ||||||
| @@ -1,7 +0,0 @@ | |||||||
| #include <memory> |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	std::shared_ptr<int> test; |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| @@ -1,14 +0,0 @@ | |||||||
| struct foo { |  | ||||||
| 	char bar; |  | ||||||
| 	int baz; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	bool ret = ( |  | ||||||
| 		(sizeof(foo::bar) == 1) && |  | ||||||
| 		(sizeof(foo::baz) >= sizeof(foo::bar)) && |  | ||||||
| 		(sizeof(foo) >= sizeof(foo::bar) + sizeof(foo::baz)) |  | ||||||
| 	); |  | ||||||
| 	return ret ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,9 +0,0 @@ | |||||||
| struct foo { |  | ||||||
| 	int baz; |  | ||||||
| 	double bar; |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	return (sizeof(foo::bar) == 4) ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	static_assert(0 < 1, "your ordering of integers is screwed"); |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| @@ -1,5 +0,0 @@ | |||||||
| int main(void) |  | ||||||
| { |  | ||||||
| 	static_assert(1 < 0, "your ordering of integers is screwed"); |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| @@ -1,23 +0,0 @@ | |||||||
| int Accumulate() |  | ||||||
| { |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| template<typename T, typename... Ts> |  | ||||||
| int Accumulate(T v, Ts... vs) |  | ||||||
| { |  | ||||||
| 	return v + Accumulate(vs...); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| template<int... Is> |  | ||||||
| int CountElements() |  | ||||||
| { |  | ||||||
| 	return sizeof...(Is); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| int main() |  | ||||||
| { |  | ||||||
| 	int acc = Accumulate(1, 2, 3, 4, -5); |  | ||||||
| 	int count = CountElements<1,2,3,4,5>(); |  | ||||||
| 	return ((acc == 5) && (count == 5)) ? 0 : 1; |  | ||||||
| } |  | ||||||
| @@ -87,7 +87,7 @@ void OpenGLWidget::setVolume(PolyVox::LargeVolume<MaterialDensityPair44>* volDat | |||||||
| 					//Extract the surface for this region | 					//Extract the surface for this region | ||||||
| 					//extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), meshCurrent); | 					//extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), meshCurrent); | ||||||
|  |  | ||||||
| 					polyvox_shared_ptr< SurfaceMesh<PositionMaterialNormal> > mesh(new SurfaceMesh<PositionMaterialNormal>); | 					std::shared_ptr< SurfaceMesh<PositionMaterialNormal> > mesh(new SurfaceMesh<PositionMaterialNormal>); | ||||||
| 					MarchingCubesSurfaceExtractor< LargeVolume<MaterialDensityPair44> > surfaceExtractor(volData, PolyVox::Region(regLowerCorner, regUpperCorner), mesh.get()); | 					MarchingCubesSurfaceExtractor< LargeVolume<MaterialDensityPair44> > surfaceExtractor(volData, PolyVox::Region(regLowerCorner, regUpperCorner), mesh.get()); | ||||||
| 					surfaceExtractor.execute(); | 					surfaceExtractor.execute(); | ||||||
|  |  | ||||||
| @@ -193,7 +193,7 @@ void OpenGLWidget::paintGL() | |||||||
| 					Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ); | 					Vector3DUint8 v3dRegPos(uRegionX,uRegionY,uRegionZ); | ||||||
| 					if(m_mapSurfaceMeshes.find(v3dRegPos) != m_mapSurfaceMeshes.end()) | 					if(m_mapSurfaceMeshes.find(v3dRegPos) != m_mapSurfaceMeshes.end()) | ||||||
| 					{ | 					{ | ||||||
| 						polyvox_shared_ptr< SurfaceMesh<PositionMaterialNormal> > meshCurrent = m_mapSurfaceMeshes[v3dRegPos]; | 						std::shared_ptr< SurfaceMesh<PositionMaterialNormal> > meshCurrent = m_mapSurfaceMeshes[v3dRegPos]; | ||||||
| 						unsigned int uLodLevel = 0; //meshCurrent->m_vecLodRecords.size() - 1; | 						unsigned int uLodLevel = 0; //meshCurrent->m_vecLodRecords.size() - 1; | ||||||
| 						if(m_bUseOpenGLVertexBufferObjects) | 						if(m_bUseOpenGLVertexBufferObjects) | ||||||
| 						{													 | 						{													 | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ class OpenGLWidget : public QGLWidget | |||||||
|  |  | ||||||
| 	//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region | 	//Rather than storing one big mesh, the volume is broken into regions and a mesh is stored for each region | ||||||
| 	std::map<PolyVox::Vector3DUint8, OpenGLSurfaceMesh, Vector3DUint8Compare> m_mapOpenGLSurfaceMeshes; | 	std::map<PolyVox::Vector3DUint8, OpenGLSurfaceMesh, Vector3DUint8Compare> m_mapOpenGLSurfaceMeshes; | ||||||
| 	std::map<PolyVox::Vector3DUint8, polyvox_shared_ptr<PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal> >, Vector3DUint8Compare> m_mapSurfaceMeshes; | 	std::map<PolyVox::Vector3DUint8, std::shared_ptr<PolyVox::SurfaceMesh<PolyVox::PositionMaterialNormal> >, Vector3DUint8Compare> m_mapSurfaceMeshes; | ||||||
|  |  | ||||||
| 	unsigned int m_uRegionSideLength; | 	unsigned int m_uRegionSideLength; | ||||||
| 	unsigned int m_uVolumeWidthInRegions; | 	unsigned int m_uVolumeWidthInRegions; | ||||||
|   | |||||||
| @@ -22,11 +22,6 @@ | |||||||
|  |  | ||||||
| PROJECT(PolyVoxCore) | PROJECT(PolyVoxCore) | ||||||
|  |  | ||||||
| if(NOT MSVC) |  | ||||||
| 	#Set up the C++11 feature header file based on the CheckCXX11Features script |  | ||||||
| 	CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/PolyVoxCore/Impl/CompilerCapabilities.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/PolyVoxCore/Impl/CompilerCapabilities.h) |  | ||||||
| endif() |  | ||||||
|  |  | ||||||
| #Projects source files | #Projects source files | ||||||
| SET(CORE_SRC_FILES | SET(CORE_SRC_FILES | ||||||
| 	source/ArraySizes.cpp | 	source/ArraySizes.cpp | ||||||
| @@ -119,7 +114,6 @@ SET(IMPL_INC_FILES | |||||||
| 	include/PolyVoxCore/Impl/ArraySizesImpl.h | 	include/PolyVoxCore/Impl/ArraySizesImpl.h | ||||||
| 	include/PolyVoxCore/Impl/ArraySizesImpl.inl | 	include/PolyVoxCore/Impl/ArraySizesImpl.inl | ||||||
| 	include/PolyVoxCore/Impl/AStarPathfinderImpl.h | 	include/PolyVoxCore/Impl/AStarPathfinderImpl.h | ||||||
|     include/PolyVoxCore/Impl/CompilerCapabilities.h |  | ||||||
|     include/PolyVoxCore/Impl/Config.h |     include/PolyVoxCore/Impl/Config.h | ||||||
| 	include/PolyVoxCore/Impl/ErrorHandling.h | 	include/PolyVoxCore/Impl/ErrorHandling.h | ||||||
| 	include/PolyVoxCore/Impl/Logging.h | 	include/PolyVoxCore/Impl/Logging.h | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "PolyVoxCore/Array.h" | #include "PolyVoxCore/Array.h" | ||||||
|  |  | ||||||
|  | #include <functional> | ||||||
| #include <list> | #include <list> | ||||||
| #include <stdexcept> //For runtime_error | #include <stdexcept> //For runtime_error | ||||||
|  |  | ||||||
| @@ -71,8 +72,8 @@ namespace PolyVox | |||||||
| 			float fHBias = 1.0, | 			float fHBias = 1.0, | ||||||
| 			uint32_t uMaxNoOfNodes = 10000, | 			uint32_t uMaxNoOfNodes = 10000, | ||||||
| 			Connectivity requiredConnectivity = TwentySixConnected, | 			Connectivity requiredConnectivity = TwentySixConnected, | ||||||
| 			polyvox_function<bool (const VolumeType*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator, | 			std::function<bool (const VolumeType*, const Vector3DInt32&)> funcIsVoxelValidForPath = &aStarDefaultVoxelValidator, | ||||||
| 			polyvox_function<void (float)> funcProgressCallback = nullptr | 			std::function<void (float)> funcProgressCallback = nullptr | ||||||
| 		) | 		) | ||||||
| 			:volume(volData) | 			:volume(volData) | ||||||
| 			,start(v3dStart) | 			,start(v3dStart) | ||||||
| @@ -126,14 +127,14 @@ namespace PolyVox | |||||||
| 		/// you could check to ensure that the voxel above is empty and the voxel below is solid. | 		/// you could check to ensure that the voxel above is empty and the voxel below is solid. | ||||||
| 		/// | 		/// | ||||||
| 		/// \sa aStarDefaultVoxelValidator | 		/// \sa aStarDefaultVoxelValidator | ||||||
| 		polyvox_function<bool (const VolumeType*, const Vector3DInt32&)> isVoxelValidForPath; | 		std::function<bool (const VolumeType*, const Vector3DInt32&)> isVoxelValidForPath; | ||||||
|  |  | ||||||
| 		/// This function is called by the AStarPathfinder to report on its progress in getting to | 		/// This function is called by the AStarPathfinder to report on its progress in getting to | ||||||
| 		/// the goal. The progress is reported by computing the distance from the closest node found | 		/// the goal. The progress is reported by computing the distance from the closest node found | ||||||
| 		/// so far to the end node, and comparing this with the distance from the start node to the | 		/// so far to the end node, and comparing this with the distance from the start node to the | ||||||
| 		/// end node. This progress value is guarenteed to never decrease, but it may stop increasing | 		/// end node. This progress value is guarenteed to never decrease, but it may stop increasing | ||||||
| 		///for short periods of time. It may even stop increasing altogether if a path cannot be found. | 		///for short periods of time. It may even stop increasing altogether if a path cannot be found. | ||||||
| 		polyvox_function<void (float)> progressCallback; | 		std::function<void (float)> progressCallback; | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	/// The AStarPathfinder compute a path from one point in the volume to another. | 	/// The AStarPathfinder compute a path from one point in the volume to another. | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "PolyVoxCore/Impl/TypeDef.h" | #include "PolyVoxCore/Impl/TypeDef.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	template<typename VoxelType> | 	template<typename VoxelType> | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ distribution. | |||||||
|  |  | ||||||
| #include "PolyVoxCore/Impl/TypeDef.h" | #include "PolyVoxCore/Impl/TypeDef.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	/* | 	/* | ||||||
|   | |||||||
| @@ -1,23 +0,0 @@ | |||||||
| /* |  | ||||||
|  * This file describes the capabilities of the C++ compiler and is used to determine which features to enable in PolyVox. |  | ||||||
|  * It assumes that if the compiler is from VS2008 or earlier then no C++11 is present, otherwise it assumes full support |  | ||||||
|  * is present. |  | ||||||
|  * |  | ||||||
|  * Not that this file is usually overwritten by CMake which does careful tests of the true compiler capabilities. However, |  | ||||||
|  * we provide this default file so that CMake is not actually required for users of PolyVox and they can instead just drop |  | ||||||
|  * PolyVox code into their project/makefile if they prefer. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #ifndef __PolyVox_CompilerCapabilities_H__ |  | ||||||
| #define __PolyVox_CompilerCapabilities_H__ |  | ||||||
|  |  | ||||||
| // If we are not using Visual Studio (or we are but it |  | ||||||
| // is a recent version) then assume support for these. |  | ||||||
| #if !defined(_MSC_VER) || (_MSC_VER >= 1600) |  | ||||||
| 	#define HAS_CXX11_CONSTEXPR |  | ||||||
| 	#define HAS_CXX11_STATIC_ASSERT |  | ||||||
| 	#define HAS_CXX11_CSTDINT_H |  | ||||||
| 	#define HAS_CXX11_SHARED_PTR |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @@ -1,17 +0,0 @@ | |||||||
| /* |  | ||||||
|  * This file is an input file for the CMake build system. It is processed and |  | ||||||
|  * placed in the build directory by CMake. |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| #ifndef __PolyVox_CompilerCapabilities_H__ |  | ||||||
| #define __PolyVox_CompilerCapabilities_H__ |  | ||||||
|  |  | ||||||
| #cmakedefine HAS_CXX11_CONSTEXPR |  | ||||||
|  |  | ||||||
| #cmakedefine HAS_CXX11_STATIC_ASSERT |  | ||||||
|  |  | ||||||
| #cmakedefine HAS_CXX11_CSTDINT_H |  | ||||||
|  |  | ||||||
| #cmakedefine HAS_CXX11_SHARED_PTR |  | ||||||
|  |  | ||||||
| #endif |  | ||||||
| @@ -110,35 +110,6 @@ freely, subject to the following restrictions: | |||||||
| 	 | 	 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* |  | ||||||
|  * Static Assertions |  | ||||||
|  * ----------------- |  | ||||||
|  * These map to C+11 static_assert if available or our own implentation otherwise. |  | ||||||
|  */ |  | ||||||
|  |  | ||||||
| #if defined(HAS_CXX11_STATIC_ASSERT) |  | ||||||
| 	//In this case we can just use static_assert |  | ||||||
| 	#define POLYVOX_STATIC_ASSERT static_assert |  | ||||||
| #else |  | ||||||
| 	namespace PolyVox |  | ||||||
| 	{ |  | ||||||
| 		// empty default template |  | ||||||
| 		template <bool b> |  | ||||||
| 		struct StaticAssert {}; |  | ||||||
|  |  | ||||||
| 		// template specialized on true |  | ||||||
| 		template <> |  | ||||||
| 		struct StaticAssert<true> |  | ||||||
| 		{ |  | ||||||
| 			// If the static assertion is failing then this function won't exist. It will then |  | ||||||
| 			// appear in the error message which gives a clue to the user about what is wrong. |  | ||||||
| 			static void ERROR_The_static_assertion_has_failed() {} |  | ||||||
| 		}; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#define POLYVOX_STATIC_ASSERT(condition, message) StaticAssert<(condition)>::ERROR_The_static_assertion_has_failed(); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Exceptions |  * Exceptions | ||||||
|  * ---------- |  * ---------- | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "PolyVoxCore/Impl/TypeDef.h" | #include "PolyVoxCore/Impl/TypeDef.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	extern const POLYVOX_API uint16_t edgeTable[256]; | 	extern const POLYVOX_API uint16_t edgeTable[256]; | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "PolyVoxCore/Impl/TypeDef.h" | #include "PolyVoxCore/Impl/TypeDef.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	template <uint32_t noOfDims, typename ElementType> class Array; | 	template <uint32_t noOfDims, typename ElementType> class Array; | ||||||
|   | |||||||
| @@ -24,8 +24,6 @@ freely, subject to the following restrictions: | |||||||
| #ifndef __PolyVox_TypeDef_H__ | #ifndef __PolyVox_TypeDef_H__ | ||||||
| #define __PolyVox_TypeDef_H__ | #define __PolyVox_TypeDef_H__ | ||||||
|  |  | ||||||
| #include "PolyVoxCore/Impl/CompilerCapabilities.h" |  | ||||||
|  |  | ||||||
| //Definitions needed to make library functions accessable | //Definitions needed to make library functions accessable | ||||||
| // See http://gcc.gnu.org/wiki/Visibility for more info. | // See http://gcc.gnu.org/wiki/Visibility for more info. | ||||||
| #if defined _WIN32 || defined __CYGWIN__ | #if defined _WIN32 || defined __CYGWIN__ | ||||||
| @@ -69,52 +67,4 @@ freely, subject to the following restrictions: | |||||||
|   #define POLYVOX_LOCAL |   #define POLYVOX_LOCAL | ||||||
| #endif // POLYVOX_SHARED | #endif // POLYVOX_SHARED | ||||||
|  |  | ||||||
| //Check which compiler we are using and work around unsupported features as necessary. |  | ||||||
| #if defined(_MSC_VER) && (_MSC_VER < 1600)  |  | ||||||
| 	//To support old (pre-vc2010) Microsoft compilers we use boost to replace the |  | ||||||
| 	//std::shared_ptr and potentially other C++0x features. To use this capability you |  | ||||||
| 	//will need to make sure you have boost installed on your system. |  | ||||||
| 	#include <boost/function.hpp> |  | ||||||
| 	#define polyvox_function boost::function |  | ||||||
|  |  | ||||||
| 	#include <boost/bind.hpp> |  | ||||||
| 	#define polyvox_bind boost::bind |  | ||||||
| 	#define polyvox_placeholder_1 _1 |  | ||||||
| 	#define polyvox_placeholder_2 _2 |  | ||||||
| #else |  | ||||||
| 	//We have a decent compiler - use real C++0x features |  | ||||||
| 	#include <functional> |  | ||||||
| 	#define polyvox_function std::function |  | ||||||
| 	#define polyvox_bind std::bind |  | ||||||
| 	#define polyvox_placeholder_1 std::placeholders::_1 |  | ||||||
| 	#define polyvox_placeholder_2 std::placeholders::_2 |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined(HAS_CXX11_CONSTEXPR) |  | ||||||
| 	#define polyvox_constexpr_const constexpr //constexpr which falls back to const |  | ||||||
| 	#define polyvox_constexpr constexpr //constexpr which falls back to nothing |  | ||||||
| #else |  | ||||||
| 	#define polyvox_constexpr_const const |  | ||||||
| 	#define polyvox_constexpr |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined(HAS_CXX11_CSTDINT_H) |  | ||||||
| 	#include <cstdint> |  | ||||||
| #else |  | ||||||
| 	typedef signed char     int8_t; |  | ||||||
| 	typedef unsigned char   uint8_t; |  | ||||||
| 	typedef short           int16_t; |  | ||||||
| 	typedef unsigned short  uint16_t; |  | ||||||
| 	typedef long            int32_t; |  | ||||||
| 	typedef unsigned long   uint32_t; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined(HAS_CXX11_SHARED_PTR) |  | ||||||
| 	#include <memory> |  | ||||||
| 	#define polyvox_shared_ptr std::shared_ptr |  | ||||||
| #else |  | ||||||
| 	#include <boost/smart_ptr.hpp> |  | ||||||
| 	#define polyvox_shared_ptr boost::shared_ptr |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "PolyVoxCore/Impl/TypeDef.h" | #include "PolyVoxCore/Impl/TypeDef.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	POLYVOX_API uint8_t logBase2(uint32_t uInput); | 	POLYVOX_API uint8_t logBase2(uint32_t uInput); | ||||||
|   | |||||||
| @@ -26,6 +26,8 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "Impl/TypeDef.h" | #include "Impl/TypeDef.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
|   | |||||||
| @@ -75,7 +75,7 @@ namespace PolyVox | |||||||
| 	   //RATE THE STD::SET CAUSES PROBLEMS WITH SWIG. IF YOU UNCOMMENT ANY OF THESE FUNCTIONS, PLEASE POST ON | 	   //RATE THE STD::SET CAUSES PROBLEMS WITH SWIG. IF YOU UNCOMMENT ANY OF THESE FUNCTIONS, PLEASE POST ON | ||||||
| 	   //THE FORUM SO WE CAN KNOW THE FUNCTIONALITY IS STILL NEEDED IN SOME FORM. | 	   //THE FORUM SO WE CAN KNOW THE FUNCTIONALITY IS STILL NEEDED IN SOME FORM. | ||||||
| 	   //void sumNearbyNormals(bool bNormaliseResult = true); | 	   //void sumNearbyNormals(bool bNormaliseResult = true); | ||||||
| 	   //polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(std::set<uint8_t> setMaterials); | 	   //std::shared_ptr< SurfaceMesh<VertexType> > extractSubset(std::set<uint8_t> setMaterials); | ||||||
| 	   //void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false); | 	   //void generateAveragedFaceNormals(bool bNormalise, bool bIncludeEdgeVertices = false); | ||||||
|  |  | ||||||
| 	   int noOfDegenerateTris(void); | 	   int noOfDegenerateTris(void); | ||||||
| @@ -96,7 +96,7 @@ namespace PolyVox | |||||||
| 	};	 | 	};	 | ||||||
|  |  | ||||||
| 	template <typename VertexType> | 	template <typename VertexType> | ||||||
| 	polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials); | 	std::shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials); | ||||||
| } | } | ||||||
|  |  | ||||||
| #include "PolyVoxCore/SurfaceMesh.inl" | #include "PolyVoxCore/SurfaceMesh.inl" | ||||||
|   | |||||||
| @@ -245,9 +245,9 @@ namespace PolyVox | |||||||
| 	}*/ | 	}*/ | ||||||
|  |  | ||||||
| 	/*template <typename VertexType> | 	/*template <typename VertexType> | ||||||
| 	polyvox_shared_ptr< SurfaceMesh<VertexType> > SurfaceMesh<VertexType>::extractSubset(std::set<uint8_t> setMaterials) | 	std::shared_ptr< SurfaceMesh<VertexType> > SurfaceMesh<VertexType>::extractSubset(std::set<uint8_t> setMaterials) | ||||||
| 	{ | 	{ | ||||||
| 		polyvox_shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>); | 		std::shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>); | ||||||
|  |  | ||||||
| 		if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise... | 		if(m_vecVertices.size() == 0) //FIXME - I don't think we should need this test, but I have seen crashes otherwise... | ||||||
| 		{ | 		{ | ||||||
| @@ -395,9 +395,9 @@ namespace PolyVox | |||||||
|  |  | ||||||
| 	//Currently a free function - think where this needs to go. | 	//Currently a free function - think where this needs to go. | ||||||
| 	template <typename VertexType> | 	template <typename VertexType> | ||||||
| 	polyvox_shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials) | 	std::shared_ptr< SurfaceMesh<VertexType> > extractSubset(SurfaceMesh<VertexType>& inputMesh, std::set<uint8_t> setMaterials) | ||||||
| 	{ | 	{ | ||||||
| 		polyvox_shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>); | 		std::shared_ptr< SurfaceMesh<VertexType> > result(new SurfaceMesh<VertexType>); | ||||||
| 		 | 		 | ||||||
| 		result->m_Region = inputMesh.m_Region; | 		result->m_Region = inputMesh.m_Region; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ namespace PolyVox | |||||||
|     template <uint32_t Size,typename StorageType, typename OperationType> |     template <uint32_t Size,typename StorageType, typename OperationType> | ||||||
|     Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y) |     Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y) | ||||||
|     { |     { | ||||||
| 		POLYVOX_STATIC_ASSERT(Size == 2, "This constructor should only be used for vectors with two elements."); | 		static_assert(Size == 2, "This constructor should only be used for vectors with two elements."); | ||||||
|  |  | ||||||
| 		m_tElements[0] = x; | 		m_tElements[0] = x; | ||||||
| 		m_tElements[1] = y; | 		m_tElements[1] = y; | ||||||
| @@ -68,7 +68,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size,typename StorageType, typename OperationType> | 	template <uint32_t Size,typename StorageType, typename OperationType> | ||||||
| 	Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y, StorageType z) | 	Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y, StorageType z) | ||||||
| 	{ | 	{ | ||||||
| 		POLYVOX_STATIC_ASSERT(Size == 3, "This constructor should only be used for vectors with three elements."); | 		static_assert(Size == 3, "This constructor should only be used for vectors with three elements."); | ||||||
|  |  | ||||||
| 		m_tElements[0] = x; | 		m_tElements[0] = x; | ||||||
| 		m_tElements[1] = y; | 		m_tElements[1] = y; | ||||||
| @@ -86,7 +86,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size,typename StorageType, typename OperationType> | 	template <uint32_t Size,typename StorageType, typename OperationType> | ||||||
| 	Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y, StorageType z, StorageType w) | 	Vector<Size,StorageType,OperationType>::Vector(StorageType x, StorageType y, StorageType z, StorageType w) | ||||||
| 	{ | 	{ | ||||||
| 		POLYVOX_STATIC_ASSERT(Size == 4, "This constructor should only be used for vectors with four elements."); | 		static_assert(Size == 4, "This constructor should only be used for vectors with four elements."); | ||||||
|  |  | ||||||
| 		m_tElements[0] = x; | 		m_tElements[0] = x; | ||||||
| 		m_tElements[1] = y; | 		m_tElements[1] = y; | ||||||
| @@ -136,7 +136,7 @@ namespace PolyVox | |||||||
| 		// vector with one element, and supporting this would cause confusion over the | 		// vector with one element, and supporting this would cause confusion over the | ||||||
| 		// behaviour of the constructor taking a single value, as this fills all elements | 		// behaviour of the constructor taking a single value, as this fills all elements | ||||||
| 		// to that value rather than just the first one. | 		// to that value rather than just the first one. | ||||||
| 		POLYVOX_STATIC_ASSERT(Size > 1, "Vector must have a length greater than one."); | 		static_assert(Size > 1, "Vector must have a length greater than one."); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -446,7 +446,7 @@ namespace PolyVox | |||||||
|     template <uint32_t Size, typename StorageType, typename OperationType> |     template <uint32_t Size, typename StorageType, typename OperationType> | ||||||
| 	inline StorageType Vector<Size, StorageType, OperationType>::getZ(void) const | 	inline StorageType Vector<Size, StorageType, OperationType>::getZ(void) const | ||||||
|     { |     { | ||||||
| 		POLYVOX_STATIC_ASSERT(Size >= 3, "You can only get the 'z' component from a vector with at least three elements."); | 		static_assert(Size >= 3, "You can only get the 'z' component from a vector with at least three elements."); | ||||||
|  |  | ||||||
|         return m_tElements[2]; |         return m_tElements[2]; | ||||||
|     }	 |     }	 | ||||||
| @@ -457,7 +457,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size, typename StorageType, typename OperationType> | 	template <uint32_t Size, typename StorageType, typename OperationType> | ||||||
| 	inline StorageType Vector<Size, StorageType, OperationType>::getW(void) const | 	inline StorageType Vector<Size, StorageType, OperationType>::getW(void) const | ||||||
| 	{ | 	{ | ||||||
| 		POLYVOX_STATIC_ASSERT(Size >= 4, "You can only get the 'w' component from a vector with at least four elements."); | 		static_assert(Size >= 4, "You can only get the 'w' component from a vector with at least four elements."); | ||||||
|  |  | ||||||
| 		return m_tElements[3]; | 		return m_tElements[3]; | ||||||
| 	}   | 	}   | ||||||
| @@ -499,7 +499,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size,typename StorageType, typename OperationType> | 	template <uint32_t Size,typename StorageType, typename OperationType> | ||||||
| 	inline void Vector<Size,StorageType,OperationType>::setElements(StorageType x, StorageType y, StorageType z) | 	inline void Vector<Size,StorageType,OperationType>::setElements(StorageType x, StorageType y, StorageType z) | ||||||
| 	{ | 	{ | ||||||
| 		POLYVOX_STATIC_ASSERT(Size >= 3, "You can only use this version of setElements() on a vector with at least three elements."); | 		static_assert(Size >= 3, "You can only use this version of setElements() on a vector with at least three elements."); | ||||||
|  |  | ||||||
| 		m_tElements[0] = x; | 		m_tElements[0] = x; | ||||||
| 		m_tElements[1] = y; | 		m_tElements[1] = y; | ||||||
| @@ -516,7 +516,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size,typename StorageType, typename OperationType> | 	template <uint32_t Size,typename StorageType, typename OperationType> | ||||||
| 	inline void Vector<Size,StorageType,OperationType>::setElements(StorageType x, StorageType y, StorageType z, StorageType w) | 	inline void Vector<Size,StorageType,OperationType>::setElements(StorageType x, StorageType y, StorageType z, StorageType w) | ||||||
| 	{ | 	{ | ||||||
| 		POLYVOX_STATIC_ASSERT(Size >= 4, "You can only use this version of setElements() on a vector with at least four elements."); | 		static_assert(Size >= 4, "You can only use this version of setElements() on a vector with at least four elements."); | ||||||
|  |  | ||||||
| 		m_tElements[0] = x; | 		m_tElements[0] = x; | ||||||
| 		m_tElements[1] = y; | 		m_tElements[1] = y; | ||||||
| @@ -548,7 +548,7 @@ namespace PolyVox | |||||||
|     template <uint32_t Size, typename StorageType, typename OperationType> |     template <uint32_t Size, typename StorageType, typename OperationType> | ||||||
| 	inline void Vector<Size, StorageType, OperationType>::setZ(StorageType tZ) | 	inline void Vector<Size, StorageType, OperationType>::setZ(StorageType tZ) | ||||||
|     { |     { | ||||||
| 		POLYVOX_STATIC_ASSERT(Size >= 3, "You can only set the 'w' component from a vector with at least three elements."); | 		static_assert(Size >= 3, "You can only set the 'w' component from a vector with at least three elements."); | ||||||
|  |  | ||||||
| 		m_tElements[2] = tZ; | 		m_tElements[2] = tZ; | ||||||
|     } |     } | ||||||
| @@ -559,7 +559,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size, typename StorageType, typename OperationType> | 	template <uint32_t Size, typename StorageType, typename OperationType> | ||||||
| 	inline void Vector<Size, StorageType, OperationType>::setW(StorageType tW) | 	inline void Vector<Size, StorageType, OperationType>::setW(StorageType tW) | ||||||
|     { |     { | ||||||
| 		POLYVOX_STATIC_ASSERT(Size >= 4, "You can only set the 'w' component from a vector with at least four elements."); | 		static_assert(Size >= 4, "You can only set the 'w' component from a vector with at least four elements."); | ||||||
|  |  | ||||||
| 		m_tElements[3] = tW; | 		m_tElements[3] = tW; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -23,6 +23,8 @@ freely, subject to the following restrictions: | |||||||
|  |  | ||||||
| #include "PolyVoxCore/ArraySizes.h" | #include "PolyVoxCore/ArraySizes.h" | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| {	 | {	 | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| %module PolyVoxCore | %module PolyVoxCore | ||||||
|  |  | ||||||
| #define POLYVOX_API | #define POLYVOX_API | ||||||
| %include "PolyVoxCore/Impl/CompilerCapabilities.h" |  | ||||||
| %include "Impl/TypeDef.h" | %include "Impl/TypeDef.h" | ||||||
| #define __attribute__(x) //Silence DEPRECATED errors | #define __attribute__(x) //Silence DEPRECATED errors | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user