diff options
| author | jussi | 2022-06-01 22:15:46 +0300 |
|---|---|---|
| committer | jussi | 2022-06-01 22:15:46 +0300 |
| commit | b8d2fcd7956e0ca862745a0b8f64317664507574 (patch) | |
| tree | bc9b73e19113e56f458b09bf6ebab3558b98925d /src/textures.c | |
| parent | c106785ae5b446ad9460843ee57f823abacd553f (diff) | |
| download | reilua-enhanced-b8d2fcd7956e0ca862745a0b8f64317664507574.tar.gz reilua-enhanced-b8d2fcd7956e0ca862745a0b8f64317664507574.tar.bz2 reilua-enhanced-b8d2fcd7956e0ca862745a0b8f64317664507574.zip | |
All defines and LoadTextureCubemap.
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/src/textures.c b/src/textures.c index f75a6f2..fe0848b 100644 --- a/src/textures.c +++ b/src/textures.c @@ -1709,28 +1709,29 @@ int ltexturesLoadTextureFromImage( lua_State *L ) { } /* -> success = RL_UnloadTexture( Texture2D texture ) +> texture = RL_LoadTextureCubemap( Image image, int layout ) -Unload texture from GPU memory ( VRAM ) +Load cubemap from image, multiple image cubemap layouts supported -- Failure return false -- Success return true +- Failure return -1 +- Success return int */ -int ltexturesUnloadTexture( lua_State *L ) { - if ( !lua_isnumber( L, -1 ) ) { - TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_UnloadTexture( Texture2D texture )" ); - lua_pushboolean( L, false ); +int ltexturesLoadTextureCubemap( lua_State *L ) { + if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadTextureCubemap( Image image, int layout )" ); + lua_pushinteger( L, -1 ); return 1; } - size_t id = lua_tointeger( L, -1 ); + int layout = lua_tointeger( L, -1 ); + size_t imageId = lua_tointeger( L, -2 ); - if ( !validTexture( id ) ) { + if ( !validImage( imageId ) ) { lua_pushboolean( L, false ); return 1; } - UnloadTexture( *state->textures[ id ] ); - state->textures[ id ] = NULL; - lua_pushboolean( L, true ); + int i = newTexture(); + *state->textures[i] = LoadTextureCubemap( *state->images[ imageId ], layout ); + lua_pushinteger( L, i ); return 1; } @@ -1765,6 +1766,34 @@ int ltexturesLoadRenderTexture( lua_State *L ) { return 1; } + +/* +> success = RL_UnloadTexture( Texture2D texture ) + +Unload texture from GPU memory ( VRAM ) + +- Failure return false +- Success return true +*/ +int ltexturesUnloadTexture( lua_State *L ) { + if ( !lua_isnumber( L, -1 ) ) { + TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_UnloadTexture( Texture2D texture )" ); + lua_pushboolean( L, false ); + return 1; + } + size_t id = lua_tointeger( L, -1 ); + + if ( !validTexture( id ) ) { + lua_pushboolean( L, false ); + return 1; + } + UnloadTexture( *state->textures[ id ] ); + state->textures[ id ] = NULL; + lua_pushboolean( L, true ); + + return 1; +} + /* > success = RL_UnloadRenderTexture( RenderTexture2D target ) |
