From 08fc886afd88907516dc7519ac7542fa30e5f369 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:40:08 +0100 Subject: [PATCH 01/13] added proper define checks for png-save if it's disabled --- src/core.c | 2 +- src/textures.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index ec7db9782..d46462684 100644 --- a/src/core.c +++ b/src/core.c @@ -1134,7 +1134,7 @@ void SetConfigFlags(char flags) // Takes a screenshot of current screen (saved a .png) void TakeScreenshot(const char *fileName) { -#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) +#if (defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)) && defined(SUPPORT_SAVE_PNG) unsigned char *imgData = rlReadScreenPixels(renderWidth, renderHeight); SavePNG(fileName, imgData, renderWidth, renderHeight, 4); // Save image as PNG free(imgData); diff --git a/src/textures.c b/src/textures.c index 6bd306f40..557491187 100644 --- a/src/textures.c +++ b/src/textures.c @@ -554,7 +554,7 @@ void UpdateTexture(Texture2D texture, const void *pixels) // Save image to a PNG file void SaveImageAs(const char* fileName, Image image) { -#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) +#if (defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)) && defined(SUPPORT_SAVE_PNG) unsigned char* imgData = (unsigned char*)GetImageData(image); // this works since Color is just a container for the RGBA values SavePNG(fileName, imgData, image.width, image.height, 4); free(imgData); From 54587d7fdb6bf250c70f6a5eb653496e9bdf24ea Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:41:31 +0100 Subject: [PATCH 02/13] proper if-clauses for disabling functionality in text.c --- src/text.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/text.c b/src/text.c index 0215bb5be..f577be193 100644 --- a/src/text.c +++ b/src/text.c @@ -290,11 +290,12 @@ SpriteFont LoadSpriteFont(const char *fileName) #if defined(SUPPORT_FILEFORMAT_TTF) if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadSpriteFontEx(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL); + else #endif #if defined(SUPPORT_FILEFORMAT_FNT) - else if (IsFileExtension(fileName, ".fnt")) spriteFont = LoadBMFont(fileName); -#endif + if (IsFileExtension(fileName, ".fnt")) spriteFont = LoadBMFont(fileName); else +#endif { Image image = LoadImage(fileName); if (image.data != NULL) spriteFont = LoadImageFont(image, MAGENTA, DEFAULT_FIRST_CHAR); From 69c8fa409a6eed0c6b041d288d40e25b4dbda740 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:42:06 +0100 Subject: [PATCH 03/13] fixed function declaration differ from implementation --- src/rlgl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index 2e67c699b..90d6a71b8 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -456,8 +456,8 @@ Texture2D GetTextureDefault(void); // Get default texture // Shader configuration functions int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location -void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // Set shader uniform value (float) -void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int) +void SetShaderValue(Shader shader, int uniformLoc, const float *value, int size); // Set shader uniform value (float) +void SetShaderValuei(Shader shader, int uniformLoc, const int *value, int size); // Set shader uniform value (int) void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4) void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) From 963551ee6e99e069fca8eed47151f4caf628507e Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:43:06 +0100 Subject: [PATCH 04/13] added possibility to get modelview matrix from rlgl to be able to send it to shaders --- src/rlgl.c | 6 ++++++ src/rlgl.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/rlgl.c b/src/rlgl.c index cdce92d07..5db6f1cc4 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -2539,6 +2539,12 @@ void SetMatrixModelview(Matrix view) #endif } +Matrix GetMatrixModelview() { +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) + return modelview; +#endif +} + // Generate cubemap texture from HDR texture // TODO: OpenGL ES 2.0 does not support GL_RGB16F texture format, neither GL_DEPTH_COMPONENT24 Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size) diff --git a/src/rlgl.h b/src/rlgl.h index 90d6a71b8..a54a912f3 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -461,6 +461,8 @@ void SetShaderValuei(Shader shader, int uniformLoc, const int *value, int size); void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4) void SetMatrixProjection(Matrix proj); // Set a custom projection matrix (replaces internal projection matrix) void SetMatrixModelview(Matrix view); // Set a custom modelview matrix (replaces internal modelview matrix) +Matrix GetMatrixModelview(); + // Texture maps generation (PBR) // NOTE: Required shaders should be provided From 0e18b146055efd18029c4ac5553fd1e53dfbbfc8 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:44:48 +0100 Subject: [PATCH 05/13] added debug-event-markers for opengl so that you're able to set markers for renderdoc or other gpu debuggers what your program is currently doing --- src/external/glad.h | 25 +++++++++++++++++++++++++ src/rlgl.c | 8 ++++++++ src/rlgl.h | 3 +++ 3 files changed, 36 insertions(+) diff --git a/src/external/glad.h b/src/external/glad.h index ab5947e68..70dbc7394 100644 --- a/src/external/glad.h +++ b/src/external/glad.h @@ -3446,6 +3446,19 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC)(GLenum sfactorRGB, GLenum GLAPI PFNGLBLENDFUNCSEPARATEEXTPROC glad_glBlendFuncSeparateEXT; #define glBlendFuncSeparateEXT glad_glBlendFuncSeparateEXT #endif +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +GLAPI int GLAD_GL_EXT_debug_marker; +typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC)(GLsizei length, const GLchar *marker); +GLAPI PFNGLINSERTEVENTMARKEREXTPROC glad_glInsertEventMarkerEXT; +#define glInsertEventMarkerEXT glad_glInsertEventMarkerEXT +typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC)(GLsizei length, const GLchar *marker); +GLAPI PFNGLPUSHGROUPMARKEREXTPROC glad_glPushGroupMarkerEXT; +#define glPushGroupMarkerEXT glad_glPushGroupMarkerEXT +typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC)(void); +GLAPI PFNGLPOPGROUPMARKEREXTPROC glad_glPopGroupMarkerEXT; +#define glPopGroupMarkerEXT glad_glPopGroupMarkerEXT +#endif #ifndef GL_EXT_framebuffer_blit #define GL_EXT_framebuffer_blit 1 GLAPI int GLAD_GL_EXT_framebuffer_blit; @@ -4209,6 +4222,7 @@ int GLAD_GL_ARB_vertex_shader; int GLAD_GL_ARB_vertex_attrib_binding; int GLAD_GL_ARB_vertex_program; int GLAD_GL_EXT_texture_compression_s3tc; +int GLAD_GL_EXT_debug_marker; int GLAD_GL_EXT_texture_swizzle; int GLAD_GL_ARB_texture_multisample; int GLAD_GL_ARB_texture_rg; @@ -4391,6 +4405,9 @@ PFNGLGETVARIANTARRAYOBJECTIVATIPROC glad_glGetVariantArrayObjectivATI; PFNGLBLENDCOLOREXTPROC glad_glBlendColorEXT; PFNGLBLENDEQUATIONSEPARATEEXTPROC glad_glBlendEquationSeparateEXT; PFNGLBLENDFUNCSEPARATEEXTPROC glad_glBlendFuncSeparateEXT; +PFNGLINSERTEVENTMARKEREXTPROC glad_glInsertEventMarkerEXT; +PFNGLPUSHGROUPMARKEREXTPROC glad_glPushGroupMarkerEXT; +PFNGLPOPGROUPMARKEREXTPROC glad_glPopGroupMarkerEXT; PFNGLBLITFRAMEBUFFEREXTPROC glad_glBlitFramebufferEXT; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC glad_glRenderbufferStorageMultisampleEXT; PFNGLISRENDERBUFFEREXTPROC glad_glIsRenderbufferEXT; @@ -5190,6 +5207,12 @@ static void load_GL_EXT_blend_func_separate(GLADloadproc load) { if(!GLAD_GL_EXT_blend_func_separate) return; glad_glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)load("glBlendFuncSeparateEXT"); } +static void load_GL_EXT_debug_marker(GLADloadproc load) { + if(!GLAD_GL_EXT_debug_marker) return; + glad_glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)load("glInsertEventMarkerEXT"); + glad_glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)load("glPushGroupMarkerEXT"); + glad_glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)load("glPopGroupMarkerEXT"); +} static void load_GL_EXT_framebuffer_blit(GLADloadproc load) { if(!GLAD_GL_EXT_framebuffer_blit) return; glad_glBlitFramebufferEXT = (PFNGLBLITFRAMEBUFFEREXTPROC)load("glBlitFramebufferEXT"); @@ -5316,6 +5339,7 @@ static int find_extensionsGL(void) { GLAD_GL_EXT_blend_color = has_ext("GL_EXT_blend_color"); GLAD_GL_EXT_blend_equation_separate = has_ext("GL_EXT_blend_equation_separate"); GLAD_GL_EXT_blend_func_separate = has_ext("GL_EXT_blend_func_separate"); + GLAD_GL_EXT_debug_marker = has_ext("GL_EXT_debug_marker"); GLAD_GL_EXT_framebuffer_blit = has_ext("GL_EXT_framebuffer_blit"); GLAD_GL_EXT_framebuffer_multisample = has_ext("GL_EXT_framebuffer_multisample"); GLAD_GL_EXT_framebuffer_multisample_blit_scaled = has_ext("GL_EXT_framebuffer_multisample_blit_scaled"); @@ -5430,6 +5454,7 @@ int gladLoadGLLoader(GLADloadproc load) { load_GL_EXT_blend_color(load); load_GL_EXT_blend_equation_separate(load); load_GL_EXT_blend_func_separate(load); + load_GL_EXT_debug_marker(load); load_GL_EXT_framebuffer_blit(load); load_GL_EXT_framebuffer_multisample(load); load_GL_EXT_framebuffer_object(load); diff --git a/src/rlgl.c b/src/rlgl.c index 5db6f1cc4..e34e48da8 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -307,6 +307,8 @@ static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; //static PFNGLISVERTEXARRAYOESPROC glIsVertexArray; // NOTE: Fails in WebGL, omitted #endif +static bool debugMarkerSupported = false; + // Compressed textures support flags static bool texCompDXTSupported = false; // DDS texture compression support static bool texNPOTSupported = false; // NPOT textures full support @@ -1135,6 +1137,10 @@ void rlglInit(int width, int height) glGetFloatv(0x84FF, &maxAnisotropicLevel); // GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT } + if(strcmp(extList[i], (const char *)"GL_EXT_debug_marker") == 0) { + debugMarkerSupported = true; + } + // Clamp mirror wrap mode supported if (strcmp(extList[i], (const char *)"GL_EXT_texture_mirror_clamp") == 0) texClampMirrorSupported = true; } @@ -1160,6 +1166,8 @@ void rlglInit(int width, int height) if (texAnisotropicFilterSupported) TraceLog(LOG_INFO, "[EXTENSION] Anisotropic textures filtering supported (max: %.0fX)", maxAnisotropicLevel); if (texClampMirrorSupported) TraceLog(LOG_INFO, "[EXTENSION] Clamp mirror wrap texture mode supported"); + if (debugMarkerSupported) TraceLog(LOG_INFO, "[EXTENSION] Debug Marker supported"); + // Initialize buffers, default shaders and default textures //---------------------------------------------------------- diff --git a/src/rlgl.h b/src/rlgl.h index a54a912f3..93afb44e7 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -440,6 +440,9 @@ void rlUpdateMesh(Mesh mesh, int buffer, int numVertex); // Update ve void rlDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d mesh with material and transform void rlUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU +// Debug Marker for Analysis +void rlSetMarker(const char *text); + // NOTE: There is a set of shader related functions that are available to end user, // to avoid creating function wrappers through core module, they have been directly declared in raylib.h From a7f2fedbfbfde92e7c12c21b108a2b99965bc28d Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:45:47 +0100 Subject: [PATCH 06/13] compilefix for function declaration (win only) --- src/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index d46462684..882aadcdf 100644 --- a/src/core.c +++ b/src/core.c @@ -153,8 +153,9 @@ //#define GLFW_DLL // Using GLFW DLL on Windows -> No, we use static version! #if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32) - __stdcall unsigned int timeBeginPeriod(unsigned int uPeriod); - __stdcall unsigned int timeEndPeriod(unsigned int uPeriod); + // NOTE: Those functions require linking with winmm library + unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod); + unsigned int __stdcall timeEndPeriod(unsigned int uPeriod); #endif #endif From 07b522c1131faf29df49da5f0f09826cef765d4b Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:46:38 +0100 Subject: [PATCH 07/13] make matrix stack work closer to old opengl implementation --- src/rlgl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rlgl.c b/src/rlgl.c index e34e48da8..7ec4c4ac2 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -414,7 +414,7 @@ void rlPushMatrix(void) } stack[stackCounter] = *currentMatrix; - rlLoadIdentity(); +// rlLoadIdentity(); stackCounter++; if (currentMatrixMode == RL_MODELVIEW) useTempBuffer = true; From b5395b22cc920bf4b92742c284180ffc8ba9e897 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:47:52 +0100 Subject: [PATCH 08/13] make raymath compiling with msvc in c++ mode --- src/raymath.h | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/raymath.h b/src/raymath.h index decd02c5a..47f77e85a 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -227,21 +227,29 @@ RMDEF float Clamp(float value, float min, float max) //---------------------------------------------------------------------------------- // Vector with components value 0.0f -RMDEF Vector2 Vector2Zero(void) { return (Vector2){ 0.0f, 0.0f }; } +RMDEF Vector2 Vector2Zero(void) { + Vector2 tmp = {0.0f, 0.0f}; + return tmp; +} // Vector with components value 1.0f -RMDEF Vector2 Vector2One(void) { return (Vector2){ 1.0f, 1.0f }; } +RMDEF Vector2 Vector2One(void) { + Vector2 tmp = {1.0f, 1.0f}; + return tmp; +} // Add two vectors (v1 + v2) RMDEF Vector2 Vector2Add(Vector2 v1, Vector2 v2) { - return (Vector2){ v1.x + v2.x, v1.y + v2.y }; + Vector2 tmp = { v1.x + v2.x, v1.y + v2.y }; + return tmp; } // Subtract two vectors (v1 - v2) RMDEF Vector2 Vector2Subtract(Vector2 v1, Vector2 v2) { - return (Vector2){ v1.x - v2.x, v1.y - v2.y }; + Vector2 tmp = { v1.x - v2.x, v1.y - v2.y }; + return tmp; } // Calculate vector length @@ -289,7 +297,8 @@ RMDEF void Vector2Negate(Vector2 *v) // Divide vector by a float value RMDEF void Vector2Divide(Vector2 *v, float div) { - *v = (Vector2){v->x/div, v->y/div}; + Vector2 tmp = {v->x/div, v->y/div}; + *v = tmp; } // Normalize provided vector @@ -303,21 +312,29 @@ RMDEF void Vector2Normalize(Vector2 *v) //---------------------------------------------------------------------------------- // Vector with components value 0.0f -RMDEF Vector3 Vector3Zero(void) { return (Vector3){ 0.0f, 0.0f, 0.0f }; } +RMDEF Vector3 Vector3Zero(void) { + Vector3 tmp = { 0.0f, 0.0f, 0.0f }; + return tmp; +} // Vector with components value 1.0f -RMDEF Vector3 Vector3One(void) { return (Vector3){ 1.0f, 1.0f, 1.0f }; } +RMDEF Vector3 Vector3One(void) { + Vector3 tmp = { 1.0f, 1.0f, 1.0f }; + return tmp; +} // Add two vectors RMDEF Vector3 Vector3Add(Vector3 v1, Vector3 v2) { - return (Vector3){ v1.x + v2.x, v1.y + v2.y, v1.z + v2.z }; + Vector3 tmp = { v1.x + v2.x, v1.y + v2.y, v1.z + v2.z }; + return tmp; } // Substract two vectors RMDEF Vector3 Vector3Subtract(Vector3 v1, Vector3 v2) { - return (Vector3){ v1.x - v2.x, v1.y - v2.y, v1.z - v2.z }; + Vector3 tmp = { v1.x - v2.x, v1.y - v2.y, v1.z - v2.z }; + return tmp; } // Multiply vector by scalar @@ -365,12 +382,14 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v) if (fabsf(v.y) < min) { min = fabsf(v.y); - cardinalAxis = (Vector3){0.0f, 1.0f, 0.0f}; + Vector3 tmp = {0.0f, 1.0f, 0.0f}; + cardinalAxis = tmp; } if (fabsf(v.z) < min) { - cardinalAxis = (Vector3){0.0f, 0.0f, 1.0f}; + Vector3 tmp = {0.0f, 0.0f, 1.0f}; + cardinalAxis = tmp; } result = Vector3CrossProduct(v, cardinalAxis); @@ -1011,7 +1030,8 @@ RMDEF float *MatrixToFloat(Matrix mat) // Returns identity quaternion RMDEF Quaternion QuaternionIdentity(void) { - return (Quaternion){ 0.0f, 0.0f, 0.0f, 1.0f }; + Quaternion q = { 0.0f, 0.0f, 0.0f, 1.0f }; + return q; } // Computes the length of a quaternion From d51f382ef858700e173bd25a7f0fdd8ed64dbbb8 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:48:33 +0100 Subject: [PATCH 09/13] optimized matrixrotate function by removing identity matrix --- src/raymath.h | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/raymath.h b/src/raymath.h index 47f77e85a..3d95a0896 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -759,8 +759,6 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle) { Matrix result; - Matrix mat = MatrixIdentity(); - float x = axis.x, y = axis.y, z = axis.z; float length = sqrtf(x*x + y*y + z*z); @@ -777,33 +775,25 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle) float cosres = cosf(angle); float t = 1.0f - cosres; - // Cache some matrix values (speed optimization) - float a00 = mat.m0, a01 = mat.m1, a02 = mat.m2, a03 = mat.m3; - float a10 = mat.m4, a11 = mat.m5, a12 = mat.m6, a13 = mat.m7; - float a20 = mat.m8, a21 = mat.m9, a22 = mat.m10, a23 = mat.m11; + result.m0 = x*x*t + cosres; + result.m1 = y*x*t + z*sinres; + result.m2 = z*x*t - y*sinres; + result.m3 = 0.0f; - // Construct the elements of the rotation matrix - float b00 = x*x*t + cosres, b01 = y*x*t + z*sinres, b02 = z*x*t - y*sinres; - float b10 = x*y*t - z*sinres, b11 = y*y*t + cosres, b12 = z*y*t + x*sinres; - float b20 = x*z*t + y*sinres, b21 = y*z*t - x*sinres, b22 = z*z*t + cosres; - - // Perform rotation-specific matrix multiplication - result.m0 = a00*b00 + a10*b01 + a20*b02; - result.m1 = a01*b00 + a11*b01 + a21*b02; - result.m2 = a02*b00 + a12*b01 + a22*b02; - result.m3 = a03*b00 + a13*b01 + a23*b02; - result.m4 = a00*b10 + a10*b11 + a20*b12; - result.m5 = a01*b10 + a11*b11 + a21*b12; - result.m6 = a02*b10 + a12*b11 + a22*b12; - result.m7 = a03*b10 + a13*b11 + a23*b12; - result.m8 = a00*b20 + a10*b21 + a20*b22; - result.m9 = a01*b20 + a11*b21 + a21*b22; - result.m10 = a02*b20 + a12*b21 + a22*b22; - result.m11 = a03*b20 + a13*b21 + a23*b22; - result.m12 = mat.m12; - result.m13 = mat.m13; - result.m14 = mat.m14; - result.m15 = mat.m15; + result.m4 = x*y*t - z*sinres; + result.m5 = y*y*t + cosres; + result.m6 = z*y*t + x*sinres; + result.m7 = 0.0f; + + result.m8 = x*z*t + y*sinres; + result.m9 = y*z*t - x*sinres; + result.m10 = z*z*t + cosres; + result.m11 = 0.0f; + + result.m12 = 0.0f; + result.m13 = 0.0f; + result.m14 = 0.0f; + result.m15 = 1.0f; return result; } From b872de951b0c1a830e3452ede6fbdd471df0d025 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:49:31 +0100 Subject: [PATCH 10/13] fix for GetMatrixModelview (former cl) --- src/raylib.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/raylib.h b/src/raylib.h index ac7398308..9af218725 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1046,6 +1046,7 @@ RLAPI void SetShaderValuei(Shader shader, int uniformLoc, const int *value, int RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4) 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(); // Texture maps generation (PBR) // NOTE: Required shaders should be provided From 48d0c93ace63225231d56f6a7aaa058218622578 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:50:35 +0100 Subject: [PATCH 11/13] make GetTime available to user of library --- src/core.c | 4 ++-- src/raylib.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index 882aadcdf..011e0d763 100644 --- a/src/core.c +++ b/src/core.c @@ -352,7 +352,7 @@ extern void UnloadDefaultFont(void); // [Module: text] Unloads default fo static void InitGraphicsDevice(int width, int height); // Initialize graphics device static void SetupFramebufferSize(int displayWidth, int displayHeight); static void InitTimer(void); // Initialize timer -static double GetTime(void); // Returns time since InitTimer() was run + double GetTime(void); // Returns time since InitTimer() was run static void Wait(float ms); // Wait for some milliseconds (stop program execution) static bool GetKeyStatus(int key); // Returns if a key has been pressed static bool GetMouseButtonStatus(int button); // Returns if a mouse button has been pressed @@ -2120,7 +2120,7 @@ static void InitTimer(void) } // Get current time measure (in seconds) since InitTimer() -static double GetTime(void) +double GetTime(void) { #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) return glfwGetTime(); diff --git a/src/raylib.h b/src/raylib.h index 9af218725..0a9eab460 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -723,6 +723,9 @@ RLAPI void SetTargetFPS(int fps); // Set target RLAPI int GetFPS(void); // Returns current FPS RLAPI float GetFrameTime(void); // Returns time in seconds for last frame drawn +RLAPI double GetTime(void); // Return time in seconds + + // Color-related functions RLAPI int GetHexValue(Color color); // Returns hexadecimal value for a Color RLAPI Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value From 217917530b12c7332fb83381aef6acf9975e7361 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:51:17 +0100 Subject: [PATCH 12/13] fix for eventmarker missed in first cl --- src/rlgl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rlgl.c b/src/rlgl.c index 7ec4c4ac2..713646ace 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -4226,3 +4226,8 @@ void TraceLog(int msgType, const char *text, ...) if (msgType == LOG_ERROR) exit(1); } #endif + +void rlSetMarker(const char *text) { + if(debugMarkerSupported) + glInsertEventMarkerEXT(0, text); //0 terminated string +} From 2affac820e64393ac4294c53c1a7f47742e8dec9 Mon Sep 17 00:00:00 2001 From: user Date: Thu, 14 Dec 2017 11:52:45 +0100 Subject: [PATCH 13/13] make raylib not clash with windows-header --- src/core.c | 10 +++++----- src/raylib.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core.c b/src/core.c index 011e0d763..8e26d2b11 100644 --- a/src/core.c +++ b/src/core.c @@ -413,7 +413,7 @@ static void *GamepadThread(void *arg); // Mouse reading thread #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_WEB) // Initialize window and OpenGL context // NOTE: data parameter could be used to pass any kind of required data to the initialization -void InitWindow(int width, int height, void *data) +void InitRLWindow(int width, int height, void *data) { TraceLog(LOG_INFO, "Initializing raylib (v1.9-dev)"); @@ -477,7 +477,7 @@ void InitWindow(int width, int height, void *data) #if defined(PLATFORM_ANDROID) // Initialize window and OpenGL context (and Android activity) // NOTE: data parameter could be used to pass any kind of required data to the initialization -void InitWindow(int width, int height, void *data) +void InitRLWindow(int width, int height, void *data) { TraceLog(LOG_INFO, "Initializing raylib (v1.9-dev)"); @@ -538,7 +538,7 @@ void InitWindow(int width, int height, void *data) #endif // Close window and unload OpenGL context -void CloseWindow(void) +void CloseRLWindow(void) { #if defined(SUPPORT_GIF_RECORDING) if (gifRecording) @@ -715,7 +715,7 @@ int GetScreenHeight(void) } // Show mouse cursor -void ShowCursor() +void ShowRLCursor() { #if defined(PLATFORM_DESKTOP) #if defined(__linux__) @@ -728,7 +728,7 @@ void ShowCursor() } // Hides mouse cursor -void HideCursor() +void HideRLCursor() { #if defined(PLATFORM_DESKTOP) #if defined(__linux__) diff --git a/src/raylib.h b/src/raylib.h index 0a9eab460..16595b5bf 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -682,8 +682,8 @@ extern "C" { // Prevents name mangling of functions //------------------------------------------------------------------------------------ // Window-related functions -RLAPI void InitWindow(int width, int height, void *data); // Initialize window and OpenGL context -RLAPI void CloseWindow(void); // Close window and unload OpenGL context +RLAPI void InitRLWindow(int width, int height, void *data); // Initialize window and OpenGL context +RLAPI void CloseRLWindow(void); // Close window and unload OpenGL context RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus) RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP) @@ -696,8 +696,8 @@ RLAPI int GetScreenWidth(void); // Get current RLAPI int GetScreenHeight(void); // Get current screen height // Cursor-related functions -RLAPI void ShowCursor(void); // Shows cursor -RLAPI void HideCursor(void); // Hides cursor +RLAPI void ShowRLCursor(void); // Shows cursor +RLAPI void HideRLCursor(void); // Hides cursor RLAPI bool IsCursorHidden(void); // Check if cursor is not visible RLAPI void EnableCursor(void); // Enables cursor (unlock cursor) RLAPI void DisableCursor(void); // Disables cursor (lock cursor)