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
18 Matrix(const ::Matrix& mat) {
23 float m0 = 0,
float m1 = 0,
float m2 = 0,
float m3 = 0,
float m4 = 0,
float m5 = 0,
24 float m6 = 0,
float m7 = 0,
float m8 = 0,
float m9 = 0,
float m10 = 0,
float m11 = 0,
25 float m12 = 0,
float m13 = 0,
float m14 = 0,
26 float m15 = 0) :
::Matrix{m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15} {}
28 GETTERSETTER(
float, M0, m0)
29 GETTERSETTER(
float, M1, m1)
30 GETTERSETTER(
float, M2, m2)
31 GETTERSETTER(
float, M3, m3)
32 GETTERSETTER(
float, M4, m4)
33 GETTERSETTER(
float, M5, m5)
34 GETTERSETTER(
float, M6, m6)
35 GETTERSETTER(
float, M7, m7)
36 GETTERSETTER(
float, M8, m8)
37 GETTERSETTER(
float, M9, m9)
38 GETTERSETTER(
float, M10, m10)
39 GETTERSETTER(
float, M11, m11)
40 GETTERSETTER(
float, M12, m12)
41 GETTERSETTER(
float, M13, m13)
42 GETTERSETTER(
float, M14, m14)
43 GETTERSETTER(
float, M15, m15)
55 bool operator==(const ::Matrix& other) {
74 bool operator!=(const ::Matrix& other) {
75 return !(*
this == other);
78 #ifndef RAYLIB_CPP_NO_MATH
83 return ::MatrixTrace(*
this);
90 return ::MatrixTranspose(*
this);
93 inline Matrix Invert()
const {
94 return ::MatrixInvert(*
this);
97 static Matrix Identity() {
98 return ::MatrixIdentity();
101 Matrix Add(const ::Matrix& right) {
102 return ::MatrixAdd(*
this, right);
105 Matrix operator+(const ::Matrix& matrix) {
106 return ::MatrixAdd(*
this, matrix);
109 Matrix Subtract(const ::Matrix& right) {
110 return ::MatrixSubtract(*
this, right);
113 Matrix operator-(const ::Matrix& matrix) {
114 return ::MatrixSubtract(*
this, matrix);
117 static Matrix Translate(
float x,
float y,
float z) {
118 return ::MatrixTranslate(x, y, z);
121 static Matrix Rotate(Vector3 axis,
float angle) {
122 return ::MatrixRotate(axis, angle);
125 static Matrix RotateXYZ(Vector3 angle) {
126 return ::MatrixRotateXYZ(angle);
129 static Matrix RotateX(
float angle) {
130 return ::MatrixRotateX(angle);
133 static Matrix RotateY(
float angle) {
134 return ::MatrixRotateY(angle);
137 static Matrix RotateZ(
float angle) {
138 return ::MatrixRotateZ(angle);
141 static Matrix Scale(
float x,
float y,
float z) {
142 return ::MatrixScale(x, y, z);
145 Matrix Multiply(const ::Matrix& right)
const {
146 return ::MatrixMultiply(*
this, right);
149 Matrix operator*(const ::Matrix& matrix) {
150 return ::MatrixMultiply(*
this, matrix);
153 static Matrix Frustum(
double left,
double right,
double bottom,
double top,
154 double near,
double far) {
155 return ::MatrixFrustum(left, right, bottom, top, near, far);
158 static Matrix Perspective(
double fovy,
double aspect,
double near,
double far) {
159 return ::MatrixPerspective(fovy, aspect, near, far);
162 static Matrix Ortho(
double left,
double right,
double bottom,
double top,
163 double near,
double far) {
164 return ::MatrixOrtho(left, right, bottom, top, near, far);
167 static Matrix LookAt(Vector3 eye, Vector3 target, Vector3 up) {
168 return ::MatrixLookAt(eye, target, up);
171 inline float16 ToFloatV()
const {
172 return ::MatrixToFloatV(*
this);
183 ::SetShaderValueMatrix(shader, uniformLoc, *
this);
187 inline static Matrix GetCamera(const ::Camera& camera) {
188 return ::GetCameraMatrix(camera);
191 inline static Matrix GetCamera(const ::Camera2D& camera) {
192 return ::GetCameraMatrix2D(camera);
198 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.