1 #ifndef RAYLIB_CPP_INCLUDE_MATRIX_HPP_
2 #define RAYLIB_CPP_INCLUDE_MATRIX_HPP_
4 #include "./raylib.hpp"
5 #include "./raylib-cpp-utils.hpp"
6 #include "./raymath.hpp"
8 #ifndef RAYLIB_CPP_NO_MATH
19 mat.m0, mat.m4, mat.m8, mat.m12,
20 mat.m1, mat.m5, mat.m9, mat.m13,
21 mat.m2, mat.m6, mat.m10, mat.m14,
22 mat.m3, mat.m7, mat.m11, mat.m15} {
27 float m0 = 0,
float m4 = 0,
float m8 = 0,
float m12 = 0,
28 float m1 = 0,
float m5 = 0,
float m9 = 0,
float m13 = 0,
29 float m2 = 0,
float m6 = 0,
float m10 = 0,
float m14 = 0,
30 float m3 = 0,
float m7 = 0,
float m11 = 0,
float m15 = 0) :
39 GETTERSETTER(
float, M0, m0)
40 GETTERSETTER(
float, M1, m1)
41 GETTERSETTER(
float, M2, m2)
42 GETTERSETTER(
float, M3, m3)
43 GETTERSETTER(
float, M4, m4)
44 GETTERSETTER(
float, M5, m5)
45 GETTERSETTER(
float, M6, m6)
46 GETTERSETTER(
float, M7, m7)
47 GETTERSETTER(
float, M8, m8)
48 GETTERSETTER(
float, M9, m9)
49 GETTERSETTER(
float, M10, m10)
50 GETTERSETTER(
float, M11, m11)
51 GETTERSETTER(
float, M12, m12)
52 GETTERSETTER(
float, M13, m13)
53 GETTERSETTER(
float, M14, m14)
54 GETTERSETTER(
float, M15, m15)
66 bool operator==(const ::Matrix& other) {
85 bool operator!=(const ::Matrix& other) {
86 return !(*
this == other);
89 #ifndef RAYLIB_CPP_NO_MATH
94 return ::MatrixTrace(*
this);
101 return ::MatrixTranspose(*
this);
104 inline Matrix Invert()
const {
105 return ::MatrixInvert(*
this);
108 static Matrix Identity() {
109 return ::MatrixIdentity();
112 Matrix Add(const ::Matrix& right) {
113 return ::MatrixAdd(*
this, right);
116 Matrix operator+(const ::Matrix& matrix) {
117 return ::MatrixAdd(*
this, matrix);
120 Matrix Subtract(const ::Matrix& right) {
121 return ::MatrixSubtract(*
this, right);
124 Matrix operator-(const ::Matrix& matrix) {
125 return ::MatrixSubtract(*
this, matrix);
128 static Matrix Translate(
float x,
float y,
float z) {
129 return ::MatrixTranslate(x, y, z);
132 static Matrix Rotate(Vector3 axis,
float angle) {
133 return ::MatrixRotate(axis, angle);
136 static Matrix RotateXYZ(Vector3 angle) {
137 return ::MatrixRotateXYZ(angle);
140 static Matrix RotateX(
float angle) {
141 return ::MatrixRotateX(angle);
144 static Matrix RotateY(
float angle) {
145 return ::MatrixRotateY(angle);
148 static Matrix RotateZ(
float angle) {
149 return ::MatrixRotateZ(angle);
152 static Matrix Scale(
float x,
float y,
float z) {
153 return ::MatrixScale(x, y, z);
156 Matrix Multiply(const ::Matrix& right)
const {
157 return ::MatrixMultiply(*
this, right);
160 Matrix operator*(const ::Matrix& matrix) {
161 return ::MatrixMultiply(*
this, matrix);
164 static Matrix Frustum(
double left,
double right,
double bottom,
double top,
165 double near,
double far) {
166 return ::MatrixFrustum(left, right, bottom, top, near, far);
169 static Matrix Perspective(
double fovy,
double aspect,
double near,
double far) {
170 return ::MatrixPerspective(fovy, aspect, near, far);
173 static Matrix Ortho(
double left,
double right,
double bottom,
double top,
174 double near,
double far) {
175 return ::MatrixOrtho(left, right, bottom, top, near, far);
178 static Matrix LookAt(Vector3 eye, Vector3 target, Vector3 up) {
179 return ::MatrixLookAt(eye, target, up);
182 inline float16 ToFloatV()
const {
183 return ::MatrixToFloatV(*
this);
194 ::SetShaderValueMatrix(shader, uniformLoc, *
this);
198 inline static Matrix GetCamera(const ::Camera& camera) {
199 return ::GetCameraMatrix(camera);
202 inline static Matrix GetCamera(const ::Camera2D& camera) {
203 return ::GetCameraMatrix2D(camera);
209 void set(const ::Matrix& mat) {
Matrix type (OpenGL style 4x4 - right handed, column major)
Matrix & SetShaderValue(const ::Shader &shader, int uniformLoc)
Set shader uniform value (matrix 4x4)
float Trace() const
Returns the trace of the matrix (sum of the values along the diagonal)
Matrix Transpose() const
Transposes provided matrix.
All raylib-cpp classes and functions appear in the raylib namespace.