More rlgl General render state functions. Fixed rlgl function prefix to rl.

This commit is contained in:
jussi
2023-05-15 14:18:58 +03:00
parent b387742850
commit 870e3a46a6
7 changed files with 290 additions and 5 deletions

75
API.md
View File

@@ -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
---

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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 );

View File

@@ -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. */

View File

@@ -7,6 +7,114 @@
## RLGL - General render state
*/
/*
> 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 )
@@ -40,6 +148,28 @@ int lrlglGetLineWidth( lua_State *L ) {
return 1;
}
/*
> 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
*/