diff options
| author | jussi | 2025-05-24 23:56:42 +0300 |
|---|---|---|
| committer | jussi | 2025-05-24 23:56:42 +0300 |
| commit | e26bb8603c5a4053f2790fc7d6ce02b3179f5289 (patch) | |
| tree | 5d6bcc991663b0b60fc5a38179104954892b1286 /src/models.c | |
| parent | 913b8f882031893f926b6aba89ec4456cb39a2c0 (diff) | |
| download | reilua-enhanced-e26bb8603c5a4053f2790fc7d6ce02b3179f5289.tar.gz reilua-enhanced-e26bb8603c5a4053f2790fc7d6ce02b3179f5289.tar.bz2 reilua-enhanced-e26bb8603c5a4053f2790fc7d6ce02b3179f5289.zip | |
RL.load and RL.unload functions for memory leak debugging. SoundAlias garbage collection.
Diffstat (limited to 'src/models.c')
| -rw-r--r-- | src/models.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/models.c b/src/models.c index cd58e4e..cee92bc 100644 --- a/src/models.c +++ b/src/models.c @@ -512,8 +512,7 @@ Unload model (meshes/materials) from memory (RAM and/or VRAM) int lmodelsUnloadModel( lua_State* L ) { Model* model = uluaGetModel( L, 1 ); - UnloadModel( *model ); - memset( model, 0, sizeof( Model ) ); + uluaUnloadModel( model ); return 0; } @@ -1125,8 +1124,7 @@ Unload mesh data from CPU and GPU int lmodelsUnloadMesh( lua_State* L ) { Mesh* mesh = uluaGetMesh( L, 1 ); - UnloadMesh( *mesh ); - memset( mesh, 0, sizeof( Mesh ) ); + uluaUnloadMesh( mesh ); return 0; } @@ -1910,14 +1908,7 @@ int lmodelsUnloadMaterial( lua_State* L ) { Material* material = uluaGetMaterial( L, 1 ); bool freeAll = lua_toboolean( L, 2 ); - if ( freeAll ) { - UnloadMaterial( *material ); - } - /* Custom UnloadMaterial if we don't want to free Shaders or Textures. */ - else { - unloadMaterial( material ); - } - memset( material, 0, sizeof( Material ) ); + uluaUnloadMaterial( material, freeAll ); return 0; } @@ -2164,8 +2155,7 @@ Unload animation data int lmodelsUnloadModelAnimation( lua_State* L ) { ModelAnimation* animation = uluaGetModelAnimation( L, 1 ); - UnloadModelAnimation( *animation ); - memset( animation, 0, sizeof( ModelAnimation ) ); + uluaUnloadModelAnimation( animation ); return 0; } @@ -2182,8 +2172,7 @@ int lmodelsUnloadModelAnimations( lua_State* L ) { while ( lua_next( L, t ) != 0 ) { if ( lua_isuserdata( L, -1 ) ) { ModelAnimation* animation = uluaGetModelAnimation( L, lua_gettop( L ) ); - UnloadModelAnimation( *animation ); - memset( animation, 0, sizeof( ModelAnimation ) ); + uluaUnloadModelAnimation( animation ); } i++; lua_pop( L, 1 ); |
