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);
42 return new Vec3(r.x, r.y, r.z);
47 glm::vec4 r = m_ * glm::vec4(
v->getX(),
v->getY(), 0.f, 1.f);
48 return new Vec2(r.x, r.y);
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");
58 glm::value_ptr(m_)[index] =
value;
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)
float get(int index) const
Column-major element 0..15.
void scale(float sx, float sy, float sz)
void multiply(const Mat4 *other)
void rotateX(float radians)
void rotateZ(float radians)
Mat4 * multiplied(const Mat4 *other) const
void set(int index, float value)
void rotateY(float radians)
2D float vector (script-facing math module value).
3D float vector (script-facing math module value).