7#include <glm/gtc/matrix_transform.hpp>
8#include <glm/gtc/type_ptr.hpp>
18 m_ = glm::translate(m_, glm::vec3(
x,
y,
z));
21void Mat4::rotateX(
float radians) { m_ = glm::rotate(m_, radians, glm::vec3(1.f, 0.f, 0.f)); }
22void Mat4::rotateY(
float radians) { m_ = glm::rotate(m_, radians, glm::vec3(0.f, 1.f, 0.f)); }
23void Mat4::rotateZ(
float radians) { m_ = glm::rotate(m_, radians, glm::vec3(0.f, 0.f, 1.f)); }
26 m_ = glm::scale(m_, glm::vec3(
sx,
sy,
sz));
35 if (!other)
throw eve::Exception(
"Mat4.multiplied: other is null");
36 return new Mat4(m_ * other->m_);
41 glm::vec4
r = m_ * glm::vec4(
v->getX(),
v->getY(),
v->getZ(), 1.f);
47 glm::vec4
r = m_ * glm::vec4(
v->getX(),
v->getY(), 0.f, 1.f);
52 if (index < 0 || index > 15)
throw eve::Exception(
"Mat4.get: index must be 0..15");
53 return glm::value_ptr(m_)[
index];
57 if (index < 0 || index > 15)
throw eve::Exception(
"Mat4.set: index must be 0..15");
EVENGINE_API_FOUNDATION public API.
Column-major 4x4 matrix wrapping glm::mat4.
Vec3 * transformVec3(const Vec3 *v) const
Vec2 * transformPoint2(const Vec2 *v) const
void translate(float x, float y, float z)
Post-multiplies a translation.
float get(int index) const
Column-major element 0..15.
void identity()
Resets to the identity matrix.
void scale(float sx, float sy, float sz)
Scales by scalar s. @ownership Caller deletes.
void multiply(const Mat4 *other)
Post-multiplies by other (column-vector convention).
void rotateX(float radians)
Post-multiplies a rotation about X (radians).
void rotateZ(float radians)
Post-multiplies a rotation about Z (radians).
Mat4 * multiplied(const Mat4 *other) const
void set(int index, float value)
Sets all components.
void rotateY(float radians)
Post-multiplies a rotation about Y (radians).
2D float vector (script-facing math module value).
3D float vector (script-facing math module value).