53 lines
1.5 KiB
Text
53 lines
1.5 KiB
Text
-- Stage 3 test: glTF models. The Khronos Duck (textured) twice at different scales, and
|
|
-- BoxAnimated (two meshes, one nested), over the disc.
|
|
local font = fontLoad("Singe/FreeSansBold.ttf", 28)
|
|
local frames = 0
|
|
|
|
fontSelect(font)
|
|
discPlay()
|
|
sceneEnable(true)
|
|
sceneSetBackground(0, 0, 0, 0)
|
|
sceneSetAmbient(60, 60, 70)
|
|
|
|
local duckModel = modelLoad("testScripts/Models/Duck.glb")
|
|
local boxModel = modelLoad("testScripts/Models/BoxAnimated.glb")
|
|
|
|
local duck = modelInstance(duckModel)
|
|
nodeSetPosition(duck, -1.5, -1, 0)
|
|
nodeSetScale(duck, 1.0)
|
|
|
|
local duck2 = modelInstance(duckModel)
|
|
nodeSetPosition(duck2, 1.8, -1, -0.5)
|
|
nodeSetScale(duck2, 0.6)
|
|
nodeSetRotation(duck2, 0, -60, 0)
|
|
|
|
local boxes = modelInstance(boxModel)
|
|
nodeSetPosition(boxes, 0.2, -1, 1.2)
|
|
nodeSetScale(boxes, 0.4)
|
|
|
|
local sun = lightNew(LIGHT_DIRECTIONAL)
|
|
nodeSetPosition(sun, 2, 4, 3)
|
|
nodeLookAt(sun, 0, 0, 0)
|
|
lightSetIntensity(sun, 1.5)
|
|
|
|
local camera = nodeNew()
|
|
nodeSetPosition(camera, 0, 1.2, 5)
|
|
nodeLookAt(camera, 0, 0, 0)
|
|
cameraSet(camera)
|
|
|
|
debugPrint("duck children " .. #nodeGetChildren(duck) .. " boxes children " .. #nodeGetChildren(boxes) .. " box anims " .. #modelGetAnimations(boxModel))
|
|
local inner = nodeFind("inner_box", boxes)
|
|
debugPrint("inner_box " .. tostring(inner))
|
|
|
|
function onOverlayUpdate()
|
|
frames = frames + 1
|
|
nodeRotate(duck, 0, 1.5, 0)
|
|
overlayClear()
|
|
fontPrint(20, 20, "Stage 3, frame " .. frames)
|
|
if frames == 60 then
|
|
singeScreenshot()
|
|
end
|
|
if frames == 80 then
|
|
singeQuit()
|
|
end
|
|
end
|