summaryrefslogtreecommitdiff
path: root/examples/iqm_test
diff options
context:
space:
mode:
authorjussi2023-10-29 13:21:42 +0200
committerjussi2023-10-29 13:21:42 +0200
commit76911d45a879838047b2845cd6124e9ca3af083a (patch)
tree2ff82956451818faaa8956fa2af543fc32646a03 /examples/iqm_test
parentfd49d806cf1f54fb86c3ed7b9db499f473a3ef1d (diff)
downloadreilua-enhanced-76911d45a879838047b2845cd6124e9ca3af083a.tar.gz
reilua-enhanced-76911d45a879838047b2845cd6124e9ca3af083a.tar.bz2
reilua-enhanced-76911d45a879838047b2845cd6124e9ca3af083a.zip
New object types for all types.
Diffstat (limited to 'examples/iqm_test')
-rw-r--r--examples/iqm_test/main.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/iqm_test/main.lua b/examples/iqm_test/main.lua
index e5867a6..229c1c4 100644
--- a/examples/iqm_test/main.lua
+++ b/examples/iqm_test/main.lua
@@ -2,10 +2,10 @@
local monitor = 0
local camera = -1
+local texture = nil
local material = -1
local model = -1
-local animations = -1
-local animationCount = 0
+local animations = {}
local frame = 0
local curAnim = 0
local frameCount = 0
@@ -24,12 +24,14 @@ function RL.init()
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
+ texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" )
+
material = RL.CreateMaterial( {
maps = {
{
RL.MATERIAL_MAP_ALBEDO,
{
- texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" ),
+ texture = texture,
color = RL.WHITE,
},
},
@@ -38,21 +40,19 @@ function RL.init()
model = RL.LoadModel( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
RL.SetModelMaterial( model, 0, material )
- animations, animationCount = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
-
- print( "animationCount", animationCount )
+ animations = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
end
function RL.process( delta )
if RL.IsKeyPressed( RL.KEY_ENTER ) then
curAnim = curAnim + 1
- if animationCount <= curAnim then
+ if #animations <= curAnim then
curAnim = 0
end
frame = 0.0
- frameCount = RL.GetModelAnimationFrameCount( animations, curAnim )
+ frameCount = RL.GetModelAnimationFrameCount( animations[ curAnim + 1 ] )
elseif RL.IsKeyPressed( RL.KEY_UP ) then
animSpeed = animSpeed + 5
elseif RL.IsKeyPressed( RL.KEY_DOWN ) then
@@ -60,7 +60,7 @@ function RL.process( delta )
end
if RL.IsKeyDown( RL.KEY_SPACE ) then
- RL.UpdateModelAnimation( model, animations, curAnim, math.floor( frame ) )
+ RL.UpdateModelAnimation( model, animations[ curAnim + 1 ], math.floor( frame ) )
frame = frame + animSpeed * delta
if frameCount < frame then
@@ -80,7 +80,7 @@ function RL.draw()
RL.DrawModelEx( model, { 0, 0, 0 }, { 1.0, 0.0, 0.0 }, -90.0, { 1.0, 1.0, 1.0 }, RL.WHITE )
RL.EndMode3D()
- RL.DrawText( 0,
+ RL.DrawText( RL.defaultFont,
"Enter: Change animation\
Space: Play animation\
Up arrow: Inreace animation speed\