rlgl Some Render batch management functions and Matrix operations functions.
This commit is contained in:
123
API.md
123
API.md
@@ -6833,6 +6833,101 @@ Get light enabled
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## RLGL - Matrix operations
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlMatrixMode( int mode )
|
||||||
|
|
||||||
|
Choose the current matrix to be transformed
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> RL.rlPushMatrix()
|
||||||
|
|
||||||
|
Push the current matrix to stack
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> RL.rlPopMatrix()
|
||||||
|
|
||||||
|
Pop latest inserted matrix from stack
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> RL.rlLoadIdentity()
|
||||||
|
|
||||||
|
Reset current matrix to identity matrix
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlTranslatef( Vector3 translation )
|
||||||
|
|
||||||
|
Multiply the current matrix by a translation matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlRotatef( float angle, Vector3 rotation )
|
||||||
|
|
||||||
|
Multiply the current matrix by a rotation matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlScalef( Vector3 scale )
|
||||||
|
|
||||||
|
Multiply the current matrix by a scaling matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlMultMatrixf( Matrix matrix )
|
||||||
|
|
||||||
|
Multiply the current matrix by another matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlFrustum( float left, float right, float bottom, float top, float znear, float zfar )
|
||||||
|
|
||||||
|
Multiply the current matrix by a perspective matrix generated by parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlOrtho( float left, float right, float bottom, float top, float znear, float zfar )
|
||||||
|
|
||||||
|
Multiply the current matrix by an orthographic matrix generated by parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlViewport( Rectangle viewport )
|
||||||
|
|
||||||
|
Set the viewport area ( transformation from normalized device coordinates to window coordinates )
|
||||||
|
NOTE: We store current viewport dimensions
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## RLGL - Textures state
|
## RLGL - Textures state
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -7024,6 +7119,34 @@ Get current OpenGL version
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## RLGL - Render batch management
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> RL.rlDrawRenderBatchActive()
|
||||||
|
|
||||||
|
Update and draw internal render batch
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> overflow = RL.rlCheckRenderBatchLimit( int vCount )
|
||||||
|
|
||||||
|
Check internal buffer overflow for a given number of vertex and force a rlRenderBatch draw call if required
|
||||||
|
|
||||||
|
- Failure return nil
|
||||||
|
- Success return bool
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.rlSetTexture( int id )
|
||||||
|
|
||||||
|
Set current texture for render batch and check buffers limits
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## RLGL - Textures management
|
## RLGL - Textures management
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
102
ReiLua_API.lua
102
ReiLua_API.lua
@@ -5549,6 +5549,88 @@ function RL.GetLightColor( light ) end
|
|||||||
---@return any enabled
|
---@return any enabled
|
||||||
function RL.IsLightEnabled( light ) end
|
function RL.IsLightEnabled( light ) end
|
||||||
|
|
||||||
|
-- RLGL - Matrix operations
|
||||||
|
|
||||||
|
---Choose the current matrix to be transformed
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param mode integer
|
||||||
|
---@return any success
|
||||||
|
function RL.rlMatrixMode( mode ) end
|
||||||
|
|
||||||
|
---Push the current matrix to stack
|
||||||
|
---@return any RL.rlPushMatrix
|
||||||
|
function RL.rlPushMatrix() end
|
||||||
|
|
||||||
|
---Pop latest inserted matrix from stack
|
||||||
|
---@return any RL.rlPopMatrix
|
||||||
|
function RL.rlPopMatrix() end
|
||||||
|
|
||||||
|
---Reset current matrix to identity matrix
|
||||||
|
---@return any RL.rlLoadIdentity
|
||||||
|
function RL.rlLoadIdentity() end
|
||||||
|
|
||||||
|
---Multiply the current matrix by a translation matrix
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param translation table
|
||||||
|
---@return any success
|
||||||
|
function RL.rlTranslatef( translation ) end
|
||||||
|
|
||||||
|
---Multiply the current matrix by a rotation matrix
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param angle number
|
||||||
|
---@param rotation table
|
||||||
|
---@return any success
|
||||||
|
function RL.rlRotatef( angle, rotation ) end
|
||||||
|
|
||||||
|
---Multiply the current matrix by a scaling matrix
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param scale table
|
||||||
|
---@return any success
|
||||||
|
function RL.rlScalef( scale ) end
|
||||||
|
|
||||||
|
---Multiply the current matrix by another matrix
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param matrix table
|
||||||
|
---@return any success
|
||||||
|
function RL.rlMultMatrixf( matrix ) end
|
||||||
|
|
||||||
|
---Multiply the current matrix by a perspective matrix generated by parameters
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param left number
|
||||||
|
---@param right number
|
||||||
|
---@param bottom number
|
||||||
|
---@param top number
|
||||||
|
---@param znear number
|
||||||
|
---@param zfar number
|
||||||
|
---@return any success
|
||||||
|
function RL.rlFrustum( left, right, bottom, top, znear, zfar ) end
|
||||||
|
|
||||||
|
---Multiply the current matrix by an orthographic matrix generated by parameters
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param left number
|
||||||
|
---@param right number
|
||||||
|
---@param bottom number
|
||||||
|
---@param top number
|
||||||
|
---@param znear number
|
||||||
|
---@param zfar number
|
||||||
|
---@return any success
|
||||||
|
function RL.rlOrtho( left, right, bottom, top, znear, zfar ) end
|
||||||
|
|
||||||
|
---Set the viewport area ( transformation from normalized device coordinates to window coordinates )
|
||||||
|
---NOTE: We store current viewport dimensions
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param viewport table
|
||||||
|
---@return any success
|
||||||
|
function RL.rlViewport( viewport ) end
|
||||||
|
|
||||||
-- RLGL - Textures state
|
-- RLGL - Textures state
|
||||||
|
|
||||||
---Select and active a texture slot
|
---Select and active a texture slot
|
||||||
@@ -5686,6 +5768,26 @@ function RL.rlDisableSmoothLines() end
|
|||||||
---@return any version
|
---@return any version
|
||||||
function RL.rlGetVersion() end
|
function RL.rlGetVersion() end
|
||||||
|
|
||||||
|
-- RLGL - Render batch management
|
||||||
|
|
||||||
|
---Update and draw internal render batch
|
||||||
|
---@return any RL.rlDrawRenderBatchActive
|
||||||
|
function RL.rlDrawRenderBatchActive() end
|
||||||
|
|
||||||
|
---Check internal buffer overflow for a given number of vertex and force a rlRenderBatch draw call if required
|
||||||
|
---- Failure return nil
|
||||||
|
---- Success return bool
|
||||||
|
---@param vCount integer
|
||||||
|
---@return any overflow
|
||||||
|
function RL.rlCheckRenderBatchLimit( vCount ) end
|
||||||
|
|
||||||
|
---Set current texture for render batch and check buffers limits
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param id integer
|
||||||
|
---@return any success
|
||||||
|
function RL.rlSetTexture( id ) end
|
||||||
|
|
||||||
-- RLGL - Textures management
|
-- RLGL - Textures management
|
||||||
|
|
||||||
---Load texture in GPU
|
---Load texture in GPU
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ KEY CHANGES:
|
|||||||
- ADDED: rlgl Textures management functions
|
- ADDED: rlgl Textures management functions
|
||||||
- ADDED: Texture and RenderTexture can be given as tables
|
- ADDED: Texture and RenderTexture can be given as tables
|
||||||
- ADDED: Camera2D and Camera3D can be given as tables
|
- ADDED: Camera2D and Camera3D can be given as tables
|
||||||
|
- ADDED: Camera2D and Camera3D can be given as tables
|
||||||
|
- ADDED: rlgl New defines
|
||||||
|
- ADDED: rlgl Textures state functions
|
||||||
|
- ADDED: rlgl Some Render batch management functions
|
||||||
|
- ADDED: rlgl Matrix operations functions
|
||||||
|
|
||||||
Detailed changes:
|
Detailed changes:
|
||||||
- FIXED: uluaGetRay was looking for integers instead of tables
|
- FIXED: uluaGetRay was looking for integers instead of tables
|
||||||
@@ -81,8 +86,6 @@ Detailed changes:
|
|||||||
- ADDED: GetMaterialTexture, GetMaterialColor, GetMaterialValue and GetMaterialShader
|
- ADDED: GetMaterialTexture, GetMaterialColor, GetMaterialValue and GetMaterialShader
|
||||||
- ADDED: SetMaterialParams and GetMaterialParams
|
- ADDED: SetMaterialParams and GetMaterialParams
|
||||||
- ADDED: GetTextureId
|
- ADDED: GetTextureId
|
||||||
- ADDED: RLGL defines
|
|
||||||
- ADDED: RLGL Textures state functions
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Release: ReiLua version 0.4.0 Using Raylib 4.2
|
Release: ReiLua version 0.4.0 Using Raylib 4.2
|
||||||
|
|||||||
9
devnotes
9
devnotes
@@ -1,4 +1,11 @@
|
|||||||
Current {
|
Current {
|
||||||
|
* rlgl
|
||||||
|
* Vertex level operations.
|
||||||
|
* Vertex buffers state.
|
||||||
|
* Vertex buffers management
|
||||||
|
* Shaders management
|
||||||
|
* Matrix state management
|
||||||
|
* Compute shader management
|
||||||
* New type validators.
|
* New type validators.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,8 +17,6 @@ Backlog {
|
|||||||
* Text
|
* Text
|
||||||
* Ability to set font texture filtering.
|
* Ability to set font texture filtering.
|
||||||
* Codepoints?
|
* Codepoints?
|
||||||
* rlgl
|
|
||||||
* More low level functions. Could be usefull now when for example DrawTexturePoly is removed.
|
|
||||||
* Audio
|
* Audio
|
||||||
* AudioStream.
|
* AudioStream.
|
||||||
* Core.
|
* Core.
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/* Matrix operations */
|
||||||
|
int lrlglMatrixMode( lua_State *L );
|
||||||
|
int lrlglPushMatrix( lua_State *L );
|
||||||
|
int lrlglPopMatrix( lua_State *L );
|
||||||
|
int lrlglLoadIdentity( lua_State *L );
|
||||||
|
int lrlglTranslatef( lua_State *L );
|
||||||
|
int lrlglRotatef( lua_State *L );
|
||||||
|
int lrlglScalef( lua_State *L );
|
||||||
|
int lrlglMultMatrixf( lua_State *L );
|
||||||
|
int lrlglFrustum( lua_State *L );
|
||||||
|
int lrlglOrtho( lua_State *L );
|
||||||
|
int lrlglViewport( lua_State *L );
|
||||||
/* Textures state */
|
/* Textures state */
|
||||||
int lrlglActiveTextureSlot( lua_State *L );
|
int lrlglActiveTextureSlot( lua_State *L );
|
||||||
int lrlglEnableTexture( lua_State *L );
|
int lrlglEnableTexture( lua_State *L );
|
||||||
@@ -28,6 +40,10 @@ int lrlglEnableSmoothLines( lua_State *L );
|
|||||||
int lrlglDisableSmoothLines( lua_State *L );
|
int lrlglDisableSmoothLines( lua_State *L );
|
||||||
/* Initialization functions */
|
/* Initialization functions */
|
||||||
int lrlglGetVersion( lua_State *L );
|
int lrlglGetVersion( lua_State *L );
|
||||||
|
/* Render batch management */
|
||||||
|
int lrlglDrawRenderBatchActive( lua_State *L );
|
||||||
|
int lrlglCheckRenderBatchLimit( lua_State *L );
|
||||||
|
int lrlglSetTexture( lua_State *L );
|
||||||
/* Textures management */
|
/* Textures management */
|
||||||
int lrlglLoadTexture( lua_State *L );
|
int lrlglLoadTexture( lua_State *L );
|
||||||
int lrlglLoadTextureDepth( lua_State *L );
|
int lrlglLoadTextureDepth( lua_State *L );
|
||||||
|
|||||||
@@ -1475,6 +1475,18 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "IsLightEnabled", llightsIsLightEnabled );
|
assingGlobalFunction( "IsLightEnabled", llightsIsLightEnabled );
|
||||||
|
|
||||||
/* RLGL */
|
/* RLGL */
|
||||||
|
/* Matrix operations */
|
||||||
|
assingGlobalFunction( "rlMatrixMode", lrlglMatrixMode );
|
||||||
|
assingGlobalFunction( "rlPushMatrix", lrlglPushMatrix );
|
||||||
|
assingGlobalFunction( "rlPopMatrix", lrlglPopMatrix );
|
||||||
|
assingGlobalFunction( "rlLoadIdentity", lrlglLoadIdentity );
|
||||||
|
assingGlobalFunction( "rlTranslatef", lrlglTranslatef );
|
||||||
|
assingGlobalFunction( "rlRotatef", lrlglRotatef );
|
||||||
|
assingGlobalFunction( "rlScalef", lrlglScalef );
|
||||||
|
assingGlobalFunction( "rlMultMatrixf", lrlglMultMatrixf );
|
||||||
|
assingGlobalFunction( "rlFrustum", lrlglFrustum );
|
||||||
|
assingGlobalFunction( "rlOrtho", lrlglOrtho );
|
||||||
|
assingGlobalFunction( "rlViewport", lrlglViewport );
|
||||||
/* Textures state */
|
/* Textures state */
|
||||||
assingGlobalFunction( "rlActiveTextureSlot", lrlglActiveTextureSlot );
|
assingGlobalFunction( "rlActiveTextureSlot", lrlglActiveTextureSlot );
|
||||||
assingGlobalFunction( "rlEnableTexture", lrlglEnableTexture );
|
assingGlobalFunction( "rlEnableTexture", lrlglEnableTexture );
|
||||||
@@ -1503,6 +1515,10 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "rlDisableSmoothLines", lrlglDisableSmoothLines );
|
assingGlobalFunction( "rlDisableSmoothLines", lrlglDisableSmoothLines );
|
||||||
/* Initialization functions. */
|
/* Initialization functions. */
|
||||||
assingGlobalFunction( "rlGetVersion", lrlglGetVersion );
|
assingGlobalFunction( "rlGetVersion", lrlglGetVersion );
|
||||||
|
/* Render batch management. */
|
||||||
|
assingGlobalFunction( "rlDrawRenderBatchActive", lrlglDrawRenderBatchActive );
|
||||||
|
assingGlobalFunction( "rlCheckRenderBatchLimit", lrlglCheckRenderBatchLimit );
|
||||||
|
assingGlobalFunction( "rlSetTexture", lrlglSetTexture );
|
||||||
/* Textures management */
|
/* Textures management */
|
||||||
assingGlobalFunction( "rlLoadTexture", lrlglLoadTexture );
|
assingGlobalFunction( "rlLoadTexture", lrlglLoadTexture );
|
||||||
assingGlobalFunction( "rlLoadTextureDepth", lrlglLoadTextureDepth );
|
assingGlobalFunction( "rlLoadTextureDepth", lrlglLoadTextureDepth );
|
||||||
|
|||||||
284
src/rlgl.c
284
src/rlgl.c
@@ -3,6 +3,236 @@
|
|||||||
#include "lua_core.h"
|
#include "lua_core.h"
|
||||||
#include "lrlgl.h"
|
#include "lrlgl.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
## RLGL - Matrix operations
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlMatrixMode( int mode )
|
||||||
|
|
||||||
|
Choose the current matrix to be transformed
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lrlglMatrixMode( lua_State *L ) {
|
||||||
|
if ( !lua_isnumber( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlMatrixMode( int mode )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
rlMatrixMode( lua_tointeger( L, 1 ) );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> RL.rlPushMatrix()
|
||||||
|
|
||||||
|
Push the current matrix to stack
|
||||||
|
*/
|
||||||
|
int lrlglPushMatrix( lua_State *L ) {
|
||||||
|
rlPushMatrix();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> RL.rlPopMatrix()
|
||||||
|
|
||||||
|
Pop latest inserted matrix from stack
|
||||||
|
*/
|
||||||
|
int lrlglPopMatrix( lua_State *L ) {
|
||||||
|
rlPopMatrix();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> RL.rlLoadIdentity()
|
||||||
|
|
||||||
|
Reset current matrix to identity matrix
|
||||||
|
*/
|
||||||
|
int lrlglLoadIdentity( lua_State *L ) {
|
||||||
|
rlLoadIdentity();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlTranslatef( Vector3 translation )
|
||||||
|
|
||||||
|
Multiply the current matrix by a translation matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lrlglTranslatef( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlTranslatef( Vector3 translation )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Vector3 translation = uluaGetVector3Index( L, 1 );
|
||||||
|
|
||||||
|
rlTranslatef( translation.x, translation.y, translation.z );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlRotatef( float angle, Vector3 rotation )
|
||||||
|
|
||||||
|
Multiply the current matrix by a rotation matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
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 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
float angle = lua_tonumber( L, 1 );
|
||||||
|
Vector3 rotation = uluaGetVector3Index( L, 2 );
|
||||||
|
|
||||||
|
rlRotatef( angle, rotation.x, rotation.y, rotation.z );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlScalef( Vector3 scale )
|
||||||
|
|
||||||
|
Multiply the current matrix by a scaling matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lrlglScalef( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlScalef( Vector3 scale )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Vector3 scale = uluaGetVector3Index( L, 1 );
|
||||||
|
|
||||||
|
rlScalef( scale.x, scale.y, scale.z );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlMultMatrixf( Matrix matrix )
|
||||||
|
|
||||||
|
Multiply the current matrix by another matrix
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lrlglMultMatrixf( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlMultMatrixf( Matrix matrix )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Matrix matrix = uluaGetMatrixIndex( L, 1 );
|
||||||
|
float matf[16] = {
|
||||||
|
matrix.m0, matrix.m4, matrix.m8, matrix.m12,
|
||||||
|
matrix.m1, matrix.m5, matrix.m9, matrix.m13,
|
||||||
|
matrix.m2, matrix.m6, matrix.m10, matrix.m14,
|
||||||
|
matrix.m3, matrix.m7, matrix.m11, matrix.m15
|
||||||
|
};
|
||||||
|
rlMultMatrixf( matf );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlFrustum( float left, float right, float bottom, float top, float znear, float zfar )
|
||||||
|
|
||||||
|
Multiply the current matrix by a perspective matrix generated by parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
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 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
double left = lua_tonumber( L, 1 );
|
||||||
|
double right = lua_tonumber( L, 2 );
|
||||||
|
double bottom = lua_tonumber( L, 3 );
|
||||||
|
double top = lua_tonumber( L, 4 );
|
||||||
|
double znear = lua_tonumber( L, 5 );
|
||||||
|
double zfar = lua_tonumber( L, 6 );
|
||||||
|
|
||||||
|
rlFrustum( left, right, bottom, top, znear, zfar );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlOrtho( float left, float right, float bottom, float top, float znear, float zfar )
|
||||||
|
|
||||||
|
Multiply the current matrix by an orthographic matrix generated by parameters
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
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 )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
double left = lua_tonumber( L, 1 );
|
||||||
|
double right = lua_tonumber( L, 2 );
|
||||||
|
double bottom = lua_tonumber( L, 3 );
|
||||||
|
double top = lua_tonumber( L, 4 );
|
||||||
|
double znear = lua_tonumber( L, 5 );
|
||||||
|
double zfar = lua_tonumber( L, 6 );
|
||||||
|
|
||||||
|
rlOrtho( left, right, bottom, top, znear, zfar );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlViewport( Rectangle viewport )
|
||||||
|
|
||||||
|
Set the viewport area ( transformation from normalized device coordinates to window coordinates )
|
||||||
|
NOTE: We store current viewport dimensions
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lrlglViewport( lua_State *L ) {
|
||||||
|
if ( !lua_istable( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlViewport( Rectangle viewport )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||||
|
|
||||||
|
rlViewport( rect.x, rect.y, rect.width, rect.height );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
## RLGL - Textures state
|
## RLGL - Textures state
|
||||||
*/
|
*/
|
||||||
@@ -376,6 +606,60 @@ int lrlglGetVersion( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
## RLGL - Render batch management
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
> RL.rlDrawRenderBatchActive()
|
||||||
|
|
||||||
|
Update and draw internal render batch
|
||||||
|
*/
|
||||||
|
int lrlglDrawRenderBatchActive( lua_State *L ) {
|
||||||
|
rlDrawRenderBatchActive();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> overflow = RL.rlCheckRenderBatchLimit( int vCount )
|
||||||
|
|
||||||
|
Check internal buffer overflow for a given number of vertex and force a rlRenderBatch draw call if required
|
||||||
|
|
||||||
|
- Failure return nil
|
||||||
|
- Success return bool
|
||||||
|
*/
|
||||||
|
int lrlglCheckRenderBatchLimit( lua_State *L ) {
|
||||||
|
if ( !lua_isnumber( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlCheckRenderBatchLimit( int vCount )" );
|
||||||
|
lua_pushnil( L );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
lua_pushboolean( L, rlCheckRenderBatchLimit( lua_tointeger( L, 1 ) ) );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.rlSetTexture( int id )
|
||||||
|
|
||||||
|
Set current texture for render batch and check buffers limits
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lrlglSetTexture( lua_State *L ) {
|
||||||
|
if ( !lua_isnumber( L, 1 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetTexture( int id )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
rlSetTexture( lua_tointeger( L, 1 ) );
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
## RLGL - Textures management
|
## RLGL - Textures management
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user