consoleShowcase.module
This package holds more than this page lists. See all of its files in its world.
README.md
consoleShowcase
The cartridge shelf's console stage (stations.cartlib opens it). Every console the shelf offers stands on a lit stage of its own, far below the room on the private consoleshowcase render layer: a dark glossy floor that mirrors what stands on it (a mirrored copy under a translucent floor), a soft key spot with shadows, a cool rim and a warm fill. One isolated camera draws the whole carousel (the focused console large in the middle, neighbours smaller and further back) into a texture the shelf shows in a viewport widget.
Models come from stations.consoleRegistry (one entry per console id: builder, true size, framing). A console without a model yet stands there as a clean silhouette of its true proportions with a thin amber seam.
local Show = require("stations.consoleShowcase")
local guid = Show.open({ "nes", "megadrive", "snes" }, 1, 900, 420) -- ids, focus index, logical size
Show.setFocus(2) -- carousel eases there (critically damped spring)
Show.turn(dx, dy, vx?, vy?) -- drag the focused console (radians); vx/vy = speed it carries on with
Show.release(vx, vy) -- let go: inertia, then it eases back into the slow idle turn after ~3 s
Show.zoomBy(d) -- 1 .. 1.6x, springs back with the idle turn
Show.setRate(fps) -- 60 on the stage, less behind the cartridge list
Show.resize(w, h) -> guid -- the texture may change on resize
Show.close()
Cost: the stage exists only while the shelf is open; the camera is disabled and drawn by hand (Camera:render) at the set rate into a texture capped at 1280 x 720 (pixel ratio capped at 1.5). Consoles further than 2.6 slots from the focus are parked out of view and not built until they come near.
Test hooks: state(), isPlaceholder(i), focus(), texture().