145#define GLM_ENABLE_EXPERIMENTAL
146#include <glm/glm.hpp>
147#include <glm/gtx/rotate_vector.hpp>
148#include <glm/gtc/type_ptr.hpp>
149#include <glm/gtx/norm.hpp>
150#include <glm/gtx/vector_angle.hpp>
152#include <boost/unordered/unordered_flat_map.hpp>
153#include <boost/unordered/unordered_flat_set.hpp>
156#include <boost/pool/object_pool.hpp>
157#include <boost/asio/io_service.hpp>
158#include <boost/bind/bind.hpp>
159#include <boost/thread/thread.hpp>
160#include <boost/thread/locks.hpp>
162#define T2D_NAMESPACE_BEGIN namespace t2d {
163#define T2D_NAMESPACE_END }
168using vec2 = glm::vec<2, Float, glm::packed_lowp>;
176 T
constexpr sqrtNewtonRaphson(T x, T curr, T prev)
180 : sqrtNewtonRaphson<T>(x, (T)0.5 * (curr + x / curr), curr);
192 return x >= 0 && x < std::numeric_limits<T>::infinity()
193 ? impl::sqrtNewtonRaphson<T>(x, x, 0)
194 : std::numeric_limits<T>::quiet_NaN();
197static constexpr Float tileWidth = 10.0f;
198static constexpr Float tileHeight = 10.0f;
199static constexpr vec2 tileSize = vec2(tileWidth, tileHeight);
200static constexpr Float tileRadi = sqrt<Float>(tileWidth * tileWidth + tileHeight * tileHeight) * 0.5f;
202static constexpr size_t chunkSideLength = 4;
203static constexpr size_t chunkWidth = chunkSideLength;
204static constexpr size_t chunkHeight = chunkSideLength;
205static constexpr Float tcW = (Float)tileWidth * (Float)chunkWidth;
206static constexpr Float tcH = (Float)tileHeight * (Float)chunkHeight;
208template<
typename K,
typename T>
209using FlatMap = boost::unordered_flat_map<K, T>;
212using FlatSet = boost::unordered_flat_set<K>;
215bool isNaN(
const T& v) {
216 return std::isnan(v);
220bool isNaN<vec2>(
const vec2& v) {
221 return std::isnan(v.x) || std::isnan(v.y);
T constexpr sqrt(T x)
Returns the sqaure root of some constant x.
Definition base.hpp:190