48 lines
1.3 KiB
Text
48 lines
1.3 KiB
Text
-- Dragon model test: the solid tangram dragon built by util/dragonModel.py and converted to glTF
|
|
-- by util/objToGlb.py, turning slowly under a sun with shadows, over the disc.
|
|
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 dragonModel = modelLoad("testScripts/Models/DragonModel.glb")
|
|
local dragon = modelInstance(dragonModel)
|
|
nodeSetPosition(dragon, 0, -3.5, 0)
|
|
nodeSetRotation(dragon, 0, 35, 0)
|
|
|
|
local stone = materialNew()
|
|
materialSetColor(stone, 120, 120, 130)
|
|
materialSetRoughness(stone, 0.9)
|
|
local floor = nodeNew()
|
|
nodeSetMesh(floor, meshBox(14, 0.2, 10), stone)
|
|
nodeSetPosition(floor, 0, -3.6, 0)
|
|
|
|
local sun = lightNew(LIGHT_DIRECTIONAL)
|
|
nodeSetPosition(sun, -4, 8, 6)
|
|
nodeLookAt(sun, 0, 0, 0)
|
|
lightSetIntensity(sun, 1.6)
|
|
lightSetShadow(sun, true)
|
|
|
|
local camera = nodeNew()
|
|
nodeSetPosition(camera, 0, 1.5, 12)
|
|
nodeLookAt(camera, 0, 0, 0)
|
|
cameraSet(camera)
|
|
|
|
debugPrint("dragon parts " .. #nodeGetChildren(dragon))
|
|
|
|
function onOverlayUpdate()
|
|
frames = frames + 1
|
|
nodeRotate(dragon, 0, 0.75, 0)
|
|
overlayClear()
|
|
fontPrint(20, 20, "Dragon model, frame " .. frames)
|
|
if frames == 30 or frames == 100 or frames == 170 then
|
|
singeScreenshot()
|
|
end
|
|
if frames == 180 then
|
|
singeQuit()
|
|
end
|
|
end
|