From 5438a70b0a5aac72c071c90650b509cf46e557cb Mon Sep 17 00:00:00 2001 From: jussi Date: Fri, 4 Aug 2023 22:21:40 +0300 Subject: logLevelInvalid for bad function calls and invalid data formats. --- src/rlgl.c | 78 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/rlgl.c') diff --git a/src/rlgl.c b/src/rlgl.c index 205d314..736541d 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -17,7 +17,7 @@ Choose the current matrix to be transformed */ int lrlglMatrixMode( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlMatrixMode( int mode )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlMatrixMode( int mode )" ); lua_pushboolean( L, false ); return 1; } @@ -70,7 +70,7 @@ Multiply the current matrix by a translation matrix */ int lrlglTranslatef( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlTranslatef( Vector3 translation )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlTranslatef( Vector3 translation )" ); lua_pushboolean( L, false ); return 1; } @@ -92,7 +92,7 @@ Multiply the current matrix by a rotation matrix */ int lrlglRotatef( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_istable( L, 2 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlRotatef( float angle, Vector3 rotation )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlRotatef( float angle, Vector3 rotation )" ); lua_pushboolean( L, false ); return 1; } @@ -115,7 +115,7 @@ Multiply the current matrix by a scaling matrix */ int lrlglScalef( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlScalef( Vector3 scale )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlScalef( Vector3 scale )" ); lua_pushboolean( L, false ); return 1; } @@ -137,7 +137,7 @@ Multiply the current matrix by another matrix */ int lrlglMultMatrixf( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlMultMatrixf( Matrix matrix )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlMultMatrixf( Matrix matrix )" ); lua_pushboolean( L, false ); return 1; } @@ -165,7 +165,7 @@ Multiply the current matrix by a perspective matrix generated by parameters int lrlglFrustum( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) || !lua_isnumber( L, 5 ) || !lua_isnumber( L, 6 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlFrustum( float left, float right, float bottom, float top, float znear, float zfar )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlFrustum( float left, float right, float bottom, float top, float znear, float zfar )" ); lua_pushboolean( L, false ); return 1; } @@ -193,7 +193,7 @@ Multiply the current matrix by an orthographic matrix generated by parameters int lrlglOrtho( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) || !lua_isnumber( L, 5 ) || !lua_isnumber( L, 6 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlOrtho( float left, float right, float bottom, float top, float znear, float zfar )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlOrtho( float left, float right, float bottom, float top, float znear, float zfar )" ); lua_pushboolean( L, false ); return 1; } @@ -221,7 +221,7 @@ NOTE: We store current viewport dimensions */ int lrlglViewport( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlViewport( Rectangle viewport )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlViewport( Rectangle viewport )" ); lua_pushboolean( L, false ); return 1; } @@ -247,7 +247,7 @@ Initialize drawing mode ( how to organize vertex ) */ int lrlglBegin( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlBegin( int mode )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlBegin( int mode )" ); lua_pushboolean( L, false ); return 1; } @@ -278,7 +278,7 @@ Define one vertex ( position ) */ int lrlglVertex2f( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlVertex2f( Vector2 position )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlVertex2f( Vector2 position )" ); lua_pushboolean( L, false ); return 1; } @@ -300,7 +300,7 @@ Define one vertex ( position ) */ int lrlglVertex3f( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlVertex3f( Vector3 position )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlVertex3f( Vector3 position )" ); lua_pushboolean( L, false ); return 1; } @@ -322,7 +322,7 @@ Define one vertex ( texture coordinate ) - 2 float */ int lrlglTexCoord2f( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlTexCoord2f( Vector2 texCoord )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlTexCoord2f( Vector2 texCoord )" ); lua_pushboolean( L, false ); return 1; } @@ -344,7 +344,7 @@ Define one vertex ( normal ) - 3 float */ int lrlglNormal3f( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlNormal3f( Vector3 normal )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlNormal3f( Vector3 normal )" ); lua_pushboolean( L, false ); return 1; } @@ -366,7 +366,7 @@ Define one vertex ( color ) - 4 byte */ int lrlglColor4ub( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlColor4ub( Color color )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlColor4ub( Color color )" ); lua_pushboolean( L, false ); return 1; } @@ -388,7 +388,7 @@ Define one vertex ( color ) - 3 float */ int lrlglColor3f( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlColor3f( Vector3 color )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlColor3f( Vector3 color )" ); lua_pushboolean( L, false ); return 1; } @@ -410,7 +410,7 @@ Define one vertex ( color ) - 4 float */ int lrlglColor4f( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlColor4f( Vector4 color )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlColor4f( Vector4 color )" ); lua_pushboolean( L, false ); return 1; } @@ -436,7 +436,7 @@ Select and active a texture slot */ int lrlglActiveTextureSlot( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlActiveTextureSlot( int slot )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlActiveTextureSlot( int slot )" ); lua_pushboolean( L, false ); return 1; } @@ -456,7 +456,7 @@ Enable texture */ int lrlglEnableTexture( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlEnableTexture( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlEnableTexture( int id )" ); lua_pushboolean( L, false ); return 1; } @@ -487,7 +487,7 @@ Enable texture cubemap */ int lrlglEnableTextureCubemap( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlEnableTextureCubemap( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlEnableTextureCubemap( int id )" ); lua_pushboolean( L, false ); return 1; } @@ -518,7 +518,7 @@ Set texture parameters ( filter, wrap ) */ int lrlglTextureParameters( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlTextureParameters( int id, int param, int value )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlTextureParameters( int id, int param, int value )" ); lua_pushboolean( L, false ); return 1; } @@ -542,7 +542,7 @@ Set cubemap parameters ( filter, wrap ) */ int lrlglCubemapParameters( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlCubemapParameters( int id, int param, int value )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlCubemapParameters( int id, int param, int value )" ); lua_pushboolean( L, false ); return 1; } @@ -570,7 +570,7 @@ Enable render texture (fbo) */ int lrlglEnableFramebuffer( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlEnableFramebuffer( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlEnableFramebuffer( int id )" ); lua_pushboolean( L, false ); return 1; } @@ -601,7 +601,7 @@ Activate multiple draw color buffers */ int lrlglActiveDrawBuffers( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlActiveDrawBuffers( int count )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlActiveDrawBuffers( int count )" ); lua_pushboolean( L, false ); return 1; } @@ -713,7 +713,7 @@ Set face culling mode */ int lrlglSetCullFace( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetCullFace( int mode )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlSetCullFace( int mode )" ); lua_pushboolean( L, false ); return 1; } @@ -755,7 +755,7 @@ Scissor test */ int lrlglScissor( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlScissor( Rectangle area )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlScissor( Rectangle area )" ); lua_pushboolean( L, false ); return 1; } @@ -799,7 +799,7 @@ Set the line drawing width */ int lrlglSetLineWidth( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetLineWidth( float width )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlSetLineWidth( float width )" ); lua_pushboolean( L, false ); return 1; } @@ -889,7 +889,7 @@ Clear color buffer with color */ int lrlglClearColor( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlClearColor( Color color )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlClearColor( Color color )" ); lua_pushboolean( L, false ); return 1; } @@ -933,7 +933,7 @@ Set blending mode */ int lrlglSetBlendMode( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetBlendMode( int mode )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlSetBlendMode( int mode )" ); lua_pushboolean( L, false ); return 1; } @@ -953,7 +953,7 @@ Set blending mode factor and equation ( using OpenGL factors ) */ int lrlglSetBlendFactors( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetBlendFactors( int glSrcFactor, int glDstFactor, int glEquation )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlSetBlendFactors( int glSrcFactor, int glDstFactor, int glEquation )" ); lua_pushboolean( L, false ); return 1; } @@ -978,7 +978,7 @@ Set blending mode factors and equations separately ( using OpenGL factors ) int lrlglSetBlendFactorsSeparate( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) || !lua_isnumber( L, 5 ) || !lua_isnumber( L, 6 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetBlendFactorsSeparate( int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlSetBlendFactorsSeparate( int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha )" ); lua_pushboolean( L, false ); return 1; } @@ -1038,7 +1038,7 @@ Check internal buffer overflow for a given number of vertex and force a rlRender */ int lrlglCheckRenderBatchLimit( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlCheckRenderBatchLimit( int vCount )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlCheckRenderBatchLimit( int vCount )" ); lua_pushnil( L ); return 1; } @@ -1057,7 +1057,7 @@ Set current texture for render batch and check buffers limits */ int lrlglSetTexture( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetTexture( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlSetTexture( int id )" ); lua_pushboolean( L, false ); return 1; } @@ -1081,7 +1081,7 @@ Load texture in GPU */ int lrlglLoadTexture( lua_State *L ) { if ( !lua_istable( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlLoadTexture( Vector2 size, int format, int mipmapCount )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlLoadTexture( Vector2 size, int format, int mipmapCount )" ); lua_pushinteger( L, -1 ); return 1; } @@ -1104,7 +1104,7 @@ Load depth texture/renderbuffer ( to be attached to fbo ) */ int lrlglLoadTextureDepth( lua_State *L ) { if ( !lua_istable( L, 1 ) || !lua_isboolean( L, 2 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlLoadTextureDepth( Vector2 size, bool useRenderBuffer )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlLoadTextureDepth( Vector2 size, bool useRenderBuffer )" ); lua_pushinteger( L, -1 ); return 1; } @@ -1126,7 +1126,7 @@ Unload texture from GPU memory */ int lrlglUnloadTexture( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlUnloadTexture( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlUnloadTexture( int id )" ); lua_pushboolean( L, false ); return 1; } @@ -1150,7 +1150,7 @@ Load an empty framebuffer */ int lrlglLoadFramebuffer( lua_State *L ) { if ( !lua_istable( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlLoadFramebuffer( Vector2 size )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlLoadFramebuffer( Vector2 size )" ); lua_pushinteger( L, -1 ); return 1; } @@ -1172,7 +1172,7 @@ Attach texture/renderbuffer to a framebuffer int lrlglFramebufferAttach( lua_State *L ) { if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isnumber( L, 3 ) || !lua_isnumber( L, 4 ) || !lua_isnumber( L, 5 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlFramebufferAttach( int fboId, int texId, int attachType, int texType, int mipLevel )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlFramebufferAttach( int fboId, int texId, int attachType, int texType, int mipLevel )" ); lua_pushboolean( L, false ); return 1; } @@ -1198,7 +1198,7 @@ Verify framebuffer is complete */ int lrlglFramebufferComplete( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlFramebufferComplete( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlFramebufferComplete( int id )" ); lua_pushnil( L ); return 1; } @@ -1219,7 +1219,7 @@ Delete framebuffer from GPU */ int lrlglUnloadFramebuffer( lua_State *L ) { if ( !lua_isnumber( L, 1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlUnloadFramebuffer( int id )" ); + TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.rlUnloadFramebuffer( int id )" ); lua_pushboolean( L, false ); return 1; } -- cgit v1.2.3