Userdata objects can be referenced with lightuserdata.
This commit is contained in:
10
API.md
10
API.md
@@ -3090,7 +3090,7 @@ Load image from file into CPU memory (RAM)
|
||||
|
||||
---
|
||||
|
||||
> image = RL.LoadImageFromTexture( Texture2D texture )
|
||||
> image = RL.LoadImageFromTexture( Texture texture )
|
||||
|
||||
Load image from GPU texture data
|
||||
|
||||
@@ -3665,7 +3665,7 @@ Get OpenGL framebuffer object id
|
||||
|
||||
> texture = RL.GetRenderTextureTexture( RenderTexture renderTexture )
|
||||
|
||||
Get color buffer attachment texture
|
||||
Get color buffer attachment texture. Returns as lightuserdata
|
||||
|
||||
- Success return Texture
|
||||
|
||||
@@ -3673,7 +3673,7 @@ Get color buffer attachment texture
|
||||
|
||||
> texture = RL.GetRenderTextureDepthTexture( RenderTexture renderTexture )
|
||||
|
||||
Get depth buffer attachment texture
|
||||
Get depth buffer attachment texture. Returns as lightuserdata
|
||||
|
||||
- Success return Texture
|
||||
|
||||
@@ -4170,7 +4170,7 @@ Load material from table. See material table definition
|
||||
|
||||
---
|
||||
|
||||
> RL.SetMaterialTexture( Material material, int mapType, Texture2D texture )
|
||||
> RL.SetMaterialTexture( Material material, int mapType, Texture texture )
|
||||
|
||||
Set texture for a material map type (MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS...)
|
||||
|
||||
@@ -4228,7 +4228,7 @@ Get color from material map type
|
||||
|
||||
Get material shader
|
||||
|
||||
- Success return Shader
|
||||
- Success return Shader. Returns as lightuserdata
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2619,13 +2619,13 @@ function RL.GetTextureFormat( texture ) end
|
||||
---@return any id
|
||||
function RL.GetRenderTextureId( renderTexture ) end
|
||||
|
||||
---Get color buffer attachment texture
|
||||
---Get color buffer attachment texture. Returns as lightuserdata
|
||||
---- Success return Texture
|
||||
---@param renderTexture any
|
||||
---@return any texture
|
||||
function RL.GetRenderTextureTexture( renderTexture ) end
|
||||
|
||||
---Get depth buffer attachment texture
|
||||
---Get depth buffer attachment texture. Returns as lightuserdata
|
||||
---- Success return Texture
|
||||
---@param renderTexture any
|
||||
---@return any texture
|
||||
@@ -3178,7 +3178,7 @@ function RL.GetMaterialColor( material, mapType ) end
|
||||
function RL.GetMaterialValue( material, mapType ) end
|
||||
|
||||
---Get material shader
|
||||
---- Success return Shader
|
||||
---- Success return Shader. Returns as lightuserdata
|
||||
---@param material any
|
||||
---@return any shader
|
||||
function RL.GetMaterialShader( material ) end
|
||||
|
||||
@@ -8,6 +8,7 @@ KEY CHANGES:
|
||||
- CHANGED: ModelAnimations are changed to separate ModelAnimation types as in Raylib.
|
||||
- ADDED: LoadTextureFromData.
|
||||
- ADDED: LoadRenderTextureFromData.
|
||||
- ADDED: Userdata objects can be referenced with lightuserdata.
|
||||
|
||||
DETAILED CHANGES:
|
||||
- CHANGED: GenImageColor now takes Vector2 as size.
|
||||
|
||||
@@ -5,7 +5,6 @@ local monitor = 0
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local framebuffer = nil
|
||||
local framebufferTex = nil
|
||||
local res = { 320, 180 }
|
||||
local scale = 5
|
||||
local winSize = { res[1] * scale, res[2] * scale }
|
||||
@@ -18,7 +17,6 @@ function RL.init()
|
||||
tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" )
|
||||
-- Create framebuffer.
|
||||
framebuffer = RL.LoadRenderTexture( res )
|
||||
framebufferTex = RL.GetRenderTextureTexture( framebuffer )
|
||||
end
|
||||
|
||||
function RL.process( delta )
|
||||
@@ -52,5 +50,5 @@ function RL.draw()
|
||||
RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED )
|
||||
RL.EndTextureMode()
|
||||
|
||||
RL.DrawTexturePro( framebufferTex, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } )
|
||||
RL.DrawTexturePro( RL.GetRenderTextureTexture( framebuffer ), { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } )
|
||||
end
|
||||
|
||||
@@ -16,7 +16,6 @@ local res = Vec2:new( 160, 144 )
|
||||
local winScale = 5
|
||||
local winSize = res:scale( winScale )
|
||||
local framebuffer = RL.LoadRenderTexture( res )
|
||||
local framebufferTex = RL.GetRenderTextureTexture( framebuffer )
|
||||
local monitor = 0
|
||||
local tilemap = {
|
||||
size = Vec2:new( res.x / TILE_SIZE, res.y / TILE_SIZE ),
|
||||
@@ -294,12 +293,6 @@ function RL.draw()
|
||||
drawPlayer()
|
||||
RL.EndTextureMode()
|
||||
|
||||
-- local framebufferTex = RL.GetRenderTextureTexture( framebuffer )
|
||||
-- local texId = RL.GetTextureId( framebufferTex )
|
||||
-- print( "texId", texId )
|
||||
|
||||
RL.DrawTexturePro( framebufferTex, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE )
|
||||
|
||||
-- collectgarbage( "collect" )
|
||||
RL.DrawTexturePro( RL.GetRenderTextureTexture( framebuffer ), { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE )
|
||||
-- RL.glBlitFramebuffer( framebuffer, -1, res, winSize, RL.GL_COLOR_BUFFER_BIT, RL.GL_NEAREST )
|
||||
end
|
||||
|
||||
@@ -6,7 +6,6 @@ local STATE = { TITLE = 0, GAME = 1, OVER = 2 } -- Enum wannabe.
|
||||
|
||||
-- Resources
|
||||
local framebuffer = nil
|
||||
local framebufferTex = nil
|
||||
local monitor = 0
|
||||
local monitorPos = RL.GetMonitorPosition( monitor )
|
||||
local monitorSize = RL.GetMonitorSize( monitor )
|
||||
@@ -74,7 +73,6 @@ function RL.init()
|
||||
RL.SetWindowIcon( RL.LoadImage( RL.GetBasePath().."../resources/images/apple.png" ) )
|
||||
|
||||
framebuffer = RL.LoadRenderTexture( RESOLUTION )
|
||||
framebufferTex = RL.GetRenderTextureTexture( framebuffer )
|
||||
grassTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/grass.png" )
|
||||
snakeTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/snake.png" )
|
||||
appleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/apple.png" )
|
||||
@@ -220,5 +218,5 @@ function RL.draw()
|
||||
RL.EndTextureMode()
|
||||
|
||||
-- Draw framebuffer to window.
|
||||
RL.DrawTexturePro( framebufferTex, { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE )
|
||||
RL.DrawTexturePro( RL.GetRenderTextureTexture( framebuffer ), { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -57,6 +57,21 @@ Ray uluaGetRay( lua_State *L );
|
||||
Ray uluaGetRayIndex( lua_State *L, int index );
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State *L );
|
||||
NPatchInfo uluaGetNPatchInfoIndex( 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 );
|
||||
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 );
|
||||
/* Push types. */
|
||||
void uluaPushColor( lua_State *L, Color color );
|
||||
void uluaPushVector2( lua_State *L, Vector2 vector );
|
||||
|
||||
56
src/audio.c
56
src/audio.c
@@ -72,7 +72,7 @@ Load sound from wave data
|
||||
- Success return Sound
|
||||
*/
|
||||
int laudioLoadSoundFromWave( lua_State *L ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
|
||||
uluaPushSound( L, LoadSoundFromWave( *wave ) );
|
||||
|
||||
@@ -87,7 +87,7 @@ Export wave data to file, returns true on success
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioExportWave( lua_State *L ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
|
||||
lua_pushboolean( L, ExportWave( *wave, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -102,7 +102,7 @@ Export wave sample data to code (.h), returns true on success
|
||||
- Success return true
|
||||
*/
|
||||
int laudioExportWaveAsCode( lua_State *L ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
|
||||
lua_pushboolean( L, ExportWaveAsCode( *wave, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -119,7 +119,7 @@ int laudioExportWaveAsCode( lua_State *L ) {
|
||||
Play a sound
|
||||
*/
|
||||
int laudioPlaySound( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
|
||||
PlaySound( *sound );
|
||||
|
||||
@@ -132,7 +132,7 @@ int laudioPlaySound( lua_State *L ) {
|
||||
Stop playing a sound
|
||||
*/
|
||||
int laudioStopSound( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
|
||||
StopSound( *sound );
|
||||
|
||||
@@ -145,7 +145,7 @@ int laudioStopSound( lua_State *L ) {
|
||||
Pause a sound
|
||||
*/
|
||||
int laudioPauseSound( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
|
||||
PauseSound( *sound );
|
||||
|
||||
@@ -158,7 +158,7 @@ int laudioPauseSound( lua_State *L ) {
|
||||
Resume a paused sound
|
||||
*/
|
||||
int laudioResumeSound( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
|
||||
ResumeSound( *sound );
|
||||
|
||||
@@ -173,7 +173,7 @@ Check if a sound is currently playing
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsSoundPlaying( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsSoundPlaying( *sound ) );
|
||||
|
||||
@@ -186,7 +186,7 @@ int laudioIsSoundPlaying( lua_State *L ) {
|
||||
Set volume for a sound (1.0 is max level)
|
||||
*/
|
||||
int laudioSetSoundVolume( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
float volume = luaL_checknumber( L, 2 );
|
||||
|
||||
SetSoundVolume( *sound, volume );
|
||||
@@ -200,7 +200,7 @@ int laudioSetSoundVolume( lua_State *L ) {
|
||||
Set pitch for a sound (1.0 is base level)
|
||||
*/
|
||||
int laudioSetSoundPitch( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
float pitch = luaL_checknumber( L, 2 );
|
||||
|
||||
SetSoundPitch( *sound, pitch );
|
||||
@@ -214,7 +214,7 @@ int laudioSetSoundPitch( lua_State *L ) {
|
||||
Set pan for a sound (0.5 is center)
|
||||
*/
|
||||
int laudioSetSoundPan( lua_State *L ) {
|
||||
Sound *sound = luaL_checkudata( L, 1, "Sound" );
|
||||
Sound *sound = uluaGetSound( L, 1 );
|
||||
float pan = luaL_checknumber( L, 2 );
|
||||
|
||||
SetSoundPan( *sound, pan );
|
||||
@@ -228,7 +228,7 @@ int laudioSetSoundPan( lua_State *L ) {
|
||||
Convert wave data to desired format
|
||||
*/
|
||||
int laudioWaveFormat( lua_State *L ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int sampleRate = luaL_checkinteger( L, 2 );
|
||||
int sampleSize = luaL_checkinteger( L, 3 );
|
||||
int channels = luaL_checkinteger( L, 4 );
|
||||
@@ -246,7 +246,7 @@ Copy a wave to a new wave
|
||||
- Success return Wave
|
||||
*/
|
||||
int laudioWaveCopy( lua_State *L ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
|
||||
uluaPushWave( L, WaveCopy( *wave ) );
|
||||
|
||||
@@ -259,7 +259,7 @@ int laudioWaveCopy( lua_State *L ) {
|
||||
Crop a wave to defined samples range
|
||||
*/
|
||||
int laudioWaveCrop( lua_State *L ) {
|
||||
Wave *wave = luaL_checkudata( L, 1, "Wave" );
|
||||
Wave *wave = uluaGetWave( L, 1 );
|
||||
int initSample = luaL_checkinteger( L, 2 );
|
||||
int finalSample = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -297,7 +297,7 @@ int laudioLoadMusicStream( lua_State *L ) {
|
||||
Start music playing
|
||||
*/
|
||||
int laudioPlayMusicStream( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
PlayMusicStream( *music );
|
||||
|
||||
@@ -312,7 +312,7 @@ Check if music is playing
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioIsMusicStreamPlaying( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsMusicStreamPlaying( *music ) );
|
||||
|
||||
@@ -325,7 +325,7 @@ int laudioIsMusicStreamPlaying( lua_State *L ) {
|
||||
Updates buffers for music streaming
|
||||
*/
|
||||
int laudioUpdateMusicStream( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
UpdateMusicStream( *music );
|
||||
|
||||
@@ -338,7 +338,7 @@ int laudioUpdateMusicStream( lua_State *L ) {
|
||||
Stop music playing
|
||||
*/
|
||||
int laudioStopMusicStream( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
StopMusicStream( *music );
|
||||
|
||||
@@ -351,7 +351,7 @@ int laudioStopMusicStream( lua_State *L ) {
|
||||
Pause music playing
|
||||
*/
|
||||
int laudioPauseMusicStream( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
PauseMusicStream( *music );
|
||||
|
||||
@@ -364,7 +364,7 @@ int laudioPauseMusicStream( lua_State *L ) {
|
||||
Resume playing paused music
|
||||
*/
|
||||
int laudioResumeMusicStream( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
ResumeMusicStream( *music );
|
||||
|
||||
@@ -377,7 +377,7 @@ int laudioResumeMusicStream( lua_State *L ) {
|
||||
Seek music to a position (in seconds)
|
||||
*/
|
||||
int laudioSeekMusicStream( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
float position = luaL_checknumber( L, 2 );
|
||||
|
||||
SeekMusicStream( *music, position );
|
||||
@@ -391,7 +391,7 @@ int laudioSeekMusicStream( lua_State *L ) {
|
||||
Set volume for music (1.0 is max level)
|
||||
*/
|
||||
int laudioSetMusicVolume( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
float volume = luaL_checknumber( L, 2 );
|
||||
|
||||
SetMusicVolume( *music, volume );
|
||||
@@ -405,7 +405,7 @@ int laudioSetMusicVolume( lua_State *L ) {
|
||||
Set pitch for a music (1.0 is base level)
|
||||
*/
|
||||
int laudioSetMusicPitch( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
float pitch = luaL_checknumber( L, 2 );
|
||||
|
||||
SetMusicPitch( *music, pitch );
|
||||
@@ -419,7 +419,7 @@ int laudioSetMusicPitch( lua_State *L ) {
|
||||
Set pan for a music (0.5 is center)
|
||||
*/
|
||||
int laudioSetMusicPan( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
float pan = luaL_checknumber( L, 2 );
|
||||
|
||||
SetMusicPitch( *music, pan );
|
||||
@@ -433,7 +433,7 @@ int laudioSetMusicPan( lua_State *L ) {
|
||||
Set looping for a music
|
||||
*/
|
||||
int laudioSetMusicLooping( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
bool looping = uluaGetBoolean( L, 2 );
|
||||
|
||||
music->looping = looping;
|
||||
@@ -449,7 +449,7 @@ Get looping of a music
|
||||
- Success return bool
|
||||
*/
|
||||
int laudioGetMusicLooping( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushboolean( L, music->looping );
|
||||
|
||||
@@ -464,7 +464,7 @@ Get music time length (in seconds)
|
||||
- Success return float
|
||||
*/
|
||||
int laudioGetMusicTimeLength( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushnumber( L, GetMusicTimeLength( *music ) );
|
||||
|
||||
@@ -479,7 +479,7 @@ Get current music time played (in seconds)
|
||||
- Success return float
|
||||
*/
|
||||
int laudioGetMusicTimePlayed( lua_State *L ) {
|
||||
Music *music = luaL_checkudata( L, 1, "Music" );
|
||||
Music *music = uluaGetMusic( L, 1 );
|
||||
|
||||
lua_pushnumber( L, GetMusicTimePlayed( *music ) );
|
||||
|
||||
|
||||
104
src/core.c
104
src/core.c
@@ -258,7 +258,7 @@ int lcoreIsWindowResized( lua_State *L ) {
|
||||
Set icon for window (Only PLATFORM_DESKTOP)
|
||||
*/
|
||||
int lcoreSetWindowIcon( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
SetWindowIcon( *image );
|
||||
|
||||
@@ -867,7 +867,7 @@ int lcoreLoadShaderFromMemory( lua_State *L ) {
|
||||
Begin custom shader drawing
|
||||
*/
|
||||
int lcoreBeginShaderMode( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
|
||||
BeginShaderMode( *shader );
|
||||
|
||||
@@ -893,7 +893,7 @@ Get shader uniform location
|
||||
- Success return int
|
||||
*/
|
||||
int lcoreGetShaderLocation( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GetShaderLocation( *shader, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -908,7 +908,7 @@ Get shader attribute location
|
||||
- Success return int
|
||||
*/
|
||||
int lcoreGetShaderLocationAttrib( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GetShaderLocationAttrib( *shader, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -921,7 +921,7 @@ int lcoreGetShaderLocationAttrib( lua_State *L ) {
|
||||
Set shader location index
|
||||
*/
|
||||
int lcoreSetShaderLocationIndex( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int shaderLocationIndex = luaL_checkinteger( L, 2 );
|
||||
int location = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -938,7 +938,7 @@ Get shader location index
|
||||
- Success return int
|
||||
*/
|
||||
int lcoreGetShaderLocationIndex( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int shaderLocationIndex = luaL_checkinteger( L, 2 );
|
||||
|
||||
lua_pushinteger( L, shader->locs[ shaderLocationIndex ] );
|
||||
@@ -952,7 +952,7 @@ int lcoreGetShaderLocationIndex( lua_State *L ) {
|
||||
Set shader uniform value (matrix 4x4)
|
||||
*/
|
||||
int lcoreSetShaderValueMatrix( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
Matrix mat = uluaGetMatrixIndex( L, 3 );
|
||||
|
||||
@@ -967,9 +967,9 @@ int lcoreSetShaderValueMatrix( lua_State *L ) {
|
||||
Set shader uniform value for texture (sampler2d)
|
||||
*/
|
||||
int lcoreSetShaderValueTexture( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
Texture *texture = luaL_checkudata( L, 3, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 3 );
|
||||
|
||||
SetShaderValueTexture( *shader, locIndex, *texture );
|
||||
|
||||
@@ -983,7 +983,7 @@ Set shader uniform value
|
||||
NOTE: Even one value should be in table
|
||||
*/
|
||||
int lcoreSetShaderValue( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
size_t valueCount = uluaGetTableLenIndex( L, 3 );
|
||||
int uniformType = luaL_checkinteger( L, 4 );
|
||||
@@ -1025,7 +1025,7 @@ Set shader uniform value vector
|
||||
NOTE: Even one value should be in table
|
||||
*/
|
||||
int lcoreSetShaderValueV( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
size_t valueCount = uluaGetTableLenIndex( L, 3 );
|
||||
int uniformType = luaL_checkinteger( L, 4 );
|
||||
@@ -1933,7 +1933,7 @@ int lcoreCreateCamera2D( lua_State *L ) {
|
||||
Begin 2D mode with custom camera (2D)
|
||||
*/
|
||||
int lcoreBeginMode2D( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
|
||||
BeginMode2D( *camera );
|
||||
|
||||
@@ -1957,7 +1957,7 @@ int lcoreEndMode2D( lua_State *L ) {
|
||||
Set camera target (rotation and zoom origin)
|
||||
*/
|
||||
int lcoreSetCamera2DTarget( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
Vector2 target = uluaGetVector2Index( L, 2 );
|
||||
|
||||
camera->target = target;
|
||||
@@ -1971,7 +1971,7 @@ int lcoreSetCamera2DTarget( lua_State *L ) {
|
||||
Set camera offset (displacement from target)
|
||||
*/
|
||||
int lcoreSetCamera2DOffset( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
Vector2 offset = uluaGetVector2Index( L, 2 );
|
||||
|
||||
camera->offset = offset;
|
||||
@@ -1985,7 +1985,7 @@ int lcoreSetCamera2DOffset( lua_State *L ) {
|
||||
Set camera rotation in degrees
|
||||
*/
|
||||
int lcoreSetCamera2DRotation( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
float rotation = luaL_checknumber( L, 2 );
|
||||
|
||||
camera->rotation = rotation;
|
||||
@@ -1999,7 +1999,7 @@ int lcoreSetCamera2DRotation( lua_State *L ) {
|
||||
Set camera zoom (scaling), should be 1.0f by default
|
||||
*/
|
||||
int lcoreSetCamera2DZoom( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
float zoom = luaL_checknumber( L, 2 );
|
||||
|
||||
camera->zoom = zoom;
|
||||
@@ -2015,7 +2015,7 @@ Get camera2D target
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lcoreGetCamera2DTarget( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
|
||||
uluaPushVector2( L, camera->target );
|
||||
|
||||
@@ -2030,7 +2030,7 @@ Get camera2D offset
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lcoreGetCamera2DOffset( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
uluaPushVector2( L, camera->offset );
|
||||
|
||||
return 1;
|
||||
@@ -2044,7 +2044,7 @@ Get camera2D rotation
|
||||
- Success return float
|
||||
*/
|
||||
int lcoreGetCamera2DRotation( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
lua_pushnumber( L, camera->rotation );
|
||||
|
||||
return 1;
|
||||
@@ -2058,7 +2058,7 @@ Get camera2D zoom
|
||||
- Success return float
|
||||
*/
|
||||
int lcoreGetCamera2DZoom( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
lua_pushnumber( L, camera->zoom );
|
||||
|
||||
return 1;
|
||||
@@ -2095,7 +2095,7 @@ int lcoreCreateCamera3D( lua_State *L ) {
|
||||
Begin 3D mode with custom camera (3D)
|
||||
*/
|
||||
int lcoreBeginMode3D( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
BeginMode3D( *camera );
|
||||
|
||||
@@ -2119,7 +2119,7 @@ int lcoreEndMode3D( lua_State *L ) {
|
||||
Set camera position (Remember to call "RL.UpdateCamera3D()" to apply changes)
|
||||
*/
|
||||
int lcoreSetCamera3DPosition( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 pos = uluaGetVector3Index( L, 2 );
|
||||
|
||||
camera->position = pos;
|
||||
@@ -2133,7 +2133,7 @@ int lcoreSetCamera3DPosition( lua_State *L ) {
|
||||
Set camera target it looks-at
|
||||
*/
|
||||
int lcoreSetCamera3DTarget( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 target = uluaGetVector3Index( L, 2 );
|
||||
|
||||
camera->target = target;
|
||||
@@ -2147,7 +2147,7 @@ int lcoreSetCamera3DTarget( lua_State *L ) {
|
||||
Set camera up vector (Rotation over it's axis)
|
||||
*/
|
||||
int lcoreSetCamera3DUp( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 up = uluaGetVector3Index( L, 2 );
|
||||
|
||||
camera->up = up;
|
||||
@@ -2161,7 +2161,7 @@ int lcoreSetCamera3DUp( lua_State *L ) {
|
||||
Set camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
|
||||
*/
|
||||
int lcoreSetCamera3DFovy( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float fovy = luaL_checknumber( L, 2 );
|
||||
|
||||
camera->fovy = fovy;
|
||||
@@ -2175,7 +2175,7 @@ int lcoreSetCamera3DFovy( lua_State *L ) {
|
||||
Set camera projection mode (CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC)
|
||||
*/
|
||||
int lcoreSetCamera3DProjection( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
int projection = luaL_checkinteger( L, 2 );
|
||||
|
||||
camera->projection = projection;
|
||||
@@ -2191,7 +2191,7 @@ Get camera position
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lcoreGetCamera3DPosition( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushVector3( L, camera->position );
|
||||
|
||||
@@ -2206,7 +2206,7 @@ Get camera target it looks-at
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lcoreGetCamera3DTarget( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushVector3( L, camera->target );
|
||||
|
||||
@@ -2221,7 +2221,7 @@ Get camera up vector (Rotation over it's axis)
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lcoreGetCamera3DUp( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushVector3( L, camera->up );
|
||||
|
||||
@@ -2236,7 +2236,7 @@ Get camera field-of-view apperture in Y (degrees) in perspective, used as near p
|
||||
- Success return float
|
||||
*/
|
||||
int lcoreGetCamera3DFovy( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
lua_pushnumber( L, camera->fovy );
|
||||
|
||||
@@ -2251,7 +2251,7 @@ Get camera projection mode
|
||||
- Success return int
|
||||
*/
|
||||
int lcoreGetCamera3DProjection( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
lua_pushinteger( L, camera->projection );
|
||||
|
||||
@@ -2266,7 +2266,7 @@ Returns the cameras forward vector (normalized)
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lcoreGetCamera3DForward( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushVector3( L, GetCameraForward( camera ) );
|
||||
|
||||
@@ -2282,7 +2282,7 @@ Note: The up vector might not be perpendicular to the forward vector
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lcoreGetCamera3DUpNormalized( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushVector3( L, GetCameraUp( camera ) );
|
||||
|
||||
@@ -2297,7 +2297,7 @@ Returns the cameras right vector (normalized)
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lcoreGetCamera3DRight( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushVector3( L, GetCameraRight( camera ) );
|
||||
|
||||
@@ -2310,7 +2310,7 @@ int lcoreGetCamera3DRight( lua_State *L ) {
|
||||
Moves the camera in it's forward direction
|
||||
*/
|
||||
int lcoreCamera3DMoveForward( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float distance = luaL_checknumber( L, 2 );
|
||||
bool moveInWorldPlane = uluaGetBoolean( L, 3 );
|
||||
|
||||
@@ -2325,7 +2325,7 @@ int lcoreCamera3DMoveForward( lua_State *L ) {
|
||||
Moves the camera in it's up direction
|
||||
*/
|
||||
int lcoreCamera3DMoveUp( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float distance = luaL_checknumber( L, 2 );
|
||||
|
||||
CameraMoveUp( camera, distance );
|
||||
@@ -2339,7 +2339,7 @@ int lcoreCamera3DMoveUp( lua_State *L ) {
|
||||
Moves the camera target in it's current right direction
|
||||
*/
|
||||
int lcoreCamera3DMoveRight( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float distance = luaL_checknumber( L, 2 );
|
||||
bool moveInWorldPlane = uluaGetBoolean( L, 3 );
|
||||
|
||||
@@ -2354,7 +2354,7 @@ int lcoreCamera3DMoveRight( lua_State *L ) {
|
||||
Moves the camera position closer/farther to/from the camera target
|
||||
*/
|
||||
int lcoreCamera3DMoveToTarget( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float delta = luaL_checknumber( L, 2 );
|
||||
|
||||
CameraMoveToTarget( camera, delta );
|
||||
@@ -2371,7 +2371,7 @@ If rotateAroundTarget is false, the camera rotates around it's position
|
||||
Note: angle must be provided in radians
|
||||
*/
|
||||
int lcoreCamera3DYaw( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float delta = luaL_checknumber( L, 2 );
|
||||
bool rotateAroundTarget = uluaGetBoolean( L, 3 );
|
||||
|
||||
@@ -2390,7 +2390,7 @@ Rotates the camera around it's right vector, pitch is "looking up and down"
|
||||
NOTE: angle must be provided in radians
|
||||
*/
|
||||
int lcoreCamera3DPitch( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float delta = luaL_checknumber( L, 2 );
|
||||
bool lockView = uluaGetBoolean( L, 3 );
|
||||
bool rotateAroundTarget = uluaGetBoolean( L, 4 );
|
||||
@@ -2409,7 +2409,7 @@ Roll is "turning your head sideways to the left or right"
|
||||
Note: angle must be provided in radians
|
||||
*/
|
||||
int lcoreCamera3DRoll( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float angle = luaL_checknumber( L, 2 );
|
||||
|
||||
CameraRoll( camera, angle );
|
||||
@@ -2425,7 +2425,7 @@ Returns the camera view matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lcoreGetCamera3DViewMatrix( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, GetCameraViewMatrix( camera ) );
|
||||
|
||||
@@ -2440,7 +2440,7 @@ Returns the camera projection matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lcoreGetCamera3DProjectionMatrix( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
float aspect = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushMatrix( L, GetCameraProjectionMatrix( camera, aspect ) );
|
||||
@@ -2454,7 +2454,7 @@ int lcoreGetCamera3DProjectionMatrix( lua_State *L ) {
|
||||
Update camera position for selected mode
|
||||
*/
|
||||
int lcoreUpdateCamera3D( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
int mode = luaL_checkinteger( L, 2 );
|
||||
|
||||
UpdateCamera( camera, mode );
|
||||
@@ -2468,7 +2468,7 @@ int lcoreUpdateCamera3D( lua_State *L ) {
|
||||
Update camera movement, movement/rotation values should be provided by user
|
||||
*/
|
||||
int lcoreUpdateCamera3DPro( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 movement = uluaGetVector3Index( L, 2 );
|
||||
Vector3 rotation = uluaGetVector3Index( L, 3 );
|
||||
float zoom = luaL_checknumber( L, 4 );
|
||||
@@ -2491,7 +2491,7 @@ Get a ray trace from mouse position
|
||||
*/
|
||||
int lcoreGetMouseRay( lua_State *L ) {
|
||||
Vector2 mousePosition = uluaGetVector2Index( L, 1 );
|
||||
Camera3D *camera = luaL_checkudata( L, 2, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 2 );
|
||||
|
||||
uluaPushRay( L, GetMouseRay( mousePosition, *camera ) );
|
||||
|
||||
@@ -2506,7 +2506,7 @@ Get camera transform matrix (view matrix)
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lcoreGetCameraMatrix( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, GetCameraMatrix( *camera ) );
|
||||
|
||||
@@ -2521,7 +2521,7 @@ Get camera 2d transform matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lcoreGetCameraMatrix2D( lua_State *L ) {
|
||||
Camera2D *camera = luaL_checkudata( L, 1, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, GetCameraMatrix2D( *camera ) );
|
||||
|
||||
@@ -2537,7 +2537,7 @@ Get the screen space position for a 3d world space position
|
||||
*/
|
||||
int lcoreGetWorldToScreen( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Camera3D *camera = luaL_checkudata( L, 2, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 2 );
|
||||
|
||||
uluaPushVector2( L, GetWorldToScreen( position, *camera ) );
|
||||
|
||||
@@ -2553,7 +2553,7 @@ Get size position for a 3d world space position
|
||||
*/
|
||||
int lcoreGetWorldToScreenEx( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Camera3D *camera = luaL_checkudata( L, 2, "Camera3D" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 2 );
|
||||
Vector2 size = uluaGetVector2Index( L, 3 );
|
||||
|
||||
uluaPushVector2( L, GetWorldToScreenEx( position, *camera, size.x, size.y ) );
|
||||
@@ -2570,7 +2570,7 @@ Get the screen space position for a 2d camera world space position
|
||||
*/
|
||||
int lcoreGetWorldToScreen2D( lua_State *L ) {
|
||||
Vector2 position = uluaGetVector2Index( L, 1 );
|
||||
Camera2D *camera = luaL_checkudata( L, 2, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 2 );
|
||||
|
||||
uluaPushVector2( L, GetWorldToScreen2D( position, *camera ) );
|
||||
|
||||
@@ -2586,7 +2586,7 @@ Get the world space position for a 2d camera screen space position
|
||||
*/
|
||||
int lcoreGetScreenToWorld2D( lua_State *L ) {
|
||||
Vector2 position = uluaGetVector2Index( L, 1 );
|
||||
Camera2D *camera = luaL_checkudata( L, 2, "Camera2D" );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 2 );
|
||||
|
||||
uluaPushVector2( L, GetScreenToWorld2D( position, *camera ) );
|
||||
|
||||
|
||||
4
src/gl.c
4
src/gl.c
@@ -29,7 +29,7 @@ int lglBlitFramebuffer( lua_State *L ) {
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 );
|
||||
}
|
||||
else {
|
||||
RenderTexture *srcTex = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
RenderTexture *srcTex = uluaGetRenderTexture( L, 1 );
|
||||
glBindFramebuffer( GL_READ_FRAMEBUFFER, srcTex->id );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ int lglBlitFramebuffer( lua_State *L ) {
|
||||
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
|
||||
}
|
||||
else {
|
||||
RenderTexture *dstTex = luaL_checkudata( L, 2, "RenderTexture" );
|
||||
RenderTexture *dstTex = uluaGetRenderTexture( L, 2 );
|
||||
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, dstTex->id );
|
||||
}
|
||||
|
||||
|
||||
26
src/lights.c
26
src/lights.c
@@ -23,7 +23,7 @@ int llightsCreateLight( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
Vector3 target = uluaGetVector3Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Shader *shader = luaL_checkudata( L, 5, "Shader" );
|
||||
Shader *shader = uluaGetShader( L, 5 );
|
||||
|
||||
uluaPushLight( L, CreateLight( type, position, target, color, *shader ) );
|
||||
|
||||
@@ -36,8 +36,8 @@ int llightsCreateLight( lua_State *L ) {
|
||||
Send light properties to shader
|
||||
*/
|
||||
int llightsUpdateLightValues( lua_State *L ) {
|
||||
Shader *shader = luaL_checkudata( L, 1, "Shader" );
|
||||
Light *light = luaL_checkudata( L, 2, "Light" );
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
Light *light = uluaGetLight( L, 2 );
|
||||
|
||||
UpdateLightValues( *shader, *light );
|
||||
|
||||
@@ -50,7 +50,7 @@ int llightsUpdateLightValues( lua_State *L ) {
|
||||
Set light type
|
||||
*/
|
||||
int llightsSetLightType( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
int type = luaL_checkinteger( L, 2 );
|
||||
|
||||
light->type = type;
|
||||
@@ -64,7 +64,7 @@ int llightsSetLightType( lua_State *L ) {
|
||||
Set light position
|
||||
*/
|
||||
int llightsSetLightPosition( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
|
||||
light->position = position;
|
||||
@@ -78,7 +78,7 @@ int llightsSetLightPosition( lua_State *L ) {
|
||||
Set light target
|
||||
*/
|
||||
int llightsSetLightTarget( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
Vector3 target = uluaGetVector3Index( L, 2 );
|
||||
|
||||
light->target = target;
|
||||
@@ -92,7 +92,7 @@ int llightsSetLightTarget( lua_State *L ) {
|
||||
Set light color
|
||||
*/
|
||||
int llightsSetLightColor( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
|
||||
light->color = color;
|
||||
@@ -106,7 +106,7 @@ int llightsSetLightColor( lua_State *L ) {
|
||||
Set light enabled
|
||||
*/
|
||||
int llightsSetLightEnabled( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
bool enabled = uluaGetBoolean( L, 2 );
|
||||
|
||||
light->enabled = enabled;
|
||||
@@ -122,7 +122,7 @@ Get light type
|
||||
- Success return int
|
||||
*/
|
||||
int llightsGetLightType( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
|
||||
lua_pushinteger( L, light->type );
|
||||
|
||||
@@ -137,7 +137,7 @@ Get light position
|
||||
- Success return Vector3
|
||||
*/
|
||||
int llightsGetLightPosition( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
|
||||
uluaPushVector3( L, light->position );
|
||||
|
||||
@@ -152,7 +152,7 @@ Get light target
|
||||
- Success return Vector3
|
||||
*/
|
||||
int llightsGetLightTarget( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
|
||||
uluaPushVector3( L, light->target );
|
||||
|
||||
@@ -167,7 +167,7 @@ Get light color
|
||||
- Success return Color
|
||||
*/
|
||||
int llightsGetLightColor( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
|
||||
uluaPushColor( L, light->color );
|
||||
|
||||
@@ -182,7 +182,7 @@ Get light enabled
|
||||
- Success return boolean
|
||||
*/
|
||||
int llightsIsLightEnabled( lua_State *L ) {
|
||||
Light *light = luaL_checkudata( L, 1, "Light" );
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
|
||||
lua_pushboolean( L, light->enabled );
|
||||
|
||||
|
||||
196
src/lua_core.c
196
src/lua_core.c
@@ -200,7 +200,6 @@ static int gcMaterial( lua_State *L ) {
|
||||
Material *material = luaL_checkudata ( L, 1, "Material" );
|
||||
|
||||
// int MAX_MATERIAL_MAPS = 12;
|
||||
|
||||
|
||||
// Unload loaded texture maps (avoid unloading default texture, managed by raylib)
|
||||
// if ( material->maps != NULL ) {
|
||||
@@ -2789,6 +2788,201 @@ NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index ) {
|
||||
return npatch;
|
||||
}
|
||||
|
||||
Image* uluaGetImage( lua_State *L, int index ) {
|
||||
Image *image = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
image = (Image*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
image = luaL_checkudata( L, index, "Image" );
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
Texture* uluaGetTexture( lua_State *L, int index ) {
|
||||
Texture *texture = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
texture = (Texture*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
texture = luaL_checkudata( L, index, "Texture" );
|
||||
}
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
RenderTexture* uluaGetRenderTexture( lua_State *L, int index ) {
|
||||
RenderTexture *renderTexture = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
renderTexture = (RenderTexture*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
renderTexture = luaL_checkudata( L, index, "RenderTexture" );
|
||||
}
|
||||
|
||||
return renderTexture;
|
||||
}
|
||||
|
||||
Shader* uluaGetShader( lua_State *L, int index ) {
|
||||
Shader *shader = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
shader = (Shader*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
shader = luaL_checkudata( L, index, "Shader" );
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
Mesh* uluaGetMesh( lua_State *L, int index ) {
|
||||
Mesh *mesh = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
mesh = (Mesh*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
mesh = luaL_checkudata( L, index, "Mesh" );
|
||||
}
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
||||
Camera2D* uluaGetCamera2D( lua_State *L, int index ) {
|
||||
Camera2D *camera = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
camera = (Camera2D*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
camera = luaL_checkudata( L, index, "Camera2D" );
|
||||
}
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
Camera3D* uluaGetCamera3D( lua_State *L, int index ) {
|
||||
Camera3D *camera = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
camera = (Camera3D*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
camera = luaL_checkudata( L, index, "Camera3D" );
|
||||
}
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
Font* uluaGetFont( lua_State *L, int index ) {
|
||||
Font *font = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
font = (Font*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
font = luaL_checkudata( L, index, "Font" );
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
Wave* uluaGetWave( lua_State *L, int index ) {
|
||||
Wave *wave = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
wave = (Wave*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
wave = luaL_checkudata( L, index, "Wave" );
|
||||
}
|
||||
|
||||
return wave;
|
||||
}
|
||||
|
||||
Sound* uluaGetSound( lua_State *L, int index ) {
|
||||
Sound *sound = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
sound = (Sound*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
sound = luaL_checkudata( L, index, "Sound" );
|
||||
}
|
||||
|
||||
return sound;
|
||||
}
|
||||
|
||||
Music* uluaGetMusic( lua_State *L, int index ) {
|
||||
Music *music = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
music = (Music*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
music = luaL_checkudata( L, index, "Music" );
|
||||
}
|
||||
|
||||
return music;
|
||||
}
|
||||
|
||||
Light* uluaGetLight( lua_State *L, int index ) {
|
||||
Light *light = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
light = (Light*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
light = luaL_checkudata( L, index, "Light" );
|
||||
}
|
||||
|
||||
return light;
|
||||
}
|
||||
|
||||
Material* uluaGetMaterial( lua_State *L, int index ) {
|
||||
Material *material = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
material = (Material*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
material = luaL_checkudata( L, index, "Material" );
|
||||
}
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
Model* uluaGetModel( lua_State *L, int index ) {
|
||||
Model *model = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
model = (Model*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
model = luaL_checkudata( L, index, "Model" );
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
ModelAnimation* uluaGetModelAnimation( lua_State *L, int index ) {
|
||||
ModelAnimation *anim = NULL;
|
||||
|
||||
if ( lua_islightuserdata( L, index ) ) {
|
||||
anim = (ModelAnimation*)lua_touserdata( L, index );
|
||||
}
|
||||
else if ( lua_isuserdata( L, index ) ) {
|
||||
anim = luaL_checkudata( L, index, "ModelAnimation" );
|
||||
}
|
||||
|
||||
return anim;
|
||||
}
|
||||
|
||||
/* Push types. */
|
||||
|
||||
void uluaPushColor( lua_State *L, Color color ) {
|
||||
|
||||
98
src/models.c
98
src/models.c
@@ -396,7 +396,7 @@ int lmodelsDrawPlane( lua_State *L ) {
|
||||
Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0).
|
||||
*/
|
||||
int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
/* Vertices. */
|
||||
Vector3 vertices[4] = { 0 };
|
||||
@@ -634,7 +634,7 @@ Generate heightmap mesh from image data
|
||||
- Success return Mesh
|
||||
*/
|
||||
int lmodelsGenMeshHeightmap( lua_State *L ) {
|
||||
Image *heightmap = luaL_checkudata( L, 1, "Image" );
|
||||
Image *heightmap = uluaGetImage( L, 1 );
|
||||
Vector3 size = uluaGetVector3Index( L, 2 );
|
||||
|
||||
uluaPushMesh( L, GenMeshHeightmap( *heightmap, size ) );
|
||||
@@ -805,7 +805,7 @@ Update mesh vertex data in GPU.
|
||||
Note! Mainly intented to be used with custom meshes.
|
||||
*/
|
||||
int lmodelsUpdateMesh( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
luaL_checktype( L, 2, LUA_TTABLE );
|
||||
|
||||
int t = 2;
|
||||
@@ -929,8 +929,8 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
Draw a 3d mesh with material and transform
|
||||
*/
|
||||
int lmodelsDrawMesh( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Material *material = luaL_checkudata( L, 2, "Material" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
Material *material = uluaGetMaterial( L, 2 );
|
||||
Matrix matrix = uluaGetMatrixIndex( L, 3 );
|
||||
|
||||
DrawMesh( *mesh, *material, matrix );
|
||||
@@ -944,8 +944,8 @@ int lmodelsDrawMesh( lua_State *L ) {
|
||||
Draw multiple mesh instances with material and different transforms
|
||||
*/
|
||||
int lmodelsDrawMeshInstanced( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Material *material = luaL_checkudata( L, 2, "Material" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
Material *material = uluaGetMaterial( L, 2 );
|
||||
luaL_checktype( L, 3, LUA_TTABLE );
|
||||
int instances = luaL_checkinteger( L, 4 );
|
||||
|
||||
@@ -976,7 +976,7 @@ NOTE: Currently only works on custom mesh
|
||||
- Success return true
|
||||
*/
|
||||
int lmodelsSetMeshColor( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
|
||||
if ( mesh->colors == NULL ) {
|
||||
@@ -1007,7 +1007,7 @@ Export mesh data to file, returns true on success
|
||||
- Success return bool
|
||||
*/
|
||||
int lmodelsExportMesh( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
|
||||
lua_pushboolean( L, ExportMesh( *mesh, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -1022,7 +1022,7 @@ Compute mesh bounding box limits
|
||||
- Success return BoundingBox
|
||||
*/
|
||||
int lmodelsGetMeshBoundingBox( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
|
||||
uluaPushBoundingBox( L, GetMeshBoundingBox( *mesh ) );
|
||||
|
||||
@@ -1035,7 +1035,7 @@ int lmodelsGetMeshBoundingBox( lua_State *L ) {
|
||||
Compute mesh tangents
|
||||
*/
|
||||
int lmodelsGenMeshTangents( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
|
||||
GenMeshTangents( mesh );
|
||||
|
||||
@@ -1097,7 +1097,7 @@ int lmodelsCreateMaterial( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t4 ) != 0 ) {
|
||||
if ( strcmp( "texture", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
Texture *texture = luaL_checkudata( L, lua_gettop( L ), "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, lua_gettop( L ) );
|
||||
material.maps[map].texture = *texture;
|
||||
printf( "Material Create material.maps[map].texture.id = %d\n", material.maps[map].texture.id );
|
||||
}
|
||||
@@ -1134,7 +1134,7 @@ int lmodelsCreateMaterial( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "shader", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
Shader *shader = luaL_checkudata( L, lua_gettop( L ), "Shader" );
|
||||
Shader *shader = uluaGetShader( L, lua_gettop( L ) );
|
||||
material.shader = *shader;
|
||||
}
|
||||
lua_pop( L, 1 );
|
||||
@@ -1145,14 +1145,14 @@ int lmodelsCreateMaterial( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL.SetMaterialTexture( Material material, int mapType, Texture2D texture )
|
||||
> RL.SetMaterialTexture( Material material, int mapType, Texture texture )
|
||||
|
||||
Set texture for a material map type (MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS...)
|
||||
*/
|
||||
int lmodelsSetMaterialTexture( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
Texture *texture = luaL_checkudata( L, 3, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 3 );
|
||||
|
||||
SetMaterialTexture( material, mapType, *texture );
|
||||
|
||||
@@ -1165,7 +1165,7 @@ int lmodelsSetMaterialTexture( lua_State *L ) {
|
||||
Set color for a material map type
|
||||
*/
|
||||
int lmodelsSetMaterialColor( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
|
||||
@@ -1180,7 +1180,7 @@ int lmodelsSetMaterialColor( lua_State *L ) {
|
||||
Set value for a material map type
|
||||
*/
|
||||
int lmodelsSetMaterialValue( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
float value = luaL_checknumber( L, 3 );
|
||||
|
||||
@@ -1195,8 +1195,8 @@ int lmodelsSetMaterialValue( lua_State *L ) {
|
||||
Set shader for material
|
||||
*/
|
||||
int lmodelsSetMaterialShader( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Shader *shader = luaL_checkudata( L, 2, "Shader" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
Shader *shader = uluaGetShader( L, 2 );
|
||||
|
||||
material->shader = *shader;
|
||||
|
||||
@@ -1209,7 +1209,7 @@ int lmodelsSetMaterialShader( lua_State *L ) {
|
||||
Set material generic parameters (if required)
|
||||
*/
|
||||
int lmodelsSetMaterialParams( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
|
||||
size_t len = uluaGetTableLenIndex( L, 2 );
|
||||
|
||||
@@ -1241,7 +1241,7 @@ Get texture from material map type. Returns -1 if no texture
|
||||
- Success return Texture
|
||||
*/
|
||||
int lmodelsGetMaterialTexture( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
|
||||
uluaPushTexture( L, material->maps[ mapType ].texture );
|
||||
@@ -1257,7 +1257,7 @@ Get color from material map type
|
||||
- Success return Color
|
||||
*/
|
||||
int lmodelsGetMaterialColor( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
|
||||
uluaPushColor( L, material->maps[ mapType ].color );
|
||||
@@ -1273,7 +1273,7 @@ Get color from material map type
|
||||
- Success return float
|
||||
*/
|
||||
int lmodelsGetMaterialValue( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
|
||||
lua_pushnumber( L, material->maps[ mapType ].value );
|
||||
@@ -1286,12 +1286,12 @@ int lmodelsGetMaterialValue( lua_State *L ) {
|
||||
|
||||
Get material shader
|
||||
|
||||
- Success return Shader
|
||||
- Success return Shader. Returns as lightuserdata
|
||||
*/
|
||||
int lmodelsGetMaterialShader( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
|
||||
uluaPushShader( L, material->shader );
|
||||
lua_pushlightuserdata( L, &material->shader );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1304,7 +1304,7 @@ Get material parameters
|
||||
- Success return float{}
|
||||
*/
|
||||
int lmodelsGetMaterialParams( lua_State *L ) {
|
||||
Material *material = luaL_checkudata( L, 1, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
|
||||
Vector4 params = {
|
||||
material->params[0],
|
||||
@@ -1349,7 +1349,7 @@ Load model from generated mesh (Default material)
|
||||
- Success return Model
|
||||
*/
|
||||
int lmodelsLoadModelFromMesh( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata( L, 1, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
|
||||
uluaPushModel( L, LoadModelFromMesh( *mesh ) );
|
||||
|
||||
@@ -1362,7 +1362,7 @@ int lmodelsLoadModelFromMesh( lua_State *L ) {
|
||||
Draw a model (With texture if set)
|
||||
*/
|
||||
int lmodelsDrawModel( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
float scale = luaL_checknumber( L, 3 );
|
||||
Color tint = uluaGetColorIndex( L, 4 );
|
||||
@@ -1378,7 +1378,7 @@ int lmodelsDrawModel( lua_State *L ) {
|
||||
Draw a model with extended parameters
|
||||
*/
|
||||
int lmodelsDrawModelEx( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
Vector3 rotationAxis = uluaGetVector3Index( L, 3 );
|
||||
float rotationAngle = luaL_checknumber( L, 4 );
|
||||
@@ -1396,9 +1396,9 @@ int lmodelsDrawModelEx( lua_State *L ) {
|
||||
Copies material to model material. (Model material is the material id in models.)
|
||||
*/
|
||||
int lmodelsSetModelMaterial( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
int modelMaterialId = luaL_checkinteger( L, 2 );
|
||||
Material *material = luaL_checkudata( L, 3, "Material" );
|
||||
Material *material = uluaGetMaterial( L, 3 );
|
||||
|
||||
/* Copy material data instead of using pointer. Pointer would result in double free error. */
|
||||
model->materials[ modelMaterialId ].shader = material->shader;
|
||||
@@ -1427,7 +1427,7 @@ int lmodelsSetModelMaterial( lua_State *L ) {
|
||||
Set material for a mesh (Mesh and material on this model)
|
||||
*/
|
||||
int lmodelsSetModelMeshMaterial( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
int meshId = luaL_checkinteger( L, 2 );
|
||||
int materialId = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -1442,8 +1442,8 @@ int lmodelsSetModelMeshMaterial( lua_State *L ) {
|
||||
Draw a billboard texture
|
||||
*/
|
||||
int lmodelsDrawBillboard( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Texture *texture = luaL_checkudata( L, 2, "Texture" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Texture *texture = uluaGetTexture( L, 2 );
|
||||
Vector3 position = uluaGetVector3Index( L, 3 );
|
||||
float size = luaL_checknumber( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
@@ -1459,8 +1459,8 @@ int lmodelsDrawBillboard( lua_State *L ) {
|
||||
Draw a billboard texture defined by source
|
||||
*/
|
||||
int lmodelsDrawBillboardRec( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Texture *texture = luaL_checkudata( L, 2, "Texture" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Texture *texture = uluaGetTexture( L, 2 );
|
||||
Rectangle source = uluaGetRectangleIndex( L, 3 );
|
||||
Vector3 position = uluaGetVector3Index( L, 4 );
|
||||
Vector2 size = uluaGetVector2Index( L, 5 );
|
||||
@@ -1477,8 +1477,8 @@ int lmodelsDrawBillboardRec( lua_State *L ) {
|
||||
Draw a billboard texture defined by source and rotation
|
||||
*/
|
||||
int lmodelsDrawBillboardPro( lua_State *L ) {
|
||||
Camera3D *camera = luaL_checkudata( L, 1, "Camera3D" );
|
||||
Texture *texture = luaL_checkudata( L, 2, "Texture" );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Texture *texture = uluaGetTexture( L, 2 );
|
||||
Rectangle source = uluaGetRectangleIndex( L, 3 );
|
||||
Vector3 position = uluaGetVector3Index( L, 4 );
|
||||
Vector3 up = uluaGetVector3Index( L, 5 );
|
||||
@@ -1498,7 +1498,7 @@ int lmodelsDrawBillboardPro( lua_State *L ) {
|
||||
Set model transform matrix
|
||||
*/
|
||||
int lmodelsSetModelTransform( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
Matrix transform = uluaGetMatrixIndex( L, 2 );
|
||||
|
||||
model->transform = transform;
|
||||
@@ -1514,7 +1514,7 @@ Get model transform matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmodelsGetModelTransform( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, model->transform );
|
||||
|
||||
@@ -1559,8 +1559,8 @@ int lmodelsLoadModelAnimations( lua_State *L ) {
|
||||
Update model animation pose
|
||||
*/
|
||||
int lmodelsUpdateModelAnimation( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
ModelAnimation *modelAnimation = luaL_checkudata( L, 2, "ModelAnimation" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
ModelAnimation *modelAnimation = uluaGetModelAnimation( L, 2 );
|
||||
int frame = luaL_checkinteger( L, 3 );
|
||||
|
||||
UpdateModelAnimation( *model, *modelAnimation, frame );
|
||||
@@ -1576,8 +1576,8 @@ Check model animation skeleton match
|
||||
- Success return bool
|
||||
*/
|
||||
int lmodelsIsModelAnimationValid( lua_State *L ) {
|
||||
Model *model = luaL_checkudata( L, 1, "Model" );
|
||||
ModelAnimation *modelAnimation = luaL_checkudata( L, 2, "ModelAnimation" );
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
ModelAnimation *modelAnimation = uluaGetModelAnimation( L, 2 );
|
||||
|
||||
lua_pushboolean( L, IsModelAnimationValid( *model, *modelAnimation ) );
|
||||
|
||||
@@ -1592,7 +1592,7 @@ Return modelAnimation bone count
|
||||
- Success return int
|
||||
*/
|
||||
int lmodelsGetModelAnimationBoneCount( lua_State *L ) {
|
||||
ModelAnimation *modelAnimation = luaL_checkudata( L, 1, "ModelAnimation" );
|
||||
ModelAnimation *modelAnimation = uluaGetModelAnimation( L, 1 );
|
||||
|
||||
lua_pushinteger( L, modelAnimation->boneCount );
|
||||
|
||||
@@ -1607,7 +1607,7 @@ Return modelAnimation frame count
|
||||
- Success return int
|
||||
*/
|
||||
int lmodelsGetModelAnimationFrameCount( lua_State *L ) {
|
||||
ModelAnimation *modelAnimation = luaL_checkudata( L, 1, "ModelAnimation" );
|
||||
ModelAnimation *modelAnimation = uluaGetModelAnimation( L, 1 );
|
||||
|
||||
lua_pushinteger( L, modelAnimation->frameCount );
|
||||
|
||||
@@ -1711,7 +1711,7 @@ Get collision info between ray and mesh
|
||||
*/
|
||||
int lmodelsGetRayCollisionMesh( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
Mesh *mesh = luaL_checkudata( L, 2, "Mesh" );
|
||||
Mesh *mesh = uluaGetMesh( L, 2 );
|
||||
Matrix transform = uluaGetMatrixIndex( L, 3 );
|
||||
|
||||
uluaPushRayCollision( L, GetRayCollisionMesh( ray, *mesh, transform ) );
|
||||
|
||||
@@ -116,7 +116,7 @@ int lguiGuiGetState( lua_State *L ) {
|
||||
Set gui custom font (global state)
|
||||
*/
|
||||
int lguiGuiSetFont( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
|
||||
GuiSetFont( *font );
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ NOTE: It can be useful when using basic shapes and one single font,
|
||||
defining a font char white rectangle would allow drawing everything in a single draw call
|
||||
*/
|
||||
int lshapesSetShapesTexture( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle source = uluaGetRectangleIndex( L, 2 );
|
||||
|
||||
SetShapesTexture( *texture, source );
|
||||
|
||||
16
src/text.c
16
src/text.c
@@ -87,7 +87,7 @@ Load font from Image ( XNA style)
|
||||
- Success return Font
|
||||
*/
|
||||
int ltextLoadFontFromImage( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color key = uluaGetColorIndex( L, 2 );
|
||||
int firstChar = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -119,7 +119,7 @@ int ltextDrawFPS( lua_State *L ) {
|
||||
Draw text using font and additional parameters
|
||||
*/
|
||||
int ltextDrawText( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
@@ -136,7 +136,7 @@ int ltextDrawText( lua_State *L ) {
|
||||
Draw text using Font and pro parameters (rotation)
|
||||
*/
|
||||
int ltextDrawTextPro( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 3 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 4 );
|
||||
float rotation = luaL_checknumber( L, 5 );
|
||||
@@ -161,7 +161,7 @@ Measure string size for Font
|
||||
- Success return Vector2
|
||||
*/
|
||||
int ltextMeasureText( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
float fontSize = luaL_checknumber( L, 3 );
|
||||
float spacing = luaL_checknumber( L, 4 );
|
||||
|
||||
@@ -178,7 +178,7 @@ Get font base size (default chars height)
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetFontBaseSize( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushinteger( L, font->baseSize );
|
||||
|
||||
@@ -193,7 +193,7 @@ Get font number of glyph characters
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetFontGlyphCount( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushinteger( L, font->glyphCount );
|
||||
|
||||
@@ -208,7 +208,7 @@ Get font padding around the glyph characters
|
||||
- Success return int
|
||||
*/
|
||||
int ltextGetFontGlyphPadding( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
|
||||
lua_pushinteger( L, font->glyphPadding );
|
||||
|
||||
@@ -223,7 +223,7 @@ Get font texture atlas containing the glyphs.
|
||||
- Success return Texture
|
||||
*/
|
||||
int ltextGetFontTexture( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
|
||||
uluaPushTexture( L, font->texture );
|
||||
|
||||
|
||||
155
src/textures.c
155
src/textures.c
@@ -28,14 +28,14 @@ int ltexturesLoadImage( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> image = RL.LoadImageFromTexture( Texture2D texture )
|
||||
> image = RL.LoadImageFromTexture( Texture texture )
|
||||
|
||||
Load image from GPU texture data
|
||||
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesLoadImageFromTexture( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
uluaPushImage( L, LoadImageFromTexture( *texture ) );
|
||||
|
||||
return 1;
|
||||
@@ -62,7 +62,7 @@ Export image data to file, returns true on success
|
||||
- Success return bool
|
||||
*/
|
||||
int ltexturesExportImage( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
lua_pushboolean( L, ExportImage( *image, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
return 1;
|
||||
@@ -76,7 +76,7 @@ Export image as code file defining an array of bytes, returns true on success
|
||||
- Success return bool
|
||||
*/
|
||||
int ltexturesExportImageAsCode( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
lua_pushboolean( L, ExportImageAsCode( *image, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
return 1;
|
||||
@@ -248,7 +248,7 @@ Create an image duplicate (useful for transformations)
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesImageCopy( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
uluaPushImage( L, ImageCopy( *image ) );
|
||||
|
||||
@@ -263,7 +263,7 @@ Create an image from another image piece
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesImageFromImage( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
|
||||
uluaPushImage( L, ImageFromImage( *image, rec ) );
|
||||
@@ -279,7 +279,7 @@ Create an image from text (custom sprite font)
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesImageText( lua_State *L ) {
|
||||
Font *font = luaL_checkudata( L, 1, "Font" );
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
float fontSize = lua_tonumber( L, 3 );
|
||||
float spacing = lua_tonumber( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
@@ -295,7 +295,7 @@ int ltexturesImageText( lua_State *L ) {
|
||||
Convert image data to desired format
|
||||
*/
|
||||
int ltexturesImageFormat( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
int newFormat = luaL_checkinteger( L, 2 );
|
||||
|
||||
ImageFormat( image, newFormat );
|
||||
@@ -309,7 +309,7 @@ int ltexturesImageFormat( lua_State *L ) {
|
||||
Convert image to POT (power-of-two)
|
||||
*/
|
||||
int ltexturesImageToPOT( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color fill = uluaGetColorIndex( L, 2 );
|
||||
|
||||
ImageToPOT( image, fill );
|
||||
@@ -323,7 +323,7 @@ int ltexturesImageToPOT( lua_State *L ) {
|
||||
Crop an image to a defined rectangle
|
||||
*/
|
||||
int ltexturesImageCrop( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle crop = uluaGetRectangleIndex( L, 2 );
|
||||
|
||||
ImageCrop( image, crop );
|
||||
@@ -337,7 +337,7 @@ int ltexturesImageCrop( lua_State *L ) {
|
||||
Crop image depending on alpha value
|
||||
*/
|
||||
int ltexturesImageAlphaCrop( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
float threshold = lua_tonumber( L, 2 );
|
||||
|
||||
ImageAlphaCrop( image, threshold );
|
||||
@@ -351,7 +351,7 @@ int ltexturesImageAlphaCrop( lua_State *L ) {
|
||||
Clear alpha channel to desired color
|
||||
*/
|
||||
int ltexturesImageAlphaClear( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
float threshold = lua_tonumber( L, 3 );
|
||||
|
||||
@@ -366,8 +366,8 @@ int ltexturesImageAlphaClear( lua_State *L ) {
|
||||
Apply alpha mask to image
|
||||
*/
|
||||
int ltexturesImageAlphaMask( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *alphaMask = luaL_checkudata( L, 2, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Image *alphaMask = uluaGetImage( L, 2 );
|
||||
|
||||
ImageAlphaMask( image, *alphaMask );
|
||||
|
||||
@@ -380,7 +380,7 @@ int ltexturesImageAlphaMask( lua_State *L ) {
|
||||
Premultiply alpha channel
|
||||
*/
|
||||
int ltexturesImageAlphaPremultiply( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageAlphaPremultiply( image );
|
||||
|
||||
@@ -393,7 +393,7 @@ int ltexturesImageAlphaPremultiply( lua_State *L ) {
|
||||
Apply Gaussian blur using a box blur approximation
|
||||
*/
|
||||
int ltexturesImageBlurGaussian( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
int blurSize = luaL_checkinteger( L, 2 );
|
||||
|
||||
ImageBlurGaussian( image, blurSize );
|
||||
@@ -407,7 +407,7 @@ int ltexturesImageBlurGaussian( lua_State *L ) {
|
||||
Resize image (Bicubic scaling algorithm)
|
||||
*/
|
||||
int ltexturesImageResize( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
|
||||
ImageResize( image, (int)size.x, (int)size.y );
|
||||
@@ -421,7 +421,7 @@ int ltexturesImageResize( lua_State *L ) {
|
||||
Resize image (Nearest-Neighbor scaling algorithm)
|
||||
*/
|
||||
int ltexturesImageResizeNN( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
|
||||
ImageResizeNN( image, (int)size.x, (int)size.y );
|
||||
@@ -435,7 +435,7 @@ int ltexturesImageResizeNN( lua_State *L ) {
|
||||
Resize canvas and fill with color
|
||||
*/
|
||||
int ltexturesImageResizeCanvas( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
Vector2 offset = uluaGetVector2Index( L, 3 );
|
||||
Color fill = uluaGetColorIndex( L, 4 );
|
||||
@@ -451,7 +451,7 @@ int ltexturesImageResizeCanvas( lua_State *L ) {
|
||||
Generate all mipmap levels for a provided image
|
||||
*/
|
||||
int ltexturesImageMipmaps( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageMipmaps( image );
|
||||
|
||||
@@ -464,7 +464,7 @@ int ltexturesImageMipmaps( lua_State *L ) {
|
||||
Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
*/
|
||||
int ltexturesImageDither( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color bpp = uluaGetColorIndex( L, 2 );
|
||||
|
||||
ImageDither( image, bpp.r, bpp.g, bpp.b, bpp.a );
|
||||
@@ -478,7 +478,7 @@ int ltexturesImageDither( lua_State *L ) {
|
||||
Flip image vertically
|
||||
*/
|
||||
int ltexturesImageFlipVertical( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageFlipVertical( image );
|
||||
|
||||
@@ -491,7 +491,7 @@ int ltexturesImageFlipVertical( lua_State *L ) {
|
||||
Flip image horizontally
|
||||
*/
|
||||
int ltexturesImageFlipHorizontal( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageFlipHorizontal( image );
|
||||
|
||||
@@ -504,7 +504,7 @@ int ltexturesImageFlipHorizontal( lua_State *L ) {
|
||||
Rotate image clockwise 90deg
|
||||
*/
|
||||
int ltexturesImageRotateCW( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageRotateCW( image );
|
||||
|
||||
@@ -517,7 +517,7 @@ int ltexturesImageRotateCW( lua_State *L ) {
|
||||
Rotate image counter-clockwise 90deg
|
||||
*/
|
||||
int ltexturesImageRotateCCW( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageRotateCCW( image );
|
||||
|
||||
@@ -530,7 +530,7 @@ int ltexturesImageRotateCCW( lua_State *L ) {
|
||||
Modify image color: tint
|
||||
*/
|
||||
int ltexturesImageColorTint( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
|
||||
ImageColorTint( image, color );
|
||||
@@ -544,7 +544,7 @@ int ltexturesImageColorTint( lua_State *L ) {
|
||||
Modify image color: invert
|
||||
*/
|
||||
int ltexturesImageColorInvert( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageColorInvert( image );
|
||||
|
||||
@@ -557,7 +557,7 @@ int ltexturesImageColorInvert( lua_State *L ) {
|
||||
Modify image color: grayscale
|
||||
*/
|
||||
int ltexturesImageColorGrayscale( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
ImageColorGrayscale( image );
|
||||
|
||||
@@ -570,7 +570,7 @@ int ltexturesImageColorGrayscale( lua_State *L ) {
|
||||
Modify image color: contrast (-100 to 100)
|
||||
*/
|
||||
int ltexturesImageColorContrast( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
float contrast = luaL_checkinteger( L, 2 );
|
||||
|
||||
ImageColorContrast( image, contrast );
|
||||
@@ -584,7 +584,7 @@ int ltexturesImageColorContrast( lua_State *L ) {
|
||||
Modify image color: brightness (-255 to 255)
|
||||
*/
|
||||
int ltexturesImageColorBrightness( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
int brightness = luaL_checkinteger( L, 2 );
|
||||
|
||||
ImageColorBrightness( image, brightness );
|
||||
@@ -598,7 +598,7 @@ int ltexturesImageColorBrightness( lua_State *L ) {
|
||||
Modify image color: replace color
|
||||
*/
|
||||
int ltexturesImageColorReplace( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color replace = uluaGetColorIndex( L, 3 );
|
||||
|
||||
@@ -615,7 +615,7 @@ Load color data from image as a Color array (RGBA - 32bit)
|
||||
- Success return Color{}
|
||||
*/
|
||||
int ltexturesLoadImageColors( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
int colorCount = image->width * image->height;
|
||||
Color *colors = LoadImageColors( *image );
|
||||
@@ -639,7 +639,7 @@ Load colors palette from image as a Color array (RGBA - 32bit)
|
||||
- Success return Color{}
|
||||
*/
|
||||
int ltexturesLoadImagePalette( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
int maxPaletteSize = luaL_checkinteger( L, 2 );
|
||||
|
||||
int colorCount = 0;
|
||||
@@ -664,7 +664,7 @@ Get image alpha border rectangle
|
||||
- Success return Rectangle
|
||||
*/
|
||||
int ltexturesGetImageAlphaBorder( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
float threshold = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushRectangle( L, GetImageAlphaBorder( *image, threshold ) );
|
||||
@@ -680,7 +680,7 @@ Get image pixel color at (x, y) position
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesGetImageColor( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 pixelPos = uluaGetVector2Index( L, 2 );
|
||||
|
||||
uluaPushColor( L, GetImageColor( *image, pixelPos.x, pixelPos.y ) );
|
||||
@@ -698,7 +698,7 @@ int ltexturesGetImageColor( lua_State *L ) {
|
||||
Clear image background with given color
|
||||
*/
|
||||
int ltexturesImageClearBackground( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
|
||||
ImageClearBackground( image, color );
|
||||
@@ -712,7 +712,7 @@ int ltexturesImageClearBackground( lua_State *L ) {
|
||||
Draw pixel within an image
|
||||
*/
|
||||
int ltexturesImageDrawPixel( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
|
||||
@@ -727,7 +727,7 @@ int ltexturesImageDrawPixel( lua_State *L ) {
|
||||
Draw line within an image
|
||||
*/
|
||||
int ltexturesImageDrawLine( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 start = uluaGetVector2Index( L, 2 );
|
||||
Vector2 end = uluaGetVector2Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
@@ -743,7 +743,7 @@ int ltexturesImageDrawLine( lua_State *L ) {
|
||||
Draw circle within an image
|
||||
*/
|
||||
int ltexturesImageDrawCircle( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 center = uluaGetVector2Index( L, 2 );
|
||||
int radius = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
@@ -759,7 +759,7 @@ int ltexturesImageDrawCircle( lua_State *L ) {
|
||||
Draw circle outline within an image
|
||||
*/
|
||||
int ltexturesImageDrawCircleLines( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 center = uluaGetVector2Index( L, 2 );
|
||||
int radius = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
@@ -775,7 +775,7 @@ int ltexturesImageDrawCircleLines( lua_State *L ) {
|
||||
Draw rectangle within an image
|
||||
*/
|
||||
int ltexturesImageDrawRectangle( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
|
||||
@@ -790,7 +790,7 @@ int ltexturesImageDrawRectangle( lua_State *L ) {
|
||||
Draw rectangle lines within an image
|
||||
*/
|
||||
int ltexturesImageDrawRectangleLines( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
int thick = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
@@ -806,8 +806,8 @@ int ltexturesImageDrawRectangleLines( lua_State *L ) {
|
||||
Draw a source image within a destination image (Tint applied to source)
|
||||
*/
|
||||
int ltexturesImageDraw( lua_State *L ) {
|
||||
Image *imageDstId = luaL_checkudata( L, 1, "Image" );
|
||||
Image *imageSrcId = luaL_checkudata( L, 2, "Image" );
|
||||
Image *imageDstId = uluaGetImage( L, 1 );
|
||||
Image *imageSrcId = uluaGetImage( L, 2 );
|
||||
Rectangle srcRec = uluaGetRectangleIndex( L, 3 );
|
||||
Rectangle dstRec = uluaGetRectangleIndex( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
@@ -823,8 +823,8 @@ int ltexturesImageDraw( lua_State *L ) {
|
||||
Draw text (Custom sprite font) within an image (Destination)
|
||||
*/
|
||||
int ltexturesImageDrawTextEx( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Font *font = luaL_checkudata( L, 2, "Font" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Font *font = uluaGetFont( L, 2 );
|
||||
Vector2 position = uluaGetVector2Index( L, 4 );
|
||||
float fontSize = luaL_checknumber( L, 5 );
|
||||
float spacing = luaL_checknumber( L, 6 );
|
||||
@@ -847,7 +847,7 @@ Get image size
|
||||
- Success return Vector2
|
||||
*/
|
||||
int ltexturesGetImageSize( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
uluaPushVector2( L, (Vector2){ image->width, image->height } );
|
||||
|
||||
@@ -862,7 +862,7 @@ Get image mipmaps. Mipmap levels, 1 by default
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesGetImageMipmaps( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
lua_pushinteger( L, image->mipmaps );
|
||||
|
||||
@@ -877,7 +877,7 @@ Get image data format (PixelFormat type)
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesGetImageFormat( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
lua_pushinteger( L, image->format );
|
||||
|
||||
@@ -916,7 +916,7 @@ Load texture from image data
|
||||
- Success return Texture
|
||||
*/
|
||||
int ltexturesLoadTextureFromImage( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
|
||||
uluaPushTexture( L, LoadTextureFromImage( *image ) );
|
||||
|
||||
@@ -931,7 +931,7 @@ Load cubemap from image, multiple image cubemap layouts supported
|
||||
- Success return Texture
|
||||
*/
|
||||
int ltexturesLoadTextureCubemap( lua_State *L ) {
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
int layout = luaL_checkinteger( L, 2 );
|
||||
|
||||
uluaPushTexture( L, LoadTextureCubemap( *image, layout ) );
|
||||
@@ -949,7 +949,7 @@ Load Texture from data
|
||||
int ltexturesLoadTextureFromData( lua_State *L ) {
|
||||
luaL_checktype( L, 1, LUA_TTABLE );
|
||||
|
||||
Texture2D texture = { 0 };
|
||||
Texture texture = { 0 };
|
||||
|
||||
int t = 1;
|
||||
lua_pushnil( L );
|
||||
@@ -1012,11 +1012,11 @@ int ltexturesLoadRenderTextureFromData( lua_State *L ) {
|
||||
renTexture.id = (unsigned int)luaL_checkinteger( L, -1 );
|
||||
}
|
||||
else if ( strcmp( "texture", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
Texture *texture = luaL_checkudata( L, -1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, -1 );
|
||||
renTexture.texture = *texture;
|
||||
}
|
||||
else if ( strcmp( "depth", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
Texture *depth = luaL_checkudata( L, -1, "Texture" );
|
||||
Texture *depth = uluaGetTexture( L, -1 );
|
||||
renTexture.depth = *depth;
|
||||
}
|
||||
lua_pop( L, 1 );
|
||||
@@ -1026,7 +1026,6 @@ int ltexturesLoadRenderTextureFromData( lua_State *L ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
> isReady = RL.IsTextureReady( Texture texture )
|
||||
|
||||
@@ -1035,7 +1034,7 @@ Check if a texture is ready
|
||||
- Success return bool
|
||||
*/
|
||||
int ltexturesIsTextureReady( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
lua_pushboolean( L, IsTextureReady( *texture ) );
|
||||
|
||||
@@ -1049,7 +1048,7 @@ Update GPU texture with new data
|
||||
NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel format
|
||||
*/
|
||||
int ltexturesUpdateTexture( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
size_t len = uluaGetTableLenIndex( L, 2 );
|
||||
|
||||
unsigned char *pixels = malloc( len * 4 * sizeof( unsigned char ) );
|
||||
@@ -1087,7 +1086,7 @@ Update GPU texture rectangle with new data
|
||||
NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 255, 255 }... } depending on the pixel format
|
||||
*/
|
||||
int ltexturesUpdateTextureRec( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
size_t len = uluaGetTableLenIndex( L, 3 );
|
||||
|
||||
@@ -1131,7 +1130,7 @@ int ltexturesUpdateTextureRec( lua_State *L ) {
|
||||
Draw a Texture2D
|
||||
*/
|
||||
int ltexturesDrawTexture( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
|
||||
@@ -1145,7 +1144,7 @@ int ltexturesDrawTexture( lua_State *L ) {
|
||||
Draw a part of a texture defined by a rectangle
|
||||
*/
|
||||
int ltexturesDrawTextureRec( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle srcRect = uluaGetRectangleIndex( L, 2 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 3 );
|
||||
Color tint = uluaGetColorIndex( L, 4 );
|
||||
@@ -1160,7 +1159,7 @@ int ltexturesDrawTextureRec( lua_State *L ) {
|
||||
Draw a part of a texture defined by a rectangle with "pro" parameters
|
||||
*/
|
||||
int ltexturesDrawTexturePro( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle srcRect = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle dstRect = uluaGetRectangleIndex( L, 3 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 4 );
|
||||
@@ -1178,7 +1177,7 @@ int ltexturesDrawTexturePro( lua_State *L ) {
|
||||
Draws a texture (or part of it) that stretches or shrinks nicely
|
||||
*/
|
||||
int ltexturesDrawTextureNPatch( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
NPatchInfo nPatchInfo = uluaGetNPatchInfoIndex( L, 2 );
|
||||
Rectangle dest = uluaGetRectangleIndex( L, 3 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 4 );
|
||||
@@ -1196,7 +1195,7 @@ int ltexturesDrawTextureNPatch( lua_State *L ) {
|
||||
Begin drawing to render texture
|
||||
*/
|
||||
int ltexturesBeginTextureMode( lua_State *L ) {
|
||||
RenderTexture *renderTexture = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
RenderTexture *renderTexture = uluaGetRenderTexture( L, 1 );
|
||||
|
||||
BeginTextureMode( *renderTexture );
|
||||
|
||||
@@ -1224,7 +1223,7 @@ int ltexturesEndTextureMode( lua_State *L ) {
|
||||
Generate GPU mipmaps for a texture
|
||||
*/
|
||||
int ltexturesGenTextureMipmaps( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
GenTextureMipmaps( texture );
|
||||
|
||||
@@ -1237,7 +1236,7 @@ int ltexturesGenTextureMipmaps( lua_State *L ) {
|
||||
Set texture scaling filter mode (TEXTURE_FILTER_POINT, TEXTURE_FILTER_BILINEAR...)
|
||||
*/
|
||||
int ltexturesSetTextureFilter( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
int filter = luaL_checkinteger( L, 2 );
|
||||
|
||||
SetTextureFilter( *texture, filter );
|
||||
@@ -1251,7 +1250,7 @@ int ltexturesSetTextureFilter( lua_State *L ) {
|
||||
Set texture wrapping mode (TEXTURE_WRAP_REPEAT, TEXTURE_WRAP_CLAMP...)
|
||||
*/
|
||||
int ltexturesSetTextureWrap( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
int wrap = luaL_checkinteger( L, 2 );
|
||||
|
||||
SetTextureWrap( *texture, wrap );
|
||||
@@ -1267,7 +1266,7 @@ Get OpenGL texture id
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesGetTextureId( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
lua_pushinteger( L, texture->id );
|
||||
|
||||
@@ -1282,7 +1281,7 @@ Get texture size
|
||||
- Success return Vector2
|
||||
*/
|
||||
int ltexturesGetTextureSize( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
uluaPushVector2( L, (Vector2){ texture->width, texture->height } );
|
||||
|
||||
@@ -1297,7 +1296,7 @@ Get texture mipmaps. Mipmap levels, 1 by default
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesGetTextureMipmaps( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
lua_pushinteger( L, texture->mipmaps );
|
||||
|
||||
@@ -1312,7 +1311,7 @@ Get texture data format (PixelFormat type)
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesGetTextureFormat( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
|
||||
lua_pushinteger( L, texture->format );
|
||||
|
||||
@@ -1331,7 +1330,7 @@ Get OpenGL framebuffer object id
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesGetRenderTextureId( lua_State *L ) {
|
||||
RenderTexture *renderTexture = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
RenderTexture *renderTexture = uluaGetRenderTexture( L, 1 );
|
||||
|
||||
lua_pushinteger( L, renderTexture->id );
|
||||
|
||||
@@ -1341,14 +1340,14 @@ int ltexturesGetRenderTextureId( lua_State *L ) {
|
||||
/*
|
||||
> texture = RL.GetRenderTextureTexture( RenderTexture renderTexture )
|
||||
|
||||
Get color buffer attachment texture
|
||||
Get color buffer attachment texture. Returns as lightuserdata
|
||||
|
||||
- Success return Texture
|
||||
*/
|
||||
int ltexturesGetRenderTextureTexture( lua_State *L ) {
|
||||
RenderTexture *renderTexture = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
RenderTexture *renderTexture = uluaGetRenderTexture( L, 1 );
|
||||
|
||||
uluaPushTexture( L, renderTexture->texture );
|
||||
lua_pushlightuserdata( L, &renderTexture->texture );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1356,14 +1355,14 @@ int ltexturesGetRenderTextureTexture( lua_State *L ) {
|
||||
/*
|
||||
> texture = RL.GetRenderTextureDepthTexture( RenderTexture renderTexture )
|
||||
|
||||
Get depth buffer attachment texture
|
||||
Get depth buffer attachment texture. Returns as lightuserdata
|
||||
|
||||
- Success return Texture
|
||||
*/
|
||||
int ltexturesGetRenderTextureDepthTexture( lua_State *L ) {
|
||||
RenderTexture *renderTexture = luaL_checkudata( L, 1, "RenderTexture" );
|
||||
RenderTexture *renderTexture = uluaGetRenderTexture( L, 1 );
|
||||
|
||||
uluaPushTexture( L, renderTexture->depth );
|
||||
lua_pushlightuserdata( L, &renderTexture->depth );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1569,7 +1568,7 @@ Get pixel color from source texture
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesGetPixelColor( lua_State *L ) {
|
||||
Texture *texture = luaL_checkudata( L, 1, "Texture" );
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Image srcImage = LoadImageFromTexture( *texture );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user