diff options
| author | jussi | 2023-12-08 22:40:04 +0200 |
|---|---|---|
| committer | jussi | 2023-12-08 22:40:04 +0200 |
| commit | 93b5b2eb37813dd854727c50626131d2631065aa (patch) | |
| tree | e7143833210857cde903a0718be51d00675cc712 /examples/iqm_test/main.lua | |
| parent | eb7873be2be3d0ac4808c7416b190888a0e94145 (diff) | |
| download | reilua-enhanced-93b5b2eb37813dd854727c50626131d2631065aa.tar.gz reilua-enhanced-93b5b2eb37813dd854727c50626131d2631065aa.tar.bz2 reilua-enhanced-93b5b2eb37813dd854727c50626131d2631065aa.zip | |
More Model animations management functions.
Diffstat (limited to 'examples/iqm_test/main.lua')
| -rw-r--r-- | examples/iqm_test/main.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/examples/iqm_test/main.lua b/examples/iqm_test/main.lua index ef1549c..f5c0d49 100644 --- a/examples/iqm_test/main.lua +++ b/examples/iqm_test/main.lua @@ -24,6 +24,10 @@ function RL.init() RL.SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } ) + RL.SetTextLineSpacing( 26 ) + -- If custom material or mesh is set to model, we need to use custom unloading to prevent double free errors. + RL.SetGCUnload( false ) + texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" ) material = RL.CreateMaterial( { @@ -37,8 +41,10 @@ function RL.init() }, }, } ) - model = RL.LoadModel( RL.GetBasePath().."../resources/iqm/monkey.iqm" ) + -- Unload old material. + RL.UnloadMaterial( RL.GetModelMaterial( model, 0 ) ) + RL.SetModelMaterial( model, 0, material ) animations = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" ) end @@ -85,5 +91,12 @@ function RL.draw() Space: Play animation\ Up arrow: Inreace animation speed\ Down arrow: Decreace animation speed", - { 10, 10 }, 30, RL.WHITE ) + { 10, 10 }, 30, RL.WHITE + ) +end + +function RL.exit() + RL.UnloadTexture( texture ) + RL.UnloadModel( model ) + RL.UnloadModelAnimations( animations ) end |
