diff options
| author | jussi | 2024-09-25 20:54:32 +0300 |
|---|---|---|
| committer | jussi | 2024-09-25 20:54:32 +0300 |
| commit | 45e11be96a7503a0cfe29bbbcc8d885d81ab9591 (patch) | |
| tree | bcd06238db0d83c62f117acca4f8d2d321c31e6a /src | |
| parent | cd6471d339c394a37a1d46119818e0cabdcf5b42 (diff) | |
| download | reilua-enhanced-45e11be96a7503a0cfe29bbbcc8d885d81ab9591.tar.gz reilua-enhanced-45e11be96a7503a0cfe29bbbcc8d885d81ab9591.tar.bz2 reilua-enhanced-45e11be96a7503a0cfe29bbbcc8d885d81ab9591.zip | |
UnloadMaterial can also optionally free textures and shader.
Diffstat (limited to 'src')
| -rw-r--r-- | src/models.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/models.c b/src/models.c index 579cf44..0466812 100644 --- a/src/models.c +++ b/src/models.c @@ -605,7 +605,7 @@ int lmodelsIsModelReady( lua_State* L ) { /* > RL.UnloadModel( Model model ) -Unload model (including meshes) from memory (RAM and/or VRAM) +Unload model (meshes/materials) from memory (RAM and/or VRAM) */ int lmodelsUnloadModel( lua_State* L ) { Model* model = uluaGetModel( L, 1 ); @@ -1951,19 +1951,23 @@ int lmodelsIsMaterialReady( lua_State* L ) { } /* -> RL.UnloadMaterial( Material material ) +> RL.UnloadMaterial( Material material, bool freeAll ) -Unload material from GPU memory (VRAM) +Unload material from GPU memory (VRAM). Note! Use freeAll to unload shaders and textures */ int lmodelsUnloadMaterial( lua_State* L ) { Material* material = uluaGetMaterial( L, 1 ); + bool freeAll = lua_toboolean( L, 2 ); - /* Custom UnloadMaterial since we don't want to free Shaders or Textures. */ - unloadMaterial( material ); + if ( freeAll ) { + UnloadMaterial( *material ); + } + /* Custom UnloadMaterial if we don't want to free Shaders or Textures. */ + else { + unloadMaterial( material ); + } memset( material, 0, sizeof( Material ) ); - // UnloadMaterial( *material ); - return 0; } |
