First
This commit is contained in:
+269
@@ -0,0 +1,269 @@
|
||||
#pragma once
|
||||
|
||||
#include <tl/assert.h>
|
||||
#include <tl/string.h>
|
||||
#include <tl/numeric_limits.h>
|
||||
#include <cmath>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
# define MATH_RESTRICT __restrict
|
||||
#elif (defined(__clang__) || defined(__GNUC__))
|
||||
# define MATH_RESTRICT __restrict__
|
||||
#else
|
||||
# define MATH_RESTRICT
|
||||
#endif
|
||||
|
||||
namespace math
|
||||
{
|
||||
static struct ZUninitialized {} uninitialized;
|
||||
|
||||
//standard precision
|
||||
struct standard {};
|
||||
//fast but less precise
|
||||
struct fast {};
|
||||
//standard precision but safe assumptions
|
||||
struct safe {};
|
||||
}
|
||||
|
||||
#include "VMath/angle.h"
|
||||
#include "VMath/vec2.h"
|
||||
#include "VMath/vec3.h"
|
||||
#include "VMath/vec4.h"
|
||||
#include "VMath/rect.h"
|
||||
#include "VMath/mat2.h"
|
||||
#include "VMath/mat3.h"
|
||||
#include "VMath/mat4.h"
|
||||
#include "VMath/trans2.h"
|
||||
#include "VMath/trans3.h"
|
||||
#include "VMath/rigid2.h"
|
||||
#include "VMath/rigid3.h"
|
||||
#include "VMath/quat.h"
|
||||
#include "VMath/plane.h"
|
||||
#include "VMath/line2.h"
|
||||
#include "VMath/line3.h"
|
||||
#include "VMath/ray2.h"
|
||||
#include "VMath/ray3.h"
|
||||
#include "VMath/segment2.h"
|
||||
#include "VMath/segment3.h"
|
||||
#include "VMath/circle2.h"
|
||||
#include "VMath/triangle3.h"
|
||||
#include "VMath/aabb3.h"
|
||||
#include "VMath/aabb2.h"
|
||||
#include "VMath/range.h"
|
||||
#include "VMath/clamped_value.h"
|
||||
|
||||
namespace math
|
||||
{
|
||||
typedef angle<float> anglef;
|
||||
typedef angle<double> angled;
|
||||
|
||||
typedef vec2<int8_t> byte2;
|
||||
typedef vec2<uint8_t> ubyte2;
|
||||
typedef vec2<int16_t> short2;
|
||||
typedef vec2<uint16_t> ushort2;
|
||||
typedef vec2<int32_t> int2;
|
||||
typedef vec2<uint32_t> uint2;
|
||||
typedef vec2<float> float2;
|
||||
typedef vec2<double> double2;
|
||||
|
||||
typedef vec2<int8_t> vec2b;
|
||||
typedef vec2<uint8_t> vec2ub;
|
||||
typedef vec2<int16_t> vec2s;
|
||||
typedef vec2<uint16_t> vec2us;
|
||||
typedef vec2<int32_t> vec2i;
|
||||
typedef vec2<uint32_t> vec2u;
|
||||
typedef vec2<float> vec2f;
|
||||
typedef vec2<double> vec2d;
|
||||
|
||||
typedef vec3<int8_t> byte3;
|
||||
typedef vec3<uint8_t> ubyte3;
|
||||
typedef vec3<int16_t> short3;
|
||||
typedef vec3<uint16_t> ushort3;
|
||||
typedef vec3<int32_t> int3;
|
||||
typedef vec3<uint32_t> uint3;
|
||||
typedef vec3<float> float3;
|
||||
typedef vec3<double> double3;
|
||||
|
||||
typedef vec3<int8_t> vec3b;
|
||||
typedef vec3<uint8_t> vec3ub;
|
||||
typedef vec3<int16_t> vec3s;
|
||||
typedef vec3<uint16_t> vec3us;
|
||||
typedef vec3<int32_t> vec3i;
|
||||
typedef vec3<uint32_t> vec3u;
|
||||
typedef vec3<float> vec3f;
|
||||
typedef vec3<double> vec3d;
|
||||
|
||||
typedef vec4<int8_t> byte4;
|
||||
typedef vec4<uint8_t> ubyte4;
|
||||
typedef vec4<int16_t> short4;
|
||||
typedef vec4<uint16_t> ushort4;
|
||||
typedef vec4<int32_t> int4;
|
||||
typedef vec4<uint32_t> uint4;
|
||||
typedef vec4<float> float4;
|
||||
typedef vec4<double> double4;
|
||||
|
||||
typedef vec4<int8_t> vec4b;
|
||||
typedef vec4<uint8_t> vec4ub;
|
||||
typedef vec4<int16_t> vec4s;
|
||||
typedef vec4<uint16_t> vec4us;
|
||||
typedef vec4<int32_t> vec4i;
|
||||
typedef vec4<uint32_t> vec4u;
|
||||
typedef vec4<float> vec4f;
|
||||
typedef vec4<double> vec4d;
|
||||
|
||||
typedef quat<float> quatf;
|
||||
typedef quat<double> quatd;
|
||||
|
||||
typedef mat2<float> mat2f;
|
||||
typedef mat2<double> mat2d;
|
||||
typedef mat3<float> mat3f;
|
||||
typedef mat3<double> mat3d;
|
||||
typedef mat4<float> mat4f;
|
||||
typedef mat4<double> mat4d;
|
||||
|
||||
typedef trans2<float> trans2f;
|
||||
typedef trans2<double> trans2d;
|
||||
typedef trans3<float> trans3f;
|
||||
typedef trans3<double> trans3d;
|
||||
|
||||
typedef rigid2<float> rigid2f;
|
||||
typedef rigid2<double> rigid2d;
|
||||
typedef rigid3<float> rigid3f;
|
||||
typedef rigid3<double> rigid3d;
|
||||
|
||||
typedef line2<float> line2f;
|
||||
typedef line2<double> line2d;
|
||||
typedef line3<float> line3f;
|
||||
typedef line3<double> line3d;
|
||||
|
||||
typedef ray2<float> ray2f;
|
||||
typedef ray2<double> ray2d;
|
||||
typedef ray3<float> ray3f;
|
||||
typedef ray3<double> ray3d;
|
||||
|
||||
typedef segment2<float> segment2f;
|
||||
typedef segment2<double> segment2d;
|
||||
typedef segment3<float> segment3f;
|
||||
typedef segment3<double> segment3d;
|
||||
|
||||
typedef rect<int32_t> recti;
|
||||
typedef rect<uint32_t> rectu;
|
||||
typedef rect<float> rectf;
|
||||
typedef rect<double> rectd;
|
||||
|
||||
typedef aabb2<float> aabb2f;
|
||||
typedef aabb2<double> aabb2d;
|
||||
typedef aabb3<float> aabb3f;
|
||||
typedef aabb3<double> aabb3d;
|
||||
|
||||
typedef triangle3<float> triangle3f;
|
||||
typedef triangle3<double> triangle3d;
|
||||
|
||||
typedef circle2<float> circle2f;
|
||||
typedef circle2<double> circle2d;
|
||||
|
||||
typedef plane<float> planef;
|
||||
typedef plane<double> planed;
|
||||
|
||||
typedef range<float> rangef;
|
||||
typedef range<vec2f> range2f;
|
||||
typedef range<vec3f> range3f;
|
||||
typedef range<vec4f> range4f;
|
||||
|
||||
typedef range<double> ranged;
|
||||
typedef range<vec2d> range2d;
|
||||
typedef range<vec3d> range3d;
|
||||
typedef range<vec4d> range4d;
|
||||
|
||||
typedef range<int32_t> rangei;
|
||||
typedef range<vec2i> range2i;
|
||||
typedef range<vec3i> range3i;
|
||||
typedef range<vec4i> range4i;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
struct UValue_Traits
|
||||
{
|
||||
static constexpr T max = tl::numeric_limits<T>::max();
|
||||
static constexpr T min = T(0);
|
||||
};
|
||||
template<typename T>
|
||||
struct Mu_Traits
|
||||
{
|
||||
static constexpr T min = T(0);
|
||||
static constexpr T max = T(1);
|
||||
};
|
||||
template<typename T>
|
||||
struct Smu_Traits
|
||||
{
|
||||
static constexpr T min = T(-1);
|
||||
static constexpr T max = T(1);
|
||||
};
|
||||
}
|
||||
|
||||
typedef clamped_value<float, detail::UValue_Traits<float>> ufloat;
|
||||
typedef clamped_value<double, detail::UValue_Traits<double>> udouble;
|
||||
|
||||
typedef clamped_value<float, detail::Mu_Traits<float>> muf;
|
||||
typedef clamped_value<double, detail::Mu_Traits<double>> mud;
|
||||
|
||||
typedef clamped_value<float, detail::Smu_Traits<float>> smuf;
|
||||
typedef clamped_value<double, detail::Smu_Traits<double>> smud;
|
||||
|
||||
}//namespace math
|
||||
|
||||
#include "VMath/func_test.h"
|
||||
#include "VMath/func_common.h"
|
||||
#include "VMath/func_range.h"
|
||||
#include "VMath/func_trig.h"
|
||||
#include "VMath/func_interp.h"
|
||||
#include "VMath/func_projection.h"
|
||||
#include "VMath/func_transform.h"
|
||||
#include "VMath/func_binary.h"
|
||||
#include "VMath/func_string.h"
|
||||
#include "VMath/func_cast.h"
|
||||
#include "VMath/func_interpolation.h"
|
||||
#include "VMath/func_intersect.h"
|
||||
|
||||
#include "VMath/angle.inl"
|
||||
#include "VMath/circle2.inl"
|
||||
#include "VMath/vec2.inl"
|
||||
#include "VMath/vec3.inl"
|
||||
#include "VMath/vec4.inl"
|
||||
#include "VMath/rect.inl"
|
||||
#include "VMath/mat2.inl"
|
||||
#include "VMath/mat3.inl"
|
||||
#include "VMath/mat4.inl"
|
||||
#include "VMath/trans2.inl"
|
||||
#include "VMath/trans3.inl"
|
||||
#include "VMath/rigid2.inl"
|
||||
#include "VMath/rigid3.inl"
|
||||
#include "VMath/quat.inl"
|
||||
#include "VMath/plane.inl"
|
||||
#include "VMath/line2.inl"
|
||||
#include "VMath/line3.inl"
|
||||
#include "VMath/ray2.inl"
|
||||
#include "VMath/ray3.inl"
|
||||
#include "VMath/segment2.inl"
|
||||
#include "VMath/segment3.inl"
|
||||
#include "VMath/triangle3.inl"
|
||||
#include "VMath/aabb3.inl"
|
||||
#include "VMath/aabb2.inl"
|
||||
#include "VMath/range.inl"
|
||||
#include "VMath/clamped_value.inl"
|
||||
|
||||
#include "VMath/func_cast.inl"
|
||||
#include "VMath/func_range.inl"
|
||||
#include "VMath/func_test.inl"
|
||||
#include "VMath/func_common.inl"
|
||||
#include "VMath/func_trig.inl"
|
||||
#include "VMath/func_interp.inl"
|
||||
#include "VMath/func_projection.inl"
|
||||
#include "VMath/func_transform.inl"
|
||||
#include "VMath/func_binary.inl"
|
||||
#include "VMath/func_interpolation.inl"
|
||||
#include "VMath/func_intersect.inl"
|
||||
|
||||
|
||||
#undef MATH_RESTRICT
|
||||
Reference in New Issue
Block a user