diff options
| author | chriscamacho <chriscamacho@users.noreply.github.com> | 2019-10-27 11:13:18 +0000 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2019-10-27 12:13:18 +0100 |
| commit | 90b3dceb5401eb89740bde3f2964f4d3c3f2e009 (patch) | |
| tree | c5f97217ccc6026e8a326a939bf719f26258c6ad | |
| parent | a6db31c01e57ba9b0370190b11222dfaf4023b73 (diff) | |
| download | raylib-90b3dceb5401eb89740bde3f2964f4d3c3f2e009.tar.gz raylib-90b3dceb5401eb89740bde3f2964f4d3c3f2e009.zip | |
added GetMatrixProjection fixed issue with GL11 where model matrix was identity (#999)
| -rw-r--r-- | src/raylib.h | 3 | ||||
| -rw-r--r-- | src/rlgl.h | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/raylib.h b/src/raylib.h index 2d6b3642..9bc7c2fa 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -432,7 +432,7 @@ typedef struct Sound { typedef struct Music { int ctxType; // Type of music context (audio filetype) void *ctxData; // Audio context data, depends on type - + unsigned int sampleCount; // Total number of samples unsigned int loopCount; // Loops count (times music will play), 0 means infinite loop @@ -1319,6 +1319,7 @@ RLAPI void SetShaderValueTexture(Shader shader, int uniformLoc, Texture2D textur RLAPI void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) RLAPI void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) RLAPI Matrix GetMatrixModelview(void); // Get internal modelview matrix +RLAPI Matrix GetMatrixProjection(void); // Get internal projection matrix // Texture maps generation (PBR) // NOTE: Required shaders should be provided @@ -3155,6 +3155,23 @@ void SetMatrixProjection(Matrix proj) #endif } +// Return internal projection matrix +Matrix GetMatrixProjection(void) { +#if defined(GRAPHICS_API_OPENGL_11) + float mat[16]; + glGetFloatv(GL_PROJECTION_MATRIX,mat); + Matrix m; + m.m0 = mat[0]; m.m1 = mat[1]; m.m2 = mat[2]; m.m3 = mat[3]; + m.m4 = mat[4]; m.m5 = mat[5]; m.m6 = mat[6]; m.m7 = mat[7]; + m.m8 = mat[8]; m.m9 = mat[9]; m.m10 = mat[10]; m.m11 = mat[11]; + m.m12 = mat[12]; m.m13 = mat[13]; m.m14 = mat[14]; m.m15 = mat[15]; + return m; +#else + return projection; +#endif +# +} + // Set a custom modelview matrix (replaces internal modelview matrix) void SetMatrixModelview(Matrix view) { @@ -3170,6 +3187,10 @@ Matrix GetMatrixModelview(void) #if defined(GRAPHICS_API_OPENGL_11) float mat[16]; glGetFloatv(GL_MODELVIEW_MATRIX, mat); + matrix.m0 = mat[0]; matrix.m1 = mat[1]; matrix.m2 = mat[2]; matrix.m3 = mat[3]; + matrix.m4 = mat[4]; matrix.m5 = mat[5]; matrix.m6 = mat[6]; matrix.m7 = mat[7]; + matrix.m8 = mat[8]; matrix.m9 = mat[9]; matrix.m10 = mat[10]; matrix.m11 = mat[11]; + matrix.m12 = mat[12]; matrix.m13 = mat[13]; matrix.m14 = mat[14]; matrix.m15 = mat[15]; #else matrix = modelview; #endif |
