Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
Math.hpp File Reference

Math utilities and GLM configuration for ESEngine. More...

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/euler_angles.hpp>
Include dependency graph for Math.hpp:

Go to the source code of this file.

Namespaces

namespace  esengine
namespace  esengine::math
 Math constants and utility functions.

Macros

#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#define GLM_ENABLE_EXPERIMENTAL

Functions

float esengine::math::toRadians (float degrees)
 Converts degrees to radians.
float esengine::math::toDegrees (float radians)
 Converts radians to degrees.
glm::vec3 esengine::math::toRadians (const glm::vec3 &degrees)
 Converts a vec3 of degrees to radians.
glm::vec3 esengine::math::toDegrees (const glm::vec3 &radians)
 Converts a vec3 of radians to degrees.
template<typename T>
T esengine::math::lerp (const T &a, const T &b, float t)
 Linear interpolation between two values.
template<typename T>
T esengine::math::clamp (const T &value, const T &min, const T &max)
 Clamps a value between min and max.
bool esengine::math::approxEqual (float a, float b, float epsilon=EPSILON)
 Checks if two floats are approximately equal.
bool esengine::math::approxEqual (const glm::vec3 &a, const glm::vec3 &b, float epsilon=EPSILON)
 Checks if two vec3s are approximately equal.
glm::mat4 esengine::math::ortho (float left, float right, float bottom, float top, float nearPlane, float farPlane)
 Creates an orthographic projection matrix.
glm::mat4 esengine::math::perspective (float fov, float aspect, float nearPlane, float farPlane)
 Creates a perspective projection matrix.
glm::mat4 esengine::math::lookAt (const glm::vec3 &eye, const glm::vec3 &center, const glm::vec3 &up)
 Creates a look-at view matrix.
void esengine::math::decompose (const glm::mat4 &matrix, glm::vec3 &position, glm::vec3 &rotation, glm::vec3 &scale)
 Decomposes a transformation matrix into components (Euler angles).
void esengine::math::decompose (const glm::mat4 &matrix, glm::vec3 &position, glm::quat &rotation, glm::vec3 &scale)
 Decomposes a transformation matrix into components (quaternion).
glm::quat esengine::math::eulerToQuat (const glm::vec3 &euler)
 Converts Euler angles (radians) to quaternion.
glm::vec3 esengine::math::quatToEuler (const glm::quat &quat)
 Converts quaternion to Euler angles (radians).
glm::quat esengine::math::eulerDegreesToQuat (const glm::vec3 &degrees)
 Converts Euler angles (degrees) to quaternion.
glm::vec3 esengine::math::quatToEulerDegrees (const glm::quat &quat)
 Converts quaternion to Euler angles (degrees).
glm::mat4 esengine::math::compose (const glm::vec3 &position, const glm::quat &rotation, const glm::vec3 &scale)
 Constructs a transformation matrix from TRS components.
glm::mat4 esengine::math::compose (const glm::vec3 &position, const glm::vec3 &rotation, const glm::vec3 &scale)
 Constructs a transformation matrix from TRS components (Euler angles).

Variables

constexpr float esengine::math::PI = 3.14159265358979323846f
 Pi constant.
constexpr float esengine::math::TWO_PI = 2.0f * PI
 Two times pi (full circle in radians).
constexpr float esengine::math::HALF_PI = 0.5f * PI
 Half pi (quarter circle in radians).
constexpr float esengine::math::DEG_TO_RAD = PI / 180.0f
 Degrees to radians conversion factor.
constexpr float esengine::math::RAD_TO_DEG = 180.0f / PI
 Radians to degrees conversion factor.
constexpr float esengine::math::EPSILON = 1e-6f
 Small epsilon for floating-point comparisons.

Detailed Description

Math utilities and GLM configuration for ESEngine.

Provides GLM configuration, math constants, and utility functions for common game development operations including quaternion/euler conversions and matrix decomposition.

Author
ESEngine Team
Date
2026

Definition in file Math.hpp.

Macro Definition Documentation

◆ GLM_ENABLE_EXPERIMENTAL

#define GLM_ENABLE_EXPERIMENTAL

Definition at line 34 of file Math.hpp.

◆ GLM_FORCE_DEPTH_ZERO_TO_ONE

#define GLM_FORCE_DEPTH_ZERO_TO_ONE

Definition at line 31 of file Math.hpp.

◆ GLM_FORCE_RADIANS

#define GLM_FORCE_RADIANS

Definition at line 28 of file Math.hpp.