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 inline Matrix Normalize()
const {
98 return ::MatrixNormalize(*
this);
101 static Matrix Identity() {
102 return ::MatrixIdentity();
105 Matrix Add(const ::Matrix& right) {
106 return ::MatrixAdd(*
this, right);
109 Matrix operator+(const ::Matrix& matrix) {
110 return ::MatrixAdd(*
this, matrix);
113 Matrix Subtract(const ::Matrix& right) {
114 return ::MatrixSubtract(*
this, right);
117 Matrix operator-(const ::Matrix& matrix) {
118 return ::MatrixSubtract(*
this, matrix);
121 static Matrix Translate(
float x,
float y,
float z) {
122 return ::MatrixTranslate(x, y, z);
125 static Matrix Rotate(Vector3 axis,
float angle) {
126 return ::MatrixRotate(axis, angle);
129 static Matrix RotateXYZ(Vector3 angle) {
130 return ::MatrixRotateXYZ(angle);
133 static Matrix RotateX(
float angle) {
134 return ::MatrixRotateX(angle);
137 static Matrix RotateY(
float angle) {
138 return ::MatrixRotateY(angle);
141 static Matrix RotateZ(
float angle) {
142 return ::MatrixRotateZ(angle);
145 static Matrix Scale(
float x,
float y,
float z) {
146 return ::MatrixScale(x, y, z);
149 Matrix Multiply(const ::Matrix& right)
const {
150 return ::MatrixMultiply(*
this, right);
153 Matrix operator*(const ::Matrix& matrix) {
154 return ::MatrixMultiply(*
this, matrix);
157 static Matrix Frustum(
double left,
double right,
double bottom,
double top,
158 double near,
double far) {
159 return ::MatrixFrustum(left, right, bottom, top, near, far);
162 static Matrix Perspective(
double fovy,
double aspect,
double near,
double far) {
163 return ::MatrixPerspective(fovy, aspect, near, far);
166 static Matrix Ortho(
double left,
double right,
double bottom,
double top,
167 double near,
double far) {
168 return ::MatrixOrtho(left, right, bottom, top, near, far);
171 static Matrix LookAt(Vector3 eye, Vector3 target, Vector3 up) {
172 return ::MatrixLookAt(eye, target, up);
175 inline float16 ToFloatV()
const {
176 return ::MatrixToFloatV(*
this);
187 ::SetShaderValueMatrix(shader, uniformLoc, *
this);
194 void set(const ::Matrix& mat) {
Matrix type (OpenGL style 4x4 - right handed, column major)
Matrix & SetShaderValue(::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.