singe/testScripts/scene5.singe
2026-09-05 19:52:04 -05:00

45 lines
1.1 KiB
Text

-- Stage 5 test: skinning. Three Foxes: Survey, Walk and Run.
local font = fontLoad("Singe/FreeSansBold.ttf", 28)
local frames = 0
fontSelect(font)
discPlay()
sceneEnable(true)
sceneSetBackground(0, 0, 0, 0)
sceneSetAmbient(70, 70, 80)
local foxModel = modelLoad("testScripts/Models/Fox.glb")
local names = modelGetAnimations(foxModel)
debugPrint("fox animations: " .. table.concat(names, ", "))
local foxes = {}
for i, name in ipairs(names) do
local fox = modelInstance(foxModel)
nodeSetPosition(fox, (i - 2) * 2.4, -1, 0)
nodeSetScale(fox, 0.018)
nodeSetRotation(fox, 0, -30, 0)
animationPlay(fox, name, true)
foxes[i] = fox
end
local sun = lightNew(LIGHT_DIRECTIONAL)
nodeSetPosition(sun, 2, 4, 3)
nodeLookAt(sun, 0, 0, 0)
lightSetIntensity(sun, 1.4)
local camera = nodeNew()
nodeSetPosition(camera, 0, 1.2, 6)
nodeLookAt(camera, 0, 0, 0)
cameraSet(camera)
function onOverlayUpdate()
frames = frames + 1
overlayClear()
fontPrint(20, 20, "Stage 5, frame " .. frames)
if frames == 40 or frames == 70 then
singeScreenshot()
end
if frames == 80 then
singeQuit()
end
end