12#if defined(POLYPHASE_IN_SGDK_INCLUDE)
13#include_next <maths.h>
20#if PLATFORM_WINDOWS && _DEBUG
21#define GLM_FORCE_INLINE
24#ifndef GLM_FORCE_DEPTH_ZERO_TO_ONE
25#define GLM_FORCE_DEPTH_ZERO_TO_ONE 1
29#include <glm/gtx/transform.hpp>
30#include <glm/gtx/quaternion.hpp>
31#include <glm/gtx/rotate_vector.hpp>
32#include <glm/gtx/matrix_decompose.hpp>
33#include <glm/gtx/matrix_transform_2d.hpp>
34#include <glm/gtx/vector_angle.hpp>
35#include <glm/gtx/euler_angles.hpp>
36#include <glm/gtc/matrix_transform.hpp>
37#include <glm/gtc/type_ptr.hpp>
41#define PI 3.14159265359f
42#define DEGREES_TO_RADIANS (PI / 180)
43#define RADIANS_TO_DEGREES (180 / PI)
52 int32_t retRand = min;
55 retRand = min + rand() % (max + 1 - min);
64 static float Damp(
float source,
float target,
float smoothing,
float deltaTime);
65 static glm::vec3
Damp(glm::vec3 source, glm::vec3 target,
float smoothing,
float deltaTime);
66 static glm::vec4
Damp(glm::vec4 source, glm::vec4 target,
float smoothing,
float deltaTime);
67 static float DampAngle(
float source,
float target,
float smoothing,
float deltaTime);
69 static float Approach(
float source,
float target,
float speed,
float deltaTime);
70 static glm::vec3
Approach(glm::vec3 source, glm::vec3 target,
float speed,
float deltaTime);
71 static glm::vec4
Approach(glm::vec4 source, glm::vec4 target,
float speed,
float deltaTime);
72 static float ApproachAngle(
float source,
float target,
float speed,
float deltaTime);
74 static float Map(
float inX,
float inMin,
float inMax,
float outMin,
float outMax);
75 static float MapClamped(
float inX,
float inMin,
float inMax,
float outMin,
float outMax);
100 static glm::vec4
LinearToSrgb(
const glm::vec4& linearColor);
106 static bool mRandSeeded;
110float Maths::RandRange<float>(
float min,
float max);
113glm::vec2 Maths::RandRange<glm::vec2>(glm::vec2 min, glm::vec2 max);
116glm::vec3 Maths::RandRange<glm::vec3>(glm::vec3 min, glm::vec3 max);
119glm::vec4 Maths::RandRange<glm::vec4>(glm::vec4 min, glm::vec4 max);
static glm::vec3 QuatToVector(glm::quat quat)
Definition Maths.cpp:431
static glm::vec4 SrgbToLinear(glm::vec4 srgbColor)
Definition Maths.cpp:460
static float Approach(float source, float target, float speed, float deltaTime)
Definition Maths.cpp:104
static glm::vec4 LinearToSrgb(const glm::vec4 &linearColor)
Definition Maths.cpp:452
static T RandRange(T min, T max)
Definition Maths.h:50
static glm::vec3 ExtractPosition(const glm::mat4 &mat)
Definition Maths.cpp:280
static glm::quat VectorToQuat(glm::vec3 direction)
Definition Maths.cpp:421
static glm::vec3 VectorToRotation(glm::vec3 direction)
Definition Maths.cpp:409
static glm::vec3 RotationToVector(glm::vec3 rotation)
Definition Maths.cpp:437
static float NormalizeRange(float value, float start, float end)
Definition Maths.cpp:199
static float WindRelativeAngle(float angle0, float angle1)
Definition Maths.cpp:229
static float MapClamped(float inX, float inMin, float inMax, float outMin, float outMax)
Definition Maths.cpp:215
static uint32_t NextPowerOfTwo(uint32_t x)
Definition Maths.cpp:260
static float Damp(float source, float target, float smoothing, float deltaTime)
Definition Maths.cpp:49
static float Map(float inX, float inMin, float inMax, float outMin, float outMax)
Definition Maths.cpp:207
static void SeedRand(uint32_t seed)
Definition Maths.cpp:398
static uint32_t PrevPowerOfTwo(uint32_t x)
Definition Maths.cpp:270
static int32_t RandIndexWeighted(const std::vector< float > &weights)
Definition Maths.cpp:366
static glm::vec3 SafeNormalize(glm::vec3 vector)
Definition Maths.cpp:242
static uint64_t GenerateAssetUuid()
Definition Maths.cpp:468
static float ApproachAngle(float source, float target, float speed, float deltaTime)
Definition Maths.cpp:166
static constexpr uint64_t ENGINE_UUID_BASE
Definition Maths.h:86
static bool IsPowerOfTwo(uint32_t number)
Definition Maths.cpp:255
static float RotateYawTowardDirection(float srcYaw, glm::vec3 dir, float speed, float deltaTime)
Definition Maths.cpp:403
static glm::vec3 ExtractScale(const glm::mat4 &mat)
Definition Maths.cpp:346
static glm::quat ExtractRotation(const glm::mat4 &mat)
Definition Maths.cpp:300
static float DampAngle(float source, float target, float smoothing, float deltaTime)
Definition Maths.cpp:73