sky
The Painted Valley sky part's entry module (valley/sky.js and the sky's part of main.js): the hour table (KEYS, blend, sunAt, SUNSET), build / update / setHour / destroy, the field light pushed into the core, the dome material on a Skybox, the engine sun and ambient, and bindTo f…
sky
The Painted Valley sky part's entry module (valley/sky.js and the sky's part of main.js): the hour table (KEYS, blend, sunAt, SUNSET), build / update / setHour / destroy, the field light pushed into the core, the dome material on a Skybox, the engine sun and ambient, and bindTo for materials that mirror the sky. See ../README.md.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2paintedValley.sky.sky — the sky of Painted Valley and the light that goes with it (valley/sky.js and the sky's part of valley/main.js, blendi/painted-valley on Patch, MIT). The part's entry module. The sky and the light that goes with it, from one number: the hour, from noon to sunset. The dome is a painted gradient, deep blue overhead and pale at the horizon, with the clouds laid over it from their cube map and the far mountains over those; the same colours light the grass, the far land, the clouds and the mountains. Colours are in linear light and meant to be seen as written: the frame's tone curve leaves everything below white alone. Port: createSkyParts / createSky / skyParts.light(hour) / sky.setHour / sky.update are here as build / light / setHour / update. The dome is the skyDome sky-domain shader on a Skybox (an unsynced, temporary entity the part spawns: the engine draws the sky from a Skybox's material). setHour pushes the field light into the core (core.setMany, the values the original hands field.setLight), sets the dome's own uniforms, relights the clouds, and sets the engine's own sun and ambient light to the same light (direction towards the sun; colour * intensity = the original's uSunColor and uSkyColor), so anything the engine lights agrees. The lights are the sky's own unsynced, temporary `paintedValley.sky.sun` / `paintedValley.sky.ambient` entities, written when the hour's light changes. A scene's authored (saved) Light entities are written only when the valley context states `sceneLights = true`, and the engine's light is left alone with `engineLight = false`.
blend(e: number) → void
The hour's colours for a sun `e` degrees up: the two keys either side, mixed.
| arg | type | description |
|---|---|---|
| e | number |
clamp(x: number, a: number, b: number) → number
| arg | type | description |
|---|---|---|
| x | number | |
| a | number | |
| b | number |
sunAt(hour: number) → void
The sun at an hour, 12 to sunset: its direction (towards it, unit) and its degrees above the horizon. It comes down on the left of the way the valley runs and swings round towards it, so by evening it stands low over the mountains.
| arg | type | description |
|---|---|---|
| hour | number |
setProp(key: any, name: string, value: any) → void
| arg | type | description |
|---|---|---|
| key | any | |
| name | string | |
| value | any |
setTex(key: any, name: string, tex: any) → void
| arg | type | description |
|---|---|---|
| key | any | |
| name | string | |
| tex | any |
pushBound(key: any) → void
| arg | type | description |
|---|---|---|
| key | any |
bindTo(key: any) → void
Keep a material of yours up to date with what the sky shares (water.js): uZenith, uMid, uHorizon, uGlow (float3), uCloudFace (float) and the clouds' cube in tClouds. Its shader declares those and includes "paintedValley.sky.skyCommon" for skyAt / cloudsAt.
| arg | type | description |
|---|---|---|
| key | any |
unbind(key: any) → void
| arg | type | description |
|---|---|---|
| key | any |
createSkyParts(options: { [string]: any }?) → void
The sky's two pictures, the clouds and the far mountains, which need nothing from the land: made first, so the graphics card can be painting them while the land is worked out. `light(hour)` paints the clouds for an hour.
| arg | type | description |
|---|---|---|
| options | { [string]: any }? |
light(hour: number) → void
| arg | type | description |
|---|---|---|
| hour | number |
setHour(v: any, hour: number, soft: boolean?) → void
hour: 12 to sunset. `soft` (the driver's `quick`) for a small step, as time passing makes: the clouds then take the new light a strip at a time as they billow, and nothing is drawn again at once. (v: the valley context; v.core when the core is live.)
| arg | type | description |
|---|---|---|
| v | any | |
| hour | number | |
| soft | boolean? |
setEngineLight(dir: { number }, sun: { number }, amb: { number }) → void
The engine's sun and ambient term set to the hour's light: the sun shining along -dir, its colour * intensity the original's uSunColor; the ambient's colour * intensity its uSkyColor. The lights are the sky's own (unsynced, temporary: "paintedValley.sky.sun", "paintedValley.sky.ambient"). With v.sceneLights == true they are the scene's own `sun` (directional) and `ambient` Light entities, found by name, where the scene has them. The lights are written when the light differs from what they were last given: the same hour writes nothing. With v.engineLight == false the sky leaves the engine's light alone.
| arg | type | description |
|---|---|---|
| dir | { number } | |
| sun | { number } | |
| amb | { number } |
sceneLight(name: string, kind: string) → any
The scene's Light of a kind on the entity of that name, if it has one.
| arg | type | description |
|---|---|---|
| name | string | |
| kind | string |
makeLights(v: any) → void
| arg | type | description |
|---|---|---|
| v | any |
makeDome( ) → void
The part
pump( ) → boolean
Advances the bakes the sky still owes (the far country's painting, the clouds' drawAll) by a frame's worth. Returns true while there is more.
ready( ) → boolean
Whether every picture the sky paints is painted.
build(v: any) → void
Make the sky: the clouds' cube and the far country's strip are painted (over the next frames: build yields until they are, when it can), the dome is put up and the hour set (v.hour, else 15.5).
| arg | type | description |
|---|---|---|
| v | any |
update(v: any, dt: number) → void
Every frame, play and edit: the bakes still owed, then the clouds' strip for the frame.
| arg | type | description |
|---|---|---|
| v | any | |
| dt | number |
destroy(v: any) → void
| arg | type | description |
|---|---|---|
| v | any |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.