summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md36
-rw-r--r--CMakeLists.txt21
-rw-r--r--ReiLua_API.lua41
-rw-r--r--changelog2
-rw-r--r--devnotes2
-rw-r--r--examples/pong/main.lua22
-rw-r--r--examples/resources/lib/vector2.lua2
-rw-r--r--examples/shaders/main.lua6
-rw-r--r--examples/snake/main.lua2
-rw-r--r--include/core.h2
-rw-r--r--include/lua_core.h158
-rw-r--r--include/main.h1
-rw-r--r--lib/.gitignore2
-rw-r--r--src/audio.c8
-rw-r--r--src/core.c35
-rw-r--r--src/lua_core.c10
-rw-r--r--src/models.c4
-rw-r--r--src/text.c2
-rw-r--r--src/textures.c6
19 files changed, 232 insertions, 130 deletions
diff --git a/API.md b/API.md
index d4196ff..82e0be3 100644
--- a/API.md
+++ b/API.md
@@ -2782,7 +2782,7 @@ Default projection matrix near cull distance
---
-> RL_CULL_DISTANCE_FAR = 1000.0
+> RL_CULL_DISTANCE_FAR = 1000
Default projection matrix far cull distance
@@ -4250,7 +4250,7 @@ NOTE: Set nil if no shader
---
-> isReady = RL.IsShaderValid( Shader shader )
+> isValid = RL.IsShaderValid( Shader shader )
Check if a shader is valid (loaded on GPU)
@@ -4322,6 +4322,18 @@ NOTE: Even one value should be in table
---
+> RL.SetShaderValueWithBuffer( Shader shader, int locIndex, Buffer values, int uniformType )
+
+Set shader uniform value using Buffer object
+
+---
+
+> RL.SetShaderValueVWithBuffer( Shader shader, int locIndex, Buffer values, int uniformType, int count )
+
+Set shader uniform value vector using Buffer object
+
+---
+
> RL.UnloadShader( Shader shader )
Unload shader from GPU memory (VRAM)
@@ -6134,7 +6146,7 @@ Load image from screen buffer and (screenshot)
---
-> isReady = RL.IsImageValid( Image image )
+> isValid = RL.IsImageValid( Image image )
Check if an image is valid (data and parameters)
@@ -6671,7 +6683,7 @@ Load RenderTexture from data (framebuffer)
---
-> isReady = RL.IsTextureValid( Texture texture )
+> isValid = RL.IsTextureValid( Texture texture )
Check if a texture is valid (loaded in GPU)
@@ -6685,7 +6697,7 @@ Unload texture from GPU memory (VRAM)
---
-> isReady = RL.IsRenderTextureValid( RenderTexture target )
+> isValid = RL.IsRenderTextureValid( RenderTexture target )
Check if a render texture is valid (loaded in GPU)
@@ -7021,7 +7033,7 @@ Load font copy as new userdata
---
-> isReady = RL.IsFontValid( Font font )
+> isValid = RL.IsFontValid( Font font )
Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
@@ -7578,7 +7590,7 @@ Load model from generated mesh (Default material)
---
-> isReady = RL.IsModelValid( Model model )
+> isValid = RL.IsModelValid( Model model )
Check if a model is valid (loaded in GPU, VAO/VBOs)
@@ -7993,7 +8005,7 @@ Load material from table. See material table definition
---
-> isReady = RL.IsMaterialValid( Material material )
+> isValid = RL.IsMaterialValid( Material material )
Check if a material is valid (shader assigned, map textures loaded in GPU)
@@ -8294,7 +8306,7 @@ Set master volume (listener)
---
-> isReady = RL.GetMasterVolume()
+> volume = RL.GetMasterVolume()
Get master volume (listener)
@@ -8332,7 +8344,7 @@ Load wave from memory buffer, fileType refers to extension: i.e. '.wav'
---
-> isReady = RL.IsWaveValid( Wave wave )
+> isValid = RL.IsWaveValid( Wave wave )
Checks if wave data is valid (data loaded and parameters)
@@ -8356,7 +8368,7 @@ Create a new sound that shares the same sample data as the source sound, does no
---
-> isReady = RL.IsSoundValid( Sound sound )
+> isValid = RL.IsSoundValid( Sound sound )
Checks if a sound is valid (data loaded and buffers initialized)
@@ -8506,7 +8518,7 @@ Load music stream from data
---
-> isReady = RL.IsMusicValid( Music music )
+> isValid = RL.IsMusicValid( Music music )
Checks if a music stream is valid (context and buffers initialized)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 088d3e9..09e7b10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,8 @@ set( CMAKE_C_STANDARD 99 ) # Requires C99 standard
option( SHARED "Build using dynamic libraries." off )
option( LUAJIT "Use LuaJIT." off )
option( LUA_EVENTS "Enable Lua event callbacks (RL.event)." off )
-option( DYNAMIC_SYMBOLS "Expose dynamic symbols with rdynamic." off )
+option( DYNAMIC_SYMBOLS "Expose all dynamic symbols with rdynamic." off )
+option( EXPOSE_API_SYMBOLS "Expose dynamic symbols only for get and push functions of variable types." off )
enum_option( PLATFORM "Desktop;Desktop_SDL;Web" "Platform to build for." )
@@ -61,6 +62,7 @@ else() # Desktop
target_link_libraries( ${PROJECT_NAME} raylib )
if( LUAJIT )
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLUAJIT" )
target_link_libraries( ${PROJECT_NAME} luajit )
else()
target_link_libraries( ${PROJECT_NAME} lua )
@@ -80,6 +82,10 @@ else() # Desktop
if( UNIX )
set( CMAKE_C_COMPILER "gcc" )
+ if( EXPOSE_API_SYMBOLS )
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DEXPOSE_LUA_API_SYMBOLS -rdynamic -fvisibility=hidden" )
+ endif()
+
if ( PLATFORM MATCHES "Desktop_SDL" )
include( FindPkgConfig )
pkg_search_module( SDL2 REQUIRED sdl2 )
@@ -87,29 +93,34 @@ else() # Desktop
target_link_libraries( ${PROJECT_NAME} ${SDL2_LIBRARIES} )
endif()
- if( DRM ) # For Raspberry Pi
+ if( DRM ) # 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 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 )
+ # target_link_libraries( ${PROJECT_NAME} m dl pthread )
+ target_link_libraries( ${PROJECT_NAME} m dl pthread glfw )
endif()
elseif( APPLE )
set( CMAKE_C_COMPILER "clang" )
- # TODO Linking to sdl2.
+ # //TODO Linking to sdl2.
target_link_libraries( ${PROJECT_NAME} "-framework IOKit" )
target_link_libraries( ${PROJECT_NAME} "-framework Cocoa" )
target_link_libraries( ${PROJECT_NAME} "-framework OpenGL" )
elseif( WIN32 )
+ if( EXPOSE_API_SYMBOLS )
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DEXPOSE_LUA_API_SYMBOLS" )
+ endif()
+
if ( PLATFORM MATCHES "Desktop_SDL" )
find_package( SDL2 REQUIRED )
include_directories( ${SDL2_INCLUDE_DIRS} )
target_link_libraries( ${PROJECT_NAME} ${SDL2MAIN_LIBRARIES} )
target_link_libraries( ${PROJECT_NAME} ${SDL2_LIBRARIES} )
endif()
- # Remove this to get console.
+ # Remove this to get console. //TODO Could be build option.
set( CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-mwindows" )
target_link_libraries( ${PROJECT_NAME} mingw32 opengl32 gdi32 winmm )
endif()
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index f757083..b942aba 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -944,7 +944,7 @@ RL.RL_MAX_SHADER_LOCATIONS=32
---Default projection matrix near cull distance
RL.RL_CULL_DISTANCE_NEAR=0.01
---Default projection matrix far cull distance
-RL.RL_CULL_DISTANCE_FAR=1000.0
+RL.RL_CULL_DISTANCE_FAR=1000
-- Defines - RLGL Texture parameters
@@ -1671,7 +1671,7 @@ function RL.LoadShaderFromMemory( vsCode, fsCode ) end
---Check if a shader is valid (loaded on GPU)
---- Success return bool
---@param shader any
----@return any isReady
+---@return any isValid
function RL.IsShaderValid( shader ) end
---Get shader program id
@@ -1741,6 +1741,23 @@ function RL.SetShaderValue( shader, locIndex, values, uniformType ) end
---@return any RL.SetShaderValueV
function RL.SetShaderValueV( shader, locIndex, values, uniformType, count ) end
+---Set shader uniform value using Buffer object
+---@param shader any
+---@param locIndex integer
+---@param values any
+---@param uniformType integer
+---@return any RL.SetShaderValueWithBuffer
+function RL.SetShaderValueWithBuffer( shader, locIndex, values, uniformType ) end
+
+---Set shader uniform value vector using Buffer object
+---@param shader any
+---@param locIndex integer
+---@param values any
+---@param uniformType integer
+---@param count integer
+---@return any RL.SetShaderValueVWithBuffer
+function RL.SetShaderValueVWithBuffer( shader, locIndex, values, uniformType, count ) end
+
---Unload shader from GPU memory (VRAM)
---@param shader any
---@return any RL.UnloadShader
@@ -3339,7 +3356,7 @@ function RL.LoadImageFromScreen() end
---Check if an image is valid (data and parameters)
---- Success return bool
---@param image any
----@return any isReady
+---@return any isValid
function RL.IsImageValid( image ) end
---Unload image from CPU memory (RAM)
@@ -3864,7 +3881,7 @@ function RL.LoadRenderTextureFromData( renderTextureData ) end
---Check if a texture is valid (loaded in GPU)
---- Success return bool
---@param texture any
----@return any isReady
+---@return any isValid
function RL.IsTextureValid( texture ) end
---Unload texture from GPU memory (VRAM)
@@ -3875,7 +3892,7 @@ function RL.UnloadTexture( texture ) end
---Check if a render texture is valid (loaded in GPU)
---- Success return bool
---@param target any
----@return any isReady
+---@return any isValid
function RL.IsRenderTextureValid( target ) end
---Unload render texture from GPU memory (VRAM)
@@ -4177,7 +4194,7 @@ function RL.FontCopy( font ) end
---Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
---- Success return bool
---@param font any
----@return any isReady
+---@return any isValid
function RL.IsFontValid( font ) end
---Load font data for further use. NOTE: fileData type should be unsigned char
@@ -4748,7 +4765,7 @@ function RL.LoadModelFromMesh( mesh ) end
---Check if a model is valid (loaded in GPU, VAO/VBOs)
---- Success return bool
---@param model any
----@return any isReady
+---@return any isValid
function RL.IsModelValid( model ) end
---Unload model (meshes/materials) from memory (RAM and/or VRAM)
@@ -5152,7 +5169,7 @@ function RL.CreateMaterial( materialData ) end
---Check if a material is valid (shader assigned, map textures loaded in GPU)
---- Success return bool
---@param material any
----@return any isReady
+---@return any isValid
function RL.IsMaterialValid( material ) end
---Unload material from GPU memory (VRAM). Note! Use freeAll to unload shaders and textures
@@ -5426,7 +5443,7 @@ function RL.SetMasterVolume( volume ) end
---Get master volume (listener)
---- Success return float
----@return any isReady
+---@return any volume
function RL.GetMasterVolume() end
-- Audio - Wave/Sound loading/unloading functions
@@ -5455,7 +5472,7 @@ function RL.LoadWaveFromMemory( fileType, data ) end
---Checks if wave data is valid (data loaded and parameters)
---- Success return bool
---@param wave any
----@return any isReady
+---@return any isValid
function RL.IsWaveValid( wave ) end
---Load sound from wave data
@@ -5473,7 +5490,7 @@ function RL.LoadSoundAlias( source ) end
---Checks if a sound is valid (data loaded and buffers initialized)
---- Success return bool
---@param sound any
----@return any isReady
+---@return any isValid
function RL.IsSoundValid( sound ) end
---Update sound buffer with new data
@@ -5603,7 +5620,7 @@ function RL.LoadMusicStreamFromMemory( fileType, data ) end
---Checks if a music stream is valid (context and buffers initialized)
---- Success return bool
---@param music any
----@return any isReady
+---@return any isValid
function RL.IsMusicValid( music ) end
---Unload music stream
diff --git a/changelog b/changelog
index 34d7fed..0043d99 100644
--- a/changelog
+++ b/changelog
@@ -27,6 +27,8 @@ DETAILED CHANGES:
- ADDED: InitWindow. Can be called from RL.config. If not, will be called automatically before RL.init.
(Curiously InitWindow is function #1057. Before that it was only called automatically.)
- ADDED: WindowShouldClose and custom main loop example.
+ - ADDED: EXPOSE_API_SYMBOLS.
+ - ADDED: SetShaderValueWithBuffer and SetShaderValueVWithBuffer.
------------------------------------------------------------------------
Release: ReiLua version 0.8.0 Using Raylib 5.0 and Forked Raygui 4.0
diff --git a/devnotes b/devnotes
index 49eec3d..8d4581a 100644
--- a/devnotes
+++ b/devnotes
@@ -1,5 +1,4 @@
Current {
- * Setup callback.
}
Backlog {
@@ -18,6 +17,7 @@ Backlog {
* Audio
* AudioStream.
* Models
+ * Material mapType range checks.
* Mesh bone weight management?
* CBuffer
* Swap endianess.
diff --git a/examples/pong/main.lua b/examples/pong/main.lua
index 4211d3f..8de5de9 100644
--- a/examples/pong/main.lua
+++ b/examples/pong/main.lua
@@ -1,9 +1,9 @@
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
-Vec2 = require "vector2"
+Vector2 = require "vector2"
-- Settings.
-local winSize = Vec2:new( 800, 600 )
+local winSize = Vector2:new( 800, 600 )
local monitor = 0
-- Constants.
@@ -12,19 +12,19 @@ local BALL_SPEED = 330 -- Pixels per second.
-- Game objects.
local playerLeft = {
- pos = Vec2:new( 0, 0 ),
- size = Vec2:new( 10, 70 ),
+ pos = Vector2:new( 0, 0 ),
+ size = Vector2:new( 10, 70 ),
score = 0,
}
local playerRight = {
- pos = Vec2:new( 0, 0 ),
- size = Vec2:new( 10, 70 ),
+ pos = Vector2:new( 0, 0 ),
+ size = Vector2:new( 10, 70 ),
score = 0,
}
local ball = {
- pos = Vec2:new( 0, 0 ),
+ pos = Vector2:new( 0, 0 ),
radius = 8.0,
- vel = Vec2:new( 0, 0 ),
+ vel = Vector2:new( 0, 0 ),
}
local function reset()
@@ -54,8 +54,8 @@ end
function RL.init()
-- Set window to center of monitor.
- local mPos = Vec2:newT( RL.GetMonitorPosition( monitor ) )
- local mSize = Vec2:newT( RL.GetMonitorSize( monitor ) )
+ local mPos = Vector2:newT( RL.GetMonitorPosition( monitor ) )
+ local mSize = Vector2:newT( RL.GetMonitorSize( monitor ) )
RL.SetConfigFlags( RL.FLAG_VSYNC_HINT )
RL.SetWindowSize( winSize )
@@ -125,6 +125,6 @@ function RL.draw()
-- Draw score.
RL.DrawText( tostring( playerLeft.score ), { 50, 10 }, 40, RL.WHITE )
- local rightTextSize = Vec2:newT( RL.MeasureTextEx( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) )
+ local rightTextSize = Vector2:newT( RL.MeasureTextEx( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) )
RL.DrawText( tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, RL.WHITE )
end
diff --git a/examples/resources/lib/vector2.lua b/examples/resources/lib/vector2.lua
index 6da1977..d46f2af 100644
--- a/examples/resources/lib/vector2.lua
+++ b/examples/resources/lib/vector2.lua
@@ -164,7 +164,7 @@ function Vector2:lineAngle( v2 )
end
function Vector2:atan2()
- return math.atan( self.y, self.x )
+ return math.atan2 and math.atan2( self.y, self.x ) or math.atan( self.y, self.x )
end
function Vector2:scale( scale )
diff --git a/examples/shaders/main.lua b/examples/shaders/main.lua
index e5f59ed..3ab72a2 100644
--- a/examples/shaders/main.lua
+++ b/examples/shaders/main.lua
@@ -1,7 +1,7 @@
local monitor = 0
-local shader = -1
-local texture = -1
-local textureSize
+local shader = nil
+local texture = nil
+local textureSize = nil
local GLSL_VERSION = "330" -- PLATFORM_DESKTOP
-- local GLSL_VERSION = "100" -- PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
diff --git a/examples/snake/main.lua b/examples/snake/main.lua
index f88794f..03a3918 100644
--- a/examples/snake/main.lua
+++ b/examples/snake/main.lua
@@ -114,7 +114,7 @@ local function moveSnake()
snake.heading:set( snake.control.x, snake.control.y )
snake.headPos:set( snake.headPos.x + snake.heading.x, snake.headPos.y + snake.heading.y )
- -- Check appple eating.
+ -- Check apple eating.
if snake.headPos == applePos then
snake.grow = snake.grow + 1
setApplePos()
diff --git a/include/core.h b/include/core.h
index e196446..0813268 100644
--- a/include/core.h
+++ b/include/core.h
@@ -85,6 +85,8 @@ int lcoreSetShaderValueMatrix( lua_State* L );
int lcoreSetShaderValueTexture( lua_State* L );
int lcoreSetShaderValue( lua_State* L );
int lcoreSetShaderValueV( lua_State* L );
+int lcoreSetShaderValueWithBuffer( lua_State* L );
+int lcoreSetShaderValueVWithBuffer( lua_State* L );
int lcoreUnloadShader( lua_State* L );
/* Screen-space-related functions. */
int lcoreGetScreenToWorldRay( lua_State* L );
diff --git a/include/lua_core.h b/include/lua_core.h
index b3d637c..161c39a 100644
--- a/include/lua_core.h
+++ b/include/lua_core.h
@@ -1,5 +1,27 @@
#pragma once
+// Function specifiers in case library is build/used as a shared library
+// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
+// NOTE: visibility("default") attribute makes symbols "visible" when compiled with -fvisibility=hidden
+#if defined( _WIN32 )
+ #if defined( __TINYC__ )
+ #define __declspec(x) __attribute__( (x) )
+ #endif
+ #if defined( EXPOSE_API_SYMBOLS )
+ #define REILUAPI __declspec( dllexport ) // We are building the library as a Win32 shared library (.dll)
+ #elif defined( USE_LIBTYPE_SHARED )
+ #define REILUAPI __declspec( dllimport ) // We are using the library as a Win32 shared library (.dll)
+ #endif
+#else
+ #if defined( EXPOSE_API_SYMBOLS )
+ #define REILUAPI __attribute__( ( visibility( "default" ) ) ) // We are building as a Unix shared library (.so/.dylib)
+ #endif
+#endif
+
+#ifndef REILUAPI
+ #define REILUAPI // Functions defined as 'extern' by default (implicit specifiers)
+#endif
+
enum BufferType {
BUFFER_UNSIGNED_CHAR,
BUFFER_UNSIGNED_SHORT,
@@ -35,75 +57,75 @@ void luaRegister();
void platformDefineGlobals();
void luaPlatformRegister();
/* Lua get types. */
-bool uluaGetBoolean( lua_State* L, int index );
-Color uluaGetColor( lua_State* L, int index );
-Vector2 uluaGetVector2( lua_State* L, int index );
-Vector3 uluaGetVector3( lua_State* L, int index );
-Vector4 uluaGetVector4( lua_State* L, int index );
-Rectangle uluaGetRectangle( lua_State* L, int index );
-Quaternion uluaGetQuaternion( lua_State* L, int index );
-Matrix uluaGetMatrix( lua_State* L, int index );
-BoundingBox uluaGetBoundingBox( lua_State* L, int index );
-Ray uluaGetRay( lua_State* L, int index );
-NPatchInfo uluaGetNPatchInfo( lua_State* L, int index );
-BoneInfo uluaGetBoneInfo( lua_State* L, int index );
-Transform uluaGetTransform( lua_State* L, int index );
-Buffer* uluaGetBuffer( lua_State* L, int index );
-Image* uluaGetImage( lua_State* L, int index );
-Texture* uluaGetTexture( lua_State* L, int index );
-RenderTexture* uluaGetRenderTexture( lua_State* L, int index );
-Shader* uluaGetShader( lua_State* L, int index );
-Mesh* uluaGetMesh( lua_State* L, int index );
-Camera2D* uluaGetCamera2D( lua_State* L, int index );
-Camera3D* uluaGetCamera3D( lua_State* L, int index );
-Font* uluaGetFont( lua_State* L, int index );
-GlyphInfo* uluaGetGlyphInfo( lua_State* L, int index );
-Wave* uluaGetWave( lua_State* L, int index );
-Sound* uluaGetSound( lua_State* L, int index );
-Music* uluaGetMusic( lua_State* L, int index );
-Light* uluaGetLight( lua_State* L, int index );
-Material* uluaGetMaterial( lua_State* L, int index );
-Model* uluaGetModel( lua_State* L, int index );
-ModelAnimation* uluaGetModelAnimation( lua_State* L, int index );
-rlRenderBatch* uluaGetRLRenderBatch( lua_State* L, int index );
-AutomationEvent* uluaGetAutomationEvent( lua_State* L, int index );
-AutomationEventList* uluaGetAutomationEventList( lua_State* L, int index );
+REILUAPI bool uluaGetBoolean( lua_State* L, int index );
+REILUAPI Color uluaGetColor( lua_State* L, int index );
+REILUAPI Vector2 uluaGetVector2( lua_State* L, int index );
+REILUAPI Vector3 uluaGetVector3( lua_State* L, int index );
+REILUAPI Vector4 uluaGetVector4( lua_State* L, int index );
+REILUAPI Rectangle uluaGetRectangle( lua_State* L, int index );
+REILUAPI Quaternion uluaGetQuaternion( lua_State* L, int index );
+REILUAPI Matrix uluaGetMatrix( lua_State* L, int index );
+REILUAPI BoundingBox uluaGetBoundingBox( lua_State* L, int index );
+REILUAPI Ray uluaGetRay( lua_State* L, int index );
+REILUAPI NPatchInfo uluaGetNPatchInfo( lua_State* L, int index );
+REILUAPI BoneInfo uluaGetBoneInfo( lua_State* L, int index );
+REILUAPI Transform uluaGetTransform( lua_State* L, int index );
+REILUAPI Buffer* uluaGetBuffer( lua_State* L, int index );
+REILUAPI Image* uluaGetImage( lua_State* L, int index );
+REILUAPI Texture* uluaGetTexture( lua_State* L, int index );
+REILUAPI RenderTexture* uluaGetRenderTexture( lua_State* L, int index );
+REILUAPI Shader* uluaGetShader( lua_State* L, int index );
+REILUAPI Mesh* uluaGetMesh( lua_State* L, int index );
+REILUAPI Camera2D* uluaGetCamera2D( lua_State* L, int index );
+REILUAPI Camera3D* uluaGetCamera3D( lua_State* L, int index );
+REILUAPI Font* uluaGetFont( lua_State* L, int index );
+REILUAPI GlyphInfo* uluaGetGlyphInfo( lua_State* L, int index );
+REILUAPI Wave* uluaGetWave( lua_State* L, int index );
+REILUAPI Sound* uluaGetSound( lua_State* L, int index );
+REILUAPI Music* uluaGetMusic( lua_State* L, int index );
+REILUAPI Light* uluaGetLight( lua_State* L, int index );
+REILUAPI Material* uluaGetMaterial( lua_State* L, int index );
+REILUAPI Model* uluaGetModel( lua_State* L, int index );
+REILUAPI ModelAnimation* uluaGetModelAnimation( lua_State* L, int index );
+REILUAPI rlRenderBatch* uluaGetRLRenderBatch( lua_State* L, int index );
+REILUAPI AutomationEvent* uluaGetAutomationEvent( lua_State* L, int index );
+REILUAPI AutomationEventList* uluaGetAutomationEventList( lua_State* L, int index );
-void getVector2Array( lua_State* L, int index, Vector2 points[] );
+REILUAPI void getVector2Array( lua_State* L, int index, Vector2 points[] );
/* Lua push types. */
-void uluaPushColor( lua_State* L, Color color );
-void uluaPushVector2( lua_State* L, Vector2 vector );
-void uluaPushVector3( lua_State* L, Vector3 vector );
-void uluaPushVector4( lua_State* L, Vector4 vector );
-void uluaPushRectangle( lua_State* L, Rectangle rect );
-void uluaPushQuaternion( lua_State* L, Quaternion quaternion );
-void uluaPushMatrix( lua_State* L, Matrix matrix );
-void uluaPushRay( lua_State* L, Ray ray );
-void uluaPushRayCollision( lua_State* L, RayCollision rayCol );
-void uluaPushBoundingBox( lua_State* L, BoundingBox box );
-void uluaPushBoneInfo( lua_State* L, BoneInfo boneInfo );
-void uluaPushTransform( lua_State* L, Transform transform );
+REILUAPI void uluaPushColor( lua_State* L, Color color );
+REILUAPI void uluaPushVector2( lua_State* L, Vector2 vector );
+REILUAPI void uluaPushVector3( lua_State* L, Vector3 vector );
+REILUAPI void uluaPushVector4( lua_State* L, Vector4 vector );
+REILUAPI void uluaPushRectangle( lua_State* L, Rectangle rect );
+REILUAPI void uluaPushQuaternion( lua_State* L, Quaternion quaternion );
+REILUAPI void uluaPushMatrix( lua_State* L, Matrix matrix );
+REILUAPI void uluaPushRay( lua_State* L, Ray ray );
+REILUAPI void uluaPushRayCollision( lua_State* L, RayCollision rayCol );
+REILUAPI void uluaPushBoundingBox( lua_State* L, BoundingBox box );
+REILUAPI void uluaPushBoneInfo( lua_State* L, BoneInfo boneInfo );
+REILUAPI void uluaPushTransform( lua_State* L, Transform transform );
// void uluaPushAutomationEvent( lua_State* L, AutomationEvent event );
-void uluaPushBuffer( lua_State* L, Buffer buffer );
-void uluaPushImage( lua_State* L, Image image );
-void uluaPushTexture( lua_State* L, Texture texture );
-void uluaPushRenderTexture( lua_State* L, RenderTexture renderTexture );
-void uluaPushCamera2D( lua_State* L, Camera2D camera );
-void uluaPushCamera3D( lua_State* L, Camera3D camera );
-void uluaPushShader( lua_State* L, Shader shader );
-void uluaPushFont( lua_State* L, Font font );
-void uluaPushGlyphInfo( lua_State* L, GlyphInfo glyph );
-void uluaPushWave( lua_State* L, Wave wave );
-void uluaPushSound( lua_State* L, Sound sound );
-void uluaPushMusic( lua_State* L, Music music );
-void uluaPushLight( lua_State* L, Light light );
-void uluaPushMaterial( lua_State* L, Material material );
-void uluaPushMesh( lua_State* L, Mesh mesh );
-void uluaPushModel( lua_State* L, Model model );
-void uluaPushModelAnimation( lua_State* L, ModelAnimation modelAnimation );
-void uluaPushRLRenderBatch( lua_State* L, rlRenderBatch renderBatch );
-void uluaPushAutomationEvent( lua_State* L, AutomationEvent event );
-void uluaPushAutomationEventList( lua_State* L, AutomationEventList eventList );
+REILUAPI void uluaPushBuffer( lua_State* L, Buffer buffer );
+REILUAPI void uluaPushImage( lua_State* L, Image image );
+REILUAPI void uluaPushTexture( lua_State* L, Texture texture );
+REILUAPI void uluaPushRenderTexture( lua_State* L, RenderTexture renderTexture );
+REILUAPI void uluaPushCamera2D( lua_State* L, Camera2D camera );
+REILUAPI void uluaPushCamera3D( lua_State* L, Camera3D camera );
+REILUAPI void uluaPushShader( lua_State* L, Shader shader );
+REILUAPI void uluaPushFont( lua_State* L, Font font );
+REILUAPI void uluaPushGlyphInfo( lua_State* L, GlyphInfo glyph );
+REILUAPI void uluaPushWave( lua_State* L, Wave wave );
+REILUAPI void uluaPushSound( lua_State* L, Sound sound );
+REILUAPI void uluaPushMusic( lua_State* L, Music music );
+REILUAPI void uluaPushLight( lua_State* L, Light light );
+REILUAPI void uluaPushMaterial( lua_State* L, Material material );
+REILUAPI void uluaPushMesh( lua_State* L, Mesh mesh );
+REILUAPI void uluaPushModel( lua_State* L, Model model );
+REILUAPI void uluaPushModelAnimation( lua_State* L, ModelAnimation modelAnimation );
+REILUAPI void uluaPushRLRenderBatch( lua_State* L, rlRenderBatch renderBatch );
+REILUAPI void uluaPushAutomationEvent( lua_State* L, AutomationEvent event );
+REILUAPI void uluaPushAutomationEventList( lua_State* L, AutomationEventList eventList );
/* Utils. */
-int uluaGetTableLen( lua_State* L, int index );
-bool uluaIsNil( lua_State* L, int index );
+REILUAPI int uluaGetTableLen( lua_State* L, int index );
+REILUAPI bool uluaIsNil( lua_State* L, int index );
diff --git a/include/main.h b/include/main.h
index 55344a5..6fcda26 100644
--- a/include/main.h
+++ b/include/main.h
@@ -37,7 +37,6 @@
#include "rcamera.h"
#endif
-
#ifdef LUAJIT
#ifdef SHARED
#include <lua.h>
diff --git a/lib/.gitignore b/lib/.gitignore
index 7c5d27d..876de49 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -1,3 +1,5 @@
libraylib.a
liblua.a
libluajit.a
+liblua.so
+libluajit.so
diff --git a/src/audio.c b/src/audio.c
index 8ef7e2d..dee3744 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -56,7 +56,7 @@ int laudioSetMasterVolume( lua_State* L ) {
}
/*
-> isReady = RL.GetMasterVolume()
+> volume = RL.GetMasterVolume()
Get master volume (listener)
@@ -129,7 +129,7 @@ int laudioLoadWaveFromMemory( lua_State* L ) {
}
/*
-> isReady = RL.IsWaveValid( Wave wave )
+> isValid = RL.IsWaveValid( Wave wave )
Checks if wave data is valid (data loaded and parameters)
@@ -174,7 +174,7 @@ int laudioLoadSoundAlias( lua_State* L ) {
}
/*
-> isReady = RL.IsSoundValid( Sound sound )
+> isValid = RL.IsSoundValid( Sound sound )
Checks if a sound is valid (data loaded and buffers initialized)
@@ -497,7 +497,7 @@ int laudioLoadMusicStreamFromMemory( lua_State* L ) {
}
/*
-> isReady = RL.IsMusicValid( Music music )
+> isValid = RL.IsMusicValid( Music music )
Checks if a music stream is valid (context and buffers initialized)
diff --git a/src/core.c b/src/core.c
index c5736da..093c07b 100644
--- a/src/core.c
+++ b/src/core.c
@@ -932,7 +932,7 @@ int lcoreLoadShaderFromMemory( lua_State* L ) {
}
/*
-> isReady = RL.IsShaderValid( Shader shader )
+> isValid = RL.IsShaderValid( Shader shader )
Check if a shader is valid (loaded on GPU)
@@ -1138,6 +1138,39 @@ int lcoreSetShaderValueV( lua_State* L ) {
}
/*
+> RL.SetShaderValueWithBuffer( Shader shader, int locIndex, Buffer values, int uniformType )
+
+Set shader uniform value using Buffer object
+*/
+int lcoreSetShaderValueWithBuffer( lua_State* L ) {
+ Shader* shader = uluaGetShader( L, 1 );
+ int locIndex = luaL_checkinteger( L, 2 );
+ Buffer* value = uluaGetBuffer( L, 3 );
+ int uniformType = luaL_checkinteger( L, 4 );
+
+ SetShaderValue( *shader, locIndex, value->data, uniformType );
+
+ return 0;
+}
+
+/*
+> RL.SetShaderValueVWithBuffer( Shader shader, int locIndex, Buffer values, int uniformType, int count )
+
+Set shader uniform value vector using Buffer object
+*/
+int lcoreSetShaderValueVWithBuffer( lua_State* L ) {
+ Shader* shader = uluaGetShader( L, 1 );
+ int locIndex = luaL_checkinteger( L, 2 );
+ Buffer* value = uluaGetBuffer( L, 3 );
+ int uniformType = luaL_checkinteger( L, 4 );
+ int count = luaL_checkinteger( L, 5 );
+
+ SetShaderValueV( *shader, locIndex, value->data, uniformType, count );
+
+ return 0;
+}
+
+/*
> RL.UnloadShader( Shader shader )
Unload shader from GPU memory (VRAM)
diff --git a/src/lua_core.c b/src/lua_core.c
index aea751a..d37f9f1 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -1374,6 +1374,8 @@ void luaRegister() {
assingGlobalFunction( "SetShaderValueTexture", lcoreSetShaderValueTexture );
assingGlobalFunction( "SetShaderValue", lcoreSetShaderValue );
assingGlobalFunction( "SetShaderValueV", lcoreSetShaderValueV );
+ assingGlobalFunction( "SetShaderValueWithBuffer", lcoreSetShaderValueWithBuffer );
+ assingGlobalFunction( "SetShaderValueVWithBuffer", lcoreSetShaderValueVWithBuffer );
assingGlobalFunction( "UnloadShader", lcoreUnloadShader );
/* Screen-space-related functions. */
assingGlobalFunction( "GetScreenToWorldRay", lcoreGetScreenToWorldRay );
@@ -2962,9 +2964,9 @@ BoneInfo uluaGetBoneInfo( lua_State* L, int index ) {
bone.parent = lua_tointeger( L, -1 );
}
}
- i++;
- lua_pop( L, 1 );
}
+ i++;
+ lua_pop( L, 1 );
}
return bone;
}
@@ -3005,9 +3007,9 @@ Transform uluaGetTransform( lua_State* L, int index ) {
transform.scale = uluaGetVector3( L, lua_gettop( L ) );
}
}
- i++;
- lua_pop( L, 1 );
}
+ i++;
+ lua_pop( L, 1 );
}
return transform;
}
diff --git a/src/models.c b/src/models.c
index 1ede774..45bb825 100644
--- a/src/models.c
+++ b/src/models.c
@@ -492,7 +492,7 @@ int lmodelsLoadModelFromMesh( lua_State* L ) {
}
/*
-> isReady = RL.IsModelValid( Model model )
+> isValid = RL.IsModelValid( Model model )
Check if a model is valid (loaded in GPU, VAO/VBOs)
@@ -1889,7 +1889,7 @@ int lmodelsCreateMaterial( lua_State* L ) {
}
/*
-> isReady = RL.IsMaterialValid( Material material )
+> isValid = RL.IsMaterialValid( Material material )
Check if a material is valid (shader assigned, map textures loaded in GPU)
diff --git a/src/text.c b/src/text.c
index 2740bed..ad2cbc4 100644
--- a/src/text.c
+++ b/src/text.c
@@ -295,7 +295,7 @@ int ltextFontCopy( lua_State* L ) {
}
/*
-> isReady = RL.IsFontValid( Font font )
+> isValid = RL.IsFontValid( Font font )
Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
diff --git a/src/textures.c b/src/textures.c
index eaf2284..e185470 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -167,7 +167,7 @@ int ltexturesLoadImageFromScreen( lua_State* L ) {
}
/*
-> isReady = RL.IsImageValid( Image image )
+> isValid = RL.IsImageValid( Image image )
Check if an image is valid (data and parameters)
@@ -1422,7 +1422,7 @@ int ltexturesLoadRenderTextureFromData( lua_State* L ) {
}
/*
-> isReady = RL.IsTextureValid( Texture texture )
+> isValid = RL.IsTextureValid( Texture texture )
Check if a texture is valid (loaded in GPU)
@@ -1451,7 +1451,7 @@ int ltextureUnloadTexture( lua_State* L ) {
}
/*
-> isReady = RL.IsRenderTextureValid( RenderTexture target )
+> isValid = RL.IsRenderTextureValid( RenderTexture target )
Check if a render texture is valid (loaded in GPU)