diff options
| -rw-r--r-- | API.md | 75 | ||||
| -rw-r--r-- | CMakeLists.txt | 4 | ||||
| -rw-r--r-- | ReiLua_API.lua | 52 | ||||
| -rw-r--r-- | changelog | 3 | ||||
| -rw-r--r-- | include/lrlgl.h | 11 | ||||
| -rw-r--r-- | src/lua_core.c | 20 | ||||
| -rw-r--r-- | src/rlgl.c | 130 |
7 files changed, 290 insertions, 5 deletions
@@ -933,6 +933,12 @@ RL_OPENGL_43 RL_OPENGL_ES_20 +## Globals - rlCullMode + +RL_CULL_FACE_FRONT + +RL_CULL_FACE_BACK + ## Globals - OpenGL GL_COLOR_BUFFER_BIT @@ -6464,6 +6470,63 @@ Send light properties to shader --- +> RL.rlEnableColorBlend() + +Enable color blending + +--- + +> RL.rlDisableColorBlend() + +Disable color blending + +--- + +> RL.rlEnableDepthTest() + +Enable depth test + +--- + +> RL.rlDisableDepthTest() + +Disable depth test + +--- + +> RL.rlEnableDepthMask() + +Enable depth write + +--- + +> RL.rlDisableDepthMask() + +Disable depth write + +--- + +> RL.rlEnableBackfaceCulling() + +Enable backface culling + +--- + +> RL.rlDisableBackfaceCulling() + +Disable backface culling + +--- + +> success = RL.rlSetCullFace( int mode ) + +Set face culling mode + +- Failure return false +- Success return true + +--- + > success = RL.rlSetLineWidth( float width ) Set the line drawing width @@ -6481,6 +6544,18 @@ Get the line drawing width --- +> RL.rlEnableSmoothLines() + +Enable line aliasing + +--- + +> RL.rlDisableSmoothLines() + +Disable line aliasing + +--- + ## RLGL - Initialization functions --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d2e985..90987a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ if( EMSCRIPTEN ) # Web target_link_libraries( ${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/lib/web/libraylib.a ) target_link_libraries( ${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/lib/web/liblua.a ) + # Try "-s USE_PTHREADS" if not getting pixel perfect rendering. set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY" ) set( CMAKE_EXECUTABLE_SUFFIX ".html" ) # This line is used to set your executable to build with the emscripten html template so that you can directly open it. set( resources_dir "resources" ) @@ -44,7 +45,8 @@ else() # Desktop if( DRM ) # Mainly for Raspberry Pi # target_link_libraries( ${PROJECT_NAME} GLESv2 EGL drm gbm rt bcm_host m dl pthread ) - target_link_libraries( ${PROJECT_NAME} GLESv2 EGL drm gbm rt m dl pthread ) + # target_link_libraries( ${PROJECT_NAME} GLESv2 EGL drm gbm pthread rt m dl ) + target_link_libraries( ${PROJECT_NAME} raylib GLESv2 EGL pthread rt m gbm drm dl atomic ) else() target_link_libraries( ${PROJECT_NAME} m dl pthread ) endif() diff --git a/ReiLua_API.lua b/ReiLua_API.lua index a0b3dd0..d850b65 100644 --- a/ReiLua_API.lua +++ b/ReiLua_API.lua @@ -551,6 +551,11 @@ RL.RL_OPENGL_33=3 RL.RL_OPENGL_43=4 RL.RL_OPENGL_ES_20=5 +-- Globals - rlCullMode + +RL.RL_CULL_FACE_FRONT=0 +RL.RL_CULL_FACE_BACK=1 + -- Globals - OpenGL RL.GL_COLOR_BUFFER_BIT=16384 @@ -5286,6 +5291,45 @@ function RL.UpdateLightValues( shader, light ) end -- RLGL - General render state +---Enable color blending +---@return any RL.rlEnableColorBlend +function RL.rlEnableColorBlend() end + +---Disable color blending +---@return any RL.rlDisableColorBlend +function RL.rlDisableColorBlend() end + +---Enable depth test +---@return any RL.rlEnableDepthTest +function RL.rlEnableDepthTest() end + +---Disable depth test +---@return any RL.rlDisableDepthTest +function RL.rlDisableDepthTest() end + +---Enable depth write +---@return any RL.rlEnableDepthMask +function RL.rlEnableDepthMask() end + +---Disable depth write +---@return any RL.rlDisableDepthMask +function RL.rlDisableDepthMask() end + +---Enable backface culling +---@return any RL.rlEnableBackfaceCulling +function RL.rlEnableBackfaceCulling() end + +---Disable backface culling +---@return any RL.rlDisableBackfaceCulling +function RL.rlDisableBackfaceCulling() end + +---Set face culling mode +---- Failure return false +---- Success return true +---@param mode integer +---@return any success +function RL.rlSetCullFace( mode ) end + ---Set the line drawing width ---- Failure return false ---- Success return true @@ -5298,6 +5342,14 @@ function RL.rlSetLineWidth( width ) end ---@return any width function RL.rlGetLineWidth() end +---Enable line aliasing +---@return any RL.rlEnableSmoothLines +function RL.rlEnableSmoothLines() end + +---Disable line aliasing +---@return any RL.rlDisableSmoothLines +function RL.rlDisableSmoothLines() end + -- RLGL - Initialization functions ---Get current OpenGL version @@ -69,7 +69,8 @@ Detailed changes: - ADDED: IsTextureReady - FIXED: UnloadTexture did not set texture id to NULL. - ADDED: DrawBillboardPro - - ADDED: rlglGetVersion + - ADDED: rlGetVersion + - ADDED: More rlgl General render state functions. ------------------------------------------------------------------------ Release: ReiLua version 0.4.0 Using Raylib 4.2 diff --git a/include/lrlgl.h b/include/lrlgl.h index c307302..565e816 100644 --- a/include/lrlgl.h +++ b/include/lrlgl.h @@ -1,7 +1,18 @@ #pragma once /* General render state. */ +int lrlglEnableColorBlend( lua_State *L ); +int lrlglDisableColorBlend( lua_State *L ); +int lrlglEnableDepthTest( lua_State *L ); +int lrlglDisableDepthTest( lua_State *L ); +int lrlglEnableDepthMask( lua_State *L ); +int lrlglDisableDepthMask( lua_State *L ); +int lrlglEnableBackfaceCulling( lua_State *L ); +int lrlglDisableBackfaceCulling( lua_State *L ); +int lrlglSetCullFace( lua_State *L ); int lrlglSetLineWidth( lua_State *L ); int lrlglGetLineWidth( lua_State *L ); +int lrlglEnableSmoothLines( lua_State *L ); +int lrlglDisableSmoothLines( lua_State *L ); /* Initialization functions */ int lrlglGetVersion( lua_State *L );
\ No newline at end of file diff --git a/src/lua_core.c b/src/lua_core.c index 1caf1c7..5b51114 100644 --- a/src/lua_core.c +++ b/src/lua_core.c @@ -498,6 +498,9 @@ void defineGlobals() { assignGlobalInt( RL_OPENGL_33, "RL_OPENGL_33" ); assignGlobalInt( RL_OPENGL_43, "RL_OPENGL_43" ); assignGlobalInt( RL_OPENGL_ES_20, "RL_OPENGL_ES_20" ); + /* rlCullMode */ + assignGlobalInt( RL_CULL_FACE_FRONT, "RL_CULL_FACE_FRONT" ); + assignGlobalInt( RL_CULL_FACE_BACK, "RL_CULL_FACE_BACK" ); /* OpenGL */ assignGlobalInt( GL_COLOR_BUFFER_BIT, "GL_COLOR_BUFFER_BIT" ); assignGlobalInt( GL_DEPTH_BUFFER_BIT, "GL_DEPTH_BUFFER_BIT" ); @@ -1355,10 +1358,21 @@ void luaRegister() { /* RLGL */ /* General render state. */ - assingGlobalFunction( "rlglSetLineWidth", lrlglSetLineWidth ); - assingGlobalFunction( "rlglGetLineWidth", lrlglGetLineWidth ); + assingGlobalFunction( "rlEnableColorBlend", lrlglEnableColorBlend ); + assingGlobalFunction( "rlDisableColorBlend", lrlglDisableColorBlend ); + assingGlobalFunction( "rlEnableDepthTest", lrlglEnableDepthTest ); + assingGlobalFunction( "rlDisableDepthTest", lrlglDisableDepthTest ); + assingGlobalFunction( "rlEnableDepthMask", lrlglEnableDepthMask ); + assingGlobalFunction( "rlDisableDepthMask", lrlglDisableDepthMask ); + assingGlobalFunction( "rlEnableBackfaceCulling", lrlglEnableBackfaceCulling ); + assingGlobalFunction( "rlDisableBackfaceCulling", lrlglDisableBackfaceCulling ); + assingGlobalFunction( "rlSetCullFace", lrlglSetCullFace ); + assingGlobalFunction( "rlSetLineWidth", lrlglSetLineWidth ); + assingGlobalFunction( "rlGetLineWidth", lrlglGetLineWidth ); + assingGlobalFunction( "rlEnableSmoothLines", lrlglEnableSmoothLines ); + assingGlobalFunction( "rlDisableSmoothLines", lrlglDisableSmoothLines ); /* Initialization functions. */ - assingGlobalFunction( "rlglGetVersion", lrlglGetVersion ); + assingGlobalFunction( "rlGetVersion", lrlglGetVersion ); /* OpenGL */ /* Framebuffer management. */ @@ -8,6 +8,114 @@ */ /* +> RL.rlEnableColorBlend() + +Enable color blending +*/ +int lrlglEnableColorBlend( lua_State *L ) { + rlEnableColorBlend(); + + return 0; +} + +/* +> RL.rlDisableColorBlend() + +Disable color blending +*/ +int lrlglDisableColorBlend( lua_State *L ) { + rlDisableColorBlend(); + + return 0; +} + +/* +> RL.rlEnableDepthTest() + +Enable depth test +*/ +int lrlglEnableDepthTest( lua_State *L ) { + rlEnableDepthTest(); + + return 0; +} + +/* +> RL.rlDisableDepthTest() + +Disable depth test +*/ +int lrlglDisableDepthTest( lua_State *L ) { + rlDisableDepthTest(); + + return 0; +} + +/* +> RL.rlEnableDepthMask() + +Enable depth write +*/ +int lrlglEnableDepthMask( lua_State *L ) { + rlEnableDepthMask(); + + return 0; +} + +/* +> RL.rlDisableDepthMask() + +Disable depth write +*/ +int lrlglDisableDepthMask( lua_State *L ) { + rlDisableDepthMask(); + + return 0; +} + +/* +> RL.rlEnableBackfaceCulling() + +Enable backface culling +*/ +int lrlglEnableBackfaceCulling( lua_State *L ) { + rlEnableBackfaceCulling(); + + return 0; +} + +/* +> RL.rlDisableBackfaceCulling() + +Disable backface culling +*/ +int lrlglDisableBackfaceCulling( lua_State *L ) { + rlDisableBackfaceCulling(); + + return 0; +} + +/* +> success = RL.rlSetCullFace( int mode ) + +Set face culling mode + +- Failure return false +- Success return true +*/ +int lrlglSetCullFace( lua_State *L ) { + if ( !lua_isnumber( L, 1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetCullFace( int mode )" ); + lua_pushboolean( L, false ); + return 1; + } + rlSetCullFace( lua_tointeger( L, 1 ) ); + lua_pushboolean( L, true ); + + return 1; +} + +/* > success = RL.rlSetLineWidth( float width ) Set the line drawing width @@ -41,6 +149,28 @@ int lrlglGetLineWidth( lua_State *L ) { } /* +> RL.rlEnableSmoothLines() + +Enable line aliasing +*/ +int lrlglEnableSmoothLines( lua_State *L ) { + rlEnableSmoothLines(); + + return 0; +} + +/* +> RL.rlDisableSmoothLines() + +Disable line aliasing +*/ +int lrlglDisableSmoothLines( lua_State *L ) { + rlDisableSmoothLines(); + + return 0; +} + +/* ## RLGL - Initialization functions */ |
