Browse Source

Various Windows compilation fixes.

wip/core-clipp
Sam Hocevar 5 years ago
parent
commit
ecc3aee6e1
5 changed files with 25 additions and 11 deletions
  1. +1
    -5
      include/lol/base/lolunit.h
  2. +1
    -0
      include/lol/math/polynomial.h
  3. +7
    -1
      include/lol/math/private/matrix.ipp
  4. +11
    -0
      include/lol/math/vector.h
  5. +5
    -5
      legacy/lol/math/noise/gradient.h

+ 1
- 5
include/lol/base/lolunit.h View File

@@ -227,11 +227,7 @@ public:
}
summary << "\n\n";

#if _WIN32
::OutputDebugStringA(summary.str().c_str());
#else
std::cout << summary.str();
#endif

return ret;
}
@@ -436,5 +432,5 @@ public:
#define lolunit_assert_doubles_equal_message(msg, a, b, t) \
lolunit_assert_doubles_equal_generic(make_msg(msg), a, b, t)

} /* namespace lol */
} // namespace lol


+ 1
- 0
include/lol/math/polynomial.h View File

@@ -22,6 +22,7 @@
#include "../base/private/features.h"

#include <vector> // std::vector
#include <algorithm> // std::min
#include <functional> // std::function
#include <tuple> // std::tuple
#include <cassert> // assert()


+ 7
- 1
include/lol/math/private/matrix.ipp View File

@@ -16,9 +16,13 @@
#include <cmath> // std::tan
#include <algorithm> // std::max

#if _WIN32
#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# pragma push_macro("near")
# pragma push_macro("far")
# undef min
# undef max
# undef near
# undef far
#endif
@@ -290,6 +294,8 @@ inline mat4 mat4::shifted_perspective(float fov_y, float screen_size,
} /* namespace lol */

#if _WIN32
# pragma pop_macro("min")
# pragma pop_macro("max")
# pragma pop_macro("near")
# pragma pop_macro("far")
#endif


+ 11
- 0
include/lol/math/vector.h View File

@@ -27,6 +27,13 @@

#include "private/ops.h"

#if _MSC_VER
# pragma push_macro("min")
# pragma push_macro("max")
# undef min
# undef max
#endif

namespace lol
{

@@ -1419,3 +1426,7 @@ typedef ivec12 int12;

#include "private/vector.ipp"

#if _MSC_VER
# pragma pop_macro("min")
# pragma pop_macro("max")
#endif

+ 5
- 5
legacy/lol/math/noise/gradient.h View File

@@ -17,7 +17,7 @@
#include <lol/math/vector.h> // vec_t
#include <lol/math/rand.h> // rand()

#include <vector> // std::vector
#include <array> // std::array
#include <algorithm> // std::min

namespace lol
@@ -33,6 +33,10 @@ public:
}

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
{
/* Quick shuffle table:
@@ -60,10 +64,6 @@ protected:
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 = [&]()
{
std::array<vec_t<float, N>, gradient_count> ret;


Loading…
Cancel
Save