glDepthRange and glPolygonOffset.

This commit is contained in:
jussi
2024-10-25 21:19:42 +03:00
parent ab995f3453
commit cddfc09ccc
11 changed files with 87 additions and 13 deletions

26
API.md
View File

@@ -3398,6 +3398,14 @@ If enabled, an offset is added to depth values of a polygon's fragments produced
--- ---
> GL_POLYGON_OFFSET_LINE = 10754
---
> GL_POLYGON_OFFSET_POINT = 10753
---
> GL_SAMPLE_ALPHA_TO_COVERAGE = 32926 > GL_SAMPLE_ALPHA_TO_COVERAGE = 32926
If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value
@@ -7632,7 +7640,7 @@ Compute mesh tangents
> meshData = RL.GetMeshData( Mesh mesh ) > meshData = RL.GetMeshData( Mesh mesh )
Get mesh data as table. Get mesh vertex attributes data as table.
- Success return Mesh{} - Success return Mesh{}
@@ -9391,7 +9399,7 @@ Get gui state (global state)
--- ---
> RL.GuiSetSliderDragging() > RL.GuiSetSliderDragging( bool dragging )
Set guiSliderDragging Set guiSliderDragging
@@ -9405,7 +9413,7 @@ Get guiSliderDragging
--- ---
> RL.GuiSetSliderActive() > RL.GuiSetSliderActive( Rectange rect )
Set guiSliderActive Set guiSliderActive
@@ -10957,6 +10965,12 @@ Use nil RenderTexture for window framebuffer
--- ---
> RL.glDepthRange( float nearVal, float farVal )
Specify mapping of depth values from normalized device coordinates to window coordinates
---
> RL.glEnable( int cap ) > RL.glEnable( int cap )
Enable server-side GL capabilities Enable server-side GL capabilities
@@ -10969,6 +10983,12 @@ Disable server-side GL capabilities
--- ---
> RL.glPolygonOffset( float factor, float units )
Set the scale and units used to calculate depth values
---
> RL.glStencilFunc( int func, int ref, int mask ) > RL.glStencilFunc( int func, int ref, int mask )
Set front and back function and reference value for stencil testing Set front and back function and reference value for stencil testing

View File

@@ -1181,6 +1181,8 @@ RL.GL_DEPTH_TEST=2929
RL.GL_DITHER=3024 RL.GL_DITHER=3024
---If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset ---If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset
RL.GL_POLYGON_OFFSET_FILL=32823 RL.GL_POLYGON_OFFSET_FILL=32823
RL.GL_POLYGON_OFFSET_LINE=10754
RL.GL_POLYGON_OFFSET_POINT=10753
---If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value ---If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value
RL.GL_SAMPLE_ALPHA_TO_COVERAGE=32926 RL.GL_SAMPLE_ALPHA_TO_COVERAGE=32926
---If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage ---If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage
@@ -4811,7 +4813,7 @@ function RL.GetMeshBoundingBox( mesh ) end
---@return any RL.GenMeshTangents ---@return any RL.GenMeshTangents
function RL.GenMeshTangents( mesh ) end function RL.GenMeshTangents( mesh ) end
---Get mesh data as table. ---Get mesh vertex attributes data as table.
---- Success return Mesh{} ---- Success return Mesh{}
---@param mesh any ---@param mesh any
---@return any meshData ---@return any meshData
@@ -6326,8 +6328,9 @@ function RL.GuiSetState( state ) end
function RL.GuiGetState() end function RL.GuiGetState() end
---Set guiSliderDragging ---Set guiSliderDragging
---@param dragging boolean
---@return any RL.GuiSetSliderDragging ---@return any RL.GuiSetSliderDragging
function RL.GuiSetSliderDragging() end function RL.GuiSetSliderDragging( dragging ) end
---Get guiSliderDragging ---Get guiSliderDragging
---- Success return bool ---- Success return bool
@@ -6335,8 +6338,9 @@ function RL.GuiSetSliderDragging() end
function RL.GuiGetSliderDragging() end function RL.GuiGetSliderDragging() end
---Set guiSliderActive ---Set guiSliderActive
---@param rect any
---@return any RL.GuiSetSliderActive ---@return any RL.GuiSetSliderActive
function RL.GuiSetSliderActive() end function RL.GuiSetSliderActive( rect ) end
---Get guiSliderActive ---Get guiSliderActive
---- Success return Rectangle ---- Success return Rectangle
@@ -7730,6 +7734,12 @@ function RL.glBlitFramebuffer( srcTex, dstTex, srcRect, dstRect, mask, filter )
-- OpenGL - State Management -- OpenGL - State Management
---Specify mapping of depth values from normalized device coordinates to window coordinates
---@param nearVal number
---@param farVal number
---@return any RL.glDepthRange
function RL.glDepthRange( nearVal, farVal ) end
---Enable server-side GL capabilities ---Enable server-side GL capabilities
---@param cap integer ---@param cap integer
---@return any RL.glEnable ---@return any RL.glEnable
@@ -7740,6 +7750,12 @@ function RL.glEnable( cap ) end
---@return any RL.glDisable ---@return any RL.glDisable
function RL.glDisable( cap ) end function RL.glDisable( cap ) end
---Set the scale and units used to calculate depth values
---@param factor number
---@param units number
---@return any RL.glPolygonOffset
function RL.glPolygonOffset( factor, units ) end
---Set front and back function and reference value for stencil testing ---Set front and back function and reference value for stencil testing
---@param func integer ---@param func integer
---@param ref integer ---@param ref integer

View File

@@ -75,6 +75,7 @@ DETAILED CHANGES:
- CHANGE: UnloadMaterial can also optionally free textures and shader. - CHANGE: UnloadMaterial can also optionally free textures and shader.
- ADDED: FontCopy. - ADDED: FontCopy.
- ADDED: GuiSetSliderDragging, GuiGetSliderDragging, GuiSetSliderActive and GuiGetSliderActive. - ADDED: GuiSetSliderDragging, GuiGetSliderDragging, GuiSetSliderActive and GuiGetSliderActive.
- ADDED: glDepthRange and glPolygonOffset.
------------------------------------------------------------------------ ------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0 Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0

View File

@@ -17,6 +17,7 @@ Backlog {
* CBuffer * CBuffer
* Check endianess. * Check endianess.
* SDL2 platform specific functions.
* Textures * Textures
* Try making atlas packer with stbrp_pack_rects. * Try making atlas packer with stbrp_pack_rects.
* Examples * Examples
@@ -32,6 +33,8 @@ Bugs {
Notes { Notes {
* raylib 5.5 * raylib 5.5
* DrawBillboardPro BREAKING CHANGE. * DrawBillboardPro BREAKING CHANGE.
* Some functions for data validation has been renamed from Is**Ready() to Is**Valid().
} }
Needs Testing { Needs Testing {

View File

@@ -100,8 +100,8 @@ function RL.init()
lightTex = RL.LoadTexture( RL.GetBasePath().."../resources/images/light.png" ) lightTex = RL.LoadTexture( RL.GetBasePath().."../resources/images/light.png" )
lightTexSize = Vector2:newT( RL.GetTextureSize( lightTex ) ) lightTexSize = Vector2:newT( RL.GetTextureSize( lightTex ) )
RL.SetTextureFilter( tileTex, RL.TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( tileTex, RL.TEXTURE_FILTER_BILINEAR )
RL.SetTextureFilter( lightTex, RL.TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( lightTex, RL.TEXTURE_FILTER_BILINEAR )
createShadowMesh() createShadowMesh()

View File

@@ -5,8 +5,10 @@ int lglClear( lua_State* L );
/* Frame Buffers. */ /* Frame Buffers. */
int lglBlitFramebuffer( lua_State* L ); int lglBlitFramebuffer( lua_State* L );
/* State Management. */ /* State Management. */
int lglDepthRange( lua_State* L );
int lglEnable( lua_State* L ); int lglEnable( lua_State* L );
int lglDisable( lua_State* L ); int lglDisable( lua_State* L );
int lglPolygonOffset( lua_State* L );
int lglStencilFunc( lua_State* L ); int lglStencilFunc( lua_State* L );
int lglStencilFuncSeparate( lua_State* L ); int lglStencilFuncSeparate( lua_State* L );
int lglStencilMask( lua_State* L ); int lglStencilMask( lua_State* L );

View File

@@ -2731,7 +2731,7 @@ int GuiTextBox(Rectangle bounds, char *text, int bufferSize, bool editMode)
{ {
GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED))); GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)));
} }
else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), BLANK); else GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_NORMAL)));
// Draw text considering index offset if required // Draw text considering index offset if required
// NOTE: Text index offset depends on cursor position // NOTE: Text index offset depends on cursor position
@@ -2956,7 +2956,7 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
// Draw control // Draw control
//-------------------------------------------------------------------- //--------------------------------------------------------------------
Color baseColor = BLANK; Color baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_NORMAL));
if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED)); if (state == STATE_PRESSED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_PRESSED));
else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED)); else if (state == STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED));

View File

@@ -77,6 +77,20 @@ int lglBlitFramebuffer( lua_State* L ) {
## OpenGL - State Management ## OpenGL - State Management
*/ */
/*
> RL.glDepthRange( float nearVal, float farVal )
Specify mapping of depth values from normalized device coordinates to window coordinates
*/
int lglDepthRange( lua_State* L ) {
float nearVal = luaL_checknumber( L, 1 );
float farVal = luaL_checknumber( L, 2 );
glDepthRange( nearVal, farVal );
return 0;
}
/* /*
> RL.glEnable( int cap ) > RL.glEnable( int cap )
@@ -103,6 +117,20 @@ int lglDisable( lua_State* L ) {
return 0; return 0;
} }
/*
> RL.glPolygonOffset( float factor, float units )
Set the scale and units used to calculate depth values
*/
int lglPolygonOffset( lua_State* L ) {
float factor = luaL_checknumber( L, 1 );
float units = luaL_checknumber( L, 2 );
glPolygonOffset( factor, units );
return 0;
}
/* /*
> RL.glStencilFunc( int func, int ref, int mask ) > RL.glStencilFunc( int func, int ref, int mask )

View File

@@ -983,6 +983,8 @@ static void defineGlobals() {
assignGlobalInt( GL_DEPTH_TEST, "GL_DEPTH_TEST" ); // If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRangef assignGlobalInt( GL_DEPTH_TEST, "GL_DEPTH_TEST" ); // If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRangef
assignGlobalInt( GL_DITHER, "GL_DITHER" ); // If enabled, dither color components or indices before they are written to the color buffer assignGlobalInt( GL_DITHER, "GL_DITHER" ); // If enabled, dither color components or indices before they are written to the color buffer
assignGlobalInt( GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL" ); // If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset assignGlobalInt( GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL" ); // If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset
assignGlobalInt( GL_POLYGON_OFFSET_LINE, "GL_POLYGON_OFFSET_LINE" );
assignGlobalInt( GL_POLYGON_OFFSET_POINT, "GL_POLYGON_OFFSET_POINT" );
assignGlobalInt( GL_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE" ); // If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value assignGlobalInt( GL_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE" ); // If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value
assignGlobalInt( GL_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE" ); // If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage assignGlobalInt( GL_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE" ); // If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage
assignGlobalInt( GL_SCISSOR_TEST, "GL_SCISSOR_TEST" ); // If enabled, discard fragments that are outside the scissor rectangle. See glScissor assignGlobalInt( GL_SCISSOR_TEST, "GL_SCISSOR_TEST" ); // If enabled, discard fragments that are outside the scissor rectangle. See glScissor
@@ -2323,8 +2325,10 @@ void luaRegister() {
/* Frame Buffers. */ /* Frame Buffers. */
assingGlobalFunction( "glBlitFramebuffer", lglBlitFramebuffer ); assingGlobalFunction( "glBlitFramebuffer", lglBlitFramebuffer );
/* State Management. */ /* State Management. */
assingGlobalFunction( "glDepthRange", lglDepthRange );
assingGlobalFunction( "glEnable", lglEnable ); assingGlobalFunction( "glEnable", lglEnable );
assingGlobalFunction( "glDisable", lglDisable ); assingGlobalFunction( "glDisable", lglDisable );
assingGlobalFunction( "glPolygonOffset", lglPolygonOffset );
assingGlobalFunction( "glStencilFunc", lglStencilFunc ); assingGlobalFunction( "glStencilFunc", lglStencilFunc );
assingGlobalFunction( "glStencilFuncSeparate", lglStencilFuncSeparate ); assingGlobalFunction( "glStencilFuncSeparate", lglStencilFuncSeparate );
assingGlobalFunction( "glStencilMask", lglStencilMask ); assingGlobalFunction( "glStencilMask", lglStencilMask );

View File

@@ -1317,7 +1317,7 @@ int lmodelsGenMeshTangents( lua_State* L ) {
/* /*
> meshData = RL.GetMeshData( Mesh mesh ) > meshData = RL.GetMeshData( Mesh mesh )
Get mesh data as table. Get mesh vertex attributes data as table.
- Success return Mesh{} - Success return Mesh{}
*/ */

View File

@@ -117,7 +117,7 @@ int lguiGuiGetState( lua_State* L ) {
} }
/* /*
> RL.GuiSetSliderDragging() > RL.GuiSetSliderDragging( bool dragging )
Set guiSliderDragging Set guiSliderDragging
*/ */
@@ -143,7 +143,7 @@ int lguiGuiGetSliderDragging( lua_State* L ) {
} }
/* /*
> RL.GuiSetSliderActive() > RL.GuiSetSliderActive( Rectange rect )
Set guiSliderActive Set guiSliderActive
*/ */