| @@ -227,11 +227,7 @@ public: | |||||
| } | } | ||||
| summary << "\n\n"; | summary << "\n\n"; | ||||
| #if _WIN32 | |||||
| ::OutputDebugStringA(summary.str().c_str()); | |||||
| #else | |||||
| std::cout << summary.str(); | std::cout << summary.str(); | ||||
| #endif | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| @@ -436,5 +432,5 @@ public: | |||||
| #define lolunit_assert_doubles_equal_message(msg, a, b, t) \ | #define lolunit_assert_doubles_equal_message(msg, a, b, t) \ | ||||
| lolunit_assert_doubles_equal_generic(make_msg(msg), a, b, t) | lolunit_assert_doubles_equal_generic(make_msg(msg), a, b, t) | ||||
| } /* namespace lol */ | |||||
| } // namespace lol | |||||
| @@ -22,6 +22,7 @@ | |||||
| #include "../base/private/features.h" | #include "../base/private/features.h" | ||||
| #include <vector> // std::vector | #include <vector> // std::vector | ||||
| #include <algorithm> // std::min | |||||
| #include <functional> // std::function | #include <functional> // std::function | ||||
| #include <tuple> // std::tuple | #include <tuple> // std::tuple | ||||
| #include <cassert> // assert() | #include <cassert> // assert() | ||||
| @@ -16,9 +16,13 @@ | |||||
| #include <cmath> // std::tan | #include <cmath> // std::tan | ||||
| #include <algorithm> // std::max | #include <algorithm> // std::max | ||||
| #if _WIN32 | |||||
| #if _MSC_VER | |||||
| # pragma push_macro("min") | |||||
| # pragma push_macro("max") | |||||
| # pragma push_macro("near") | # pragma push_macro("near") | ||||
| # pragma push_macro("far") | # pragma push_macro("far") | ||||
| # undef min | |||||
| # undef max | |||||
| # undef near | # undef near | ||||
| # undef far | # undef far | ||||
| #endif | #endif | ||||
| @@ -290,6 +294,8 @@ inline mat4 mat4::shifted_perspective(float fov_y, float screen_size, | |||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| #if _WIN32 | #if _WIN32 | ||||
| # pragma pop_macro("min") | |||||
| # pragma pop_macro("max") | |||||
| # pragma pop_macro("near") | # pragma pop_macro("near") | ||||
| # pragma pop_macro("far") | # pragma pop_macro("far") | ||||
| #endif | #endif | ||||
| @@ -27,6 +27,13 @@ | |||||
| #include "private/ops.h" | #include "private/ops.h" | ||||
| #if _MSC_VER | |||||
| # pragma push_macro("min") | |||||
| # pragma push_macro("max") | |||||
| # undef min | |||||
| # undef max | |||||
| #endif | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| @@ -1419,3 +1426,7 @@ typedef ivec12 int12; | |||||
| #include "private/vector.ipp" | #include "private/vector.ipp" | ||||
| #if _MSC_VER | |||||
| # pragma pop_macro("min") | |||||
| # pragma pop_macro("max") | |||||
| #endif | |||||
| @@ -17,7 +17,7 @@ | |||||
| #include <lol/math/vector.h> // vec_t | #include <lol/math/vector.h> // vec_t | ||||
| #include <lol/math/rand.h> // rand() | #include <lol/math/rand.h> // rand() | ||||
| #include <vector> // std::vector | |||||
| #include <array> // std::array | |||||
| #include <algorithm> // std::min | #include <algorithm> // std::min | ||||
| namespace lol | namespace lol | ||||
| @@ -33,6 +33,10 @@ public: | |||||
| } | } | ||||
| protected: | protected: | ||||
| // Generate 2^(N+2) random vectors, but at least 2^5 (32) and not | |||||
| // more than 2^20 (~ 1 million). | |||||
| static int constexpr gradient_count = 1 << std::min(std::max(N + 2, 5), 20); | |||||
| vec_t<float, N> get_gradient(vec_t<int, N> origin) const | vec_t<float, N> get_gradient(vec_t<int, N> origin) const | ||||
| { | { | ||||
| /* Quick shuffle table: | /* Quick shuffle table: | ||||
| @@ -60,10 +64,6 @@ protected: | |||||
| 137, 29, 23, 223, 108, 102, 86, 198, 227, 35, 229, 76, 168, 132, | 137, 29, 23, 223, 108, 102, 86, 198, 227, 35, 229, 76, 168, 132, | ||||
| }; | }; | ||||
| /* Generate 2^(N+2) random vectors, but at least 2^5 (32) and not | |||||
| * more than 2^20 (~ 1 million). */ | |||||
| int constexpr gradient_count = 1 << std::min(std::max(N + 2, 5), 20); | |||||
| static auto build_gradients = [&]() | static auto build_gradients = [&]() | ||||
| { | { | ||||
| std::array<vec_t<float, N>, gradient_count> ret; | std::array<vec_t<float, N>, gradient_count> ret; | ||||