summaryrefslogtreecommitdiffhomepage
path: root/examples/others
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-07-30 12:54:54 +0200
committerraysan5 <[email protected]>2021-07-30 12:54:54 +0200
commitaeb1a0da84adc9e6987e1436431ea9cf495c8802 (patch)
tree063ba13a2a0153eea2def09496e461a00f2193c6 /examples/others
parent71373ee52468871e464e07000f8a602f373e906b (diff)
downloadraylib-aeb1a0da84adc9e6987e1436431ea9cf495c8802.tar.gz
raylib-aeb1a0da84adc9e6987e1436431ea9cf495c8802.zip
REVERTED: Removed the need for `rlMatrix`
Now rlgl uses the `Matrix` type, just make sure it has been previously defined somewhere... I don't like this approach but it's probably the easier one for the users... still looking for a better solution... maybe using something like `#define MATRIX_TYPE`, so it can be checked in other modules.
Diffstat (limited to 'examples/others')
-rw-r--r--examples/others/rlgl_standalone.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/examples/others/rlgl_standalone.c b/examples/others/rlgl_standalone.c
index a069d029..d92729f7 100644
--- a/examples/others/rlgl_standalone.c
+++ b/examples/others/rlgl_standalone.c
@@ -48,14 +48,14 @@
*
********************************************************************************************/
-#define RLGL_IMPLEMENTATION
-#define RLGL_STANDALONE
-#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
-
#define RAYMATH_STANDALONE
#define RAYMATH_HEADER_ONLY
#include "raymath.h" // Vector3, Quaternion and Matrix functionality
+#define RLGL_IMPLEMENTATION
+#define RLGL_STANDALONE
+#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
+
#if defined(__EMSCRIPTEN__)
#define GLFW_INCLUDE_ES2
#endif
@@ -116,22 +116,10 @@ static void DrawCubeWires(Vector3 position, float width, float height, float len
static void DrawRectangleV(Vector2 position, Vector2 size, Color color);
// NOTE: We used raymath to get this functionality but it can be implemented here
-//static rlMatrix MatrixIdentity(void);
-//static rlMatrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
-//static rlMatrix MatrixPerspective(double fovy, double aspect, double near, double far);
-//static rlMatrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
-
-rlMatrix rlMatrixFromMatrix(Matrix mat)
-{
- rlMatrix result = {
- mat.m0, mat.m4, mat.m8, mat.m12, // Matrix first row (4 comat.mponents)
- mat.m1, mat.m5, mat.m9, mat.m13, // Matrix second row (4 comat.mponents)
- mat.m2, mat.m6, mat.m10, mat.m14, // Matrix third row (4 comat.mponents)
- mat.m3, mat.m7, mat.m11, mat.m15, // Matrix fourth row (4 comat.mponents)
- };
-
- return result;
-}
+//static Matrix MatrixIdentity(void);
+//static Matrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
+//static Matrix MatrixPerspective(double fovy, double aspect, double near, double far);
+//static Matrix MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
//----------------------------------------------------------------------------------
// Main Entry point
@@ -226,8 +214,8 @@ int main(void)
Matrix matProj = MatrixPerspective((double)(camera.fovy*DEG2RAD), (double)screenWidth/(double)screenHeight, 0.01, 1000.0);
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
- rlSetMatrixModelview(rlMatrixFromMatrix(matView)); // Set internal modelview matrix (default shader)
- rlSetMatrixProjection(rlMatrixFromMatrix(matProj)); // Set internal projection matrix (default shader)
+ rlSetMatrixModelview(matView); // Set internal modelview matrix (default shader)
+ rlSetMatrixProjection(matProj); // Set internal projection matrix (default shader)
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RAYWHITE);
@@ -244,8 +232,8 @@ int main(void)
matProj = MatrixOrtho(0.0, screenWidth, screenHeight, 0.0, 0.0, 1.0);
matView = MatrixIdentity();
- rlSetMatrixModelview(rlMatrixFromMatrix(matView)); // Set internal modelview matrix (default shader)
- rlSetMatrixProjection(rlMatrixFromMatrix(matProj)); // Set internal projection matrix (default shader)
+ rlSetMatrixModelview(matView); // Set internal modelview matrix (default shader)
+ rlSetMatrixProjection(matProj); // Set internal projection matrix (default shader)
#else // Let rlgl generate and multiply matrix internally