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

93 lines
3.1 KiB
Text

-- An arcade cabinet built from primitives, with the laserdisc playing on its screen.
local font = fontLoad("Singe/FreeSansBold.ttf", 28)
local frames = 0
fontSelect(font)
discPlay()
sceneEnable(true)
sceneSetBackground(18, 18, 30, 255)
sceneSetAmbient(70, 70, 85)
local black = materialNew()
materialSetColor(black, 25, 25, 28)
materialSetRoughness(black, 0.55)
local trim = materialNew()
materialSetColor(trim, 230, 60, 40)
materialSetRoughness(trim, 0.4)
local panelLook = materialNew()
materialSetColor(panelLook, 40, 40, 60)
materialSetRoughness(panelLook, 0.5)
local screen = materialNew()
materialSetVideo(screen)
materialSetUnlit(screen, true)
local marqueeLook = materialNew()
materialSetColor(marqueeLook, 255, 210, 80)
materialSetEmissive(marqueeLook, 120, 90, 20)
local floorLook = materialNew()
materialSetColor(floorLook, 120, 110, 100)
materialSetRoughness(floorLook, 0.9)
local floor = nodeNew()
nodeSetMesh(floor, meshPlane(12, 12), floorLook)
nodeSetPosition(floor, 0, -1.8, 0)
-- The cabinet: one parent node so the whole thing can be turned.
local cabinet = nodeNew()
nodeSetPosition(cabinet, 0, 0, 0)
nodeSetRotation(cabinet, 0, -28, 0)
local function part(parent, mesh, material, x, y, z, rx, ry, rz)
local n = nodeNew(parent)
nodeSetMesh(n, mesh, material)
nodeSetPosition(n, x, y, z)
nodeSetRotation(n, rx or 0, ry or 0, rz or 0)
return n
end
part(cabinet, meshBox(1.6, 1.4, 1.3), black, 0, -1.1, 0) -- base
part(cabinet, meshBox(1.6, 1.9, 1.0), black, 0, 0.55, -0.15) -- body behind the screen
part(cabinet, meshBox(1.6, 0.5, 1.3), black, 0, 1.75, 0) -- head
part(cabinet, meshBox(1.5, 0.36, 0.05), marqueeLook, 0, 1.75, 0.66) -- marquee
part(cabinet, meshBox(1.6, 0.12, 0.7), panelLook, 0, -0.45, 0.55, -12) -- control panel
part(cabinet, meshCylinder(0.05, 0.28, 16), trim, -0.35, -0.28, 0.55, -12) -- joystick
part(cabinet, meshSphere(0.09, 16), trim, -0.35, -0.13, 0.58) -- joystick ball
part(cabinet, meshCylinder(0.07, 0.04, 16), trim, 0.2, -0.36, 0.5, -12) -- button
part(cabinet, meshCylinder(0.07, 0.04, 16), trim, 0.42, -0.36, 0.5, -12) -- button
part(cabinet, meshBox(0.06, 1.9, 0.08), trim, -0.77, 0.55, 0.38) -- side trim
part(cabinet, meshBox(0.06, 1.9, 0.08), trim, 0.77, 0.55, 0.38)
part(cabinet, meshBox(1.42, 1.1, 0.06), black, 0, 0.6, 0.34, -8) -- bezel
part(cabinet, meshPlane(1.3, 0.98), screen, 0, 0.6, 0.38, 82) -- the screen, tilted back a little
local sun = lightNew(LIGHT_DIRECTIONAL)
nodeSetPosition(sun, -3, 5, 4)
nodeLookAt(sun, 0, 0, 0)
lightSetIntensity(sun, 1.1)
lightSetShadow(sun, true)
local glow = lightNew(LIGHT_POINT)
nodeSetPosition(glow, 0.4, 0.9, 1.2)
lightSetColor(glow, 180, 200, 255)
lightSetIntensity(glow, 3)
lightSetRange(glow, 6)
local camera = nodeNew()
nodeSetPosition(camera, 1.6, 0.9, 4.6)
nodeLookAt(camera, 0, 0.2, 0)
cameraSet(camera)
cameraSetPerspective(45, 0.1, 100)
function onOverlayUpdate()
frames = frames + 1
overlayClear()
if frames == 22 then
singeScreenshot()
end
if frames == 30 then
singeQuit()
end
end