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.
This commit is contained in:
parent
71373ee524
commit
aeb1a0da84
8 changed files with 90 additions and 138 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue