core
What every part of Painted Valley shares: the field's maps baked on the GPU (tHeight with the slope, tMap), the noise (exact port of lib/noise.js), the shared light and fog uniforms with the original's names, and a registry that pushes them and binds the shared textures into ever…
paintedValley.core.core
What every part of Painted Valley shares: the field's maps baked on the GPU (tHeight with the slope, tMap), the noise (exact port of lib/noise.js), the shared light and fog uniforms with the original's names, and a registry that pushes them and binds the shared textures into every valley material (core.material / core.register / core.set / core.setTexture / core.groundAt / core.bake). Called by the Valley driver and every part.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2paintedValley.core — what every part of the valley shares: the land, the field's maps, its light. The port of Painted Valley's createField (lib/index.js) shared uniforms, lib/noise.js and the bake in lib/bake.js and main.js (blendi/painted-valley on Patch, MIT). Every valley material is made with core.material (or registered with core.register): core pushes the shared values and binds the shared textures into it now and on every change, the way every ShaderMaterial in the original binds the same uniform objects. local core = require("paintedValley.core.core") local mat = core.material("paintedValley.meadow.blades", { key = "pv_meadow_blades", render = { cull = "none" } }) core.set("uWalker", { x, z, 0.72, len }) core.setTexture("tFloor", handle) core.onReady(function() ... core.groundAt(x, z) ... end)
vec(t: any) → any
| arg | type | description |
|---|---|---|
| t | any |
normalize3(a: { number }) → void
| arg | type | description |
|---|---|---|
| a | { number } |
texRef(t: any) → any
| arg | type | description |
|---|---|---|
| t | any |
push(key: any, name: string, value: any) → void
| arg | type | description |
|---|---|---|
| key | any | |
| name | string | |
| value | any |
declaredSlots(handle: any) → void
Which texture slots a material's shader declares, read off the material itself (no asset lookup, so a component requiring core stays publishable). nil while the shader has not loaded its vocabulary yet.
| arg | type | description |
|---|---|---|
| handle | any |
bindTexture(key: any, name: string, tex: any) → void
| arg | type | description |
|---|---|---|
| key | any | |
| name | string | |
| tex | any |
set(name: string, value: any) → void
Set one shared uniform everywhere. Vectors as arrays {a, b, c} (or {x=,y=,z=} / {r=,g=,b=}).
| arg | type | description |
|---|---|---|
| name | string | |
| value | any |
setMany(values: { [string]: any }) → void
| arg | type | description |
|---|---|---|
| values | { [string]: any } |
setTexture(name: string, tex: any) → void
Provide or replace a shared texture (a TextureHandle, a storage-texture handle, or a key/guid).
| arg | type | description |
|---|---|---|
| name | string | |
| tex | any |
bindAll(key: any) → void
| arg | type | description |
|---|---|---|
| key | any |
register(handle: any) → void
Register a material (handle or registry key) so it receives the shared values and textures. Textures are bound into the slots its shader declares, once the shader has loaded (a few frames for a new one).
| arg | type | description |
|---|---|---|
| handle | any |
unregister(handle: any) → void
| arg | type | description |
|---|---|---|
| handle | any |
material(shader: string, opts: any?) → void
renderer.material.create + register. opts = { key?, render?, properties?, textures? }.
| arg | type | description |
|---|---|---|
| shader | string | |
| opts | any? |
mulberry(seed: number) → void
mulberry32, as lib/noise.js.
| arg | type | description |
|---|---|---|
| seed | number |
round32(v: number) → number
| arg | type | description |
|---|---|---|
| v | number |
fade(t: number) → number
| arg | type | description |
|---|---|---|
| t | number |
smoothFields(size: number, seed: number, yieldEvery: number?) → void
Four smooth tiling fields (fbm, 5 octaves) of `size`², each normalised to 0..1: lib/noise.js smoothNoiseTexture's values before they are quantised. Returns an array of four arrays (row-major, x + y * size).
| arg | type | description |
|---|---|---|
| size | number | |
| seed | number | |
| yieldEvery | number? |
encodeTexture(rgba: buffer, w: number, h: number, opts: any) → any
| arg | type | description |
|---|---|---|
| rgba | buffer | |
| w | number | |
| h | number | |
| opts | any |
makeNoise(seed: number) → void
tNoise (8 bits, mipmapped), tNoiseHi (16 bits, no mipmaps), both from smoothNoiseTexture(256, seed * 13 + 1); and tWhite (whiteNoiseTexture(256, seed * 7 + 2), nearest) — createField({ seed: 3 }).
| arg | type | description |
|---|---|---|
| seed | number |
pixel(r: number, g: number, b: number, a: number, name: string) → any
| arg | type | description |
|---|---|---|
| r | number | |
| g | number | |
| b | number | |
| a | number | |
| name | string |
groundAt(x: number, z: number) → number
The ground's height at (x, z), exactly where the grass stands on it: bilinear between the baked texel centres, as field.heightAt in the original and groundAt in the shaders. Falls back to the land itself before the bake.
| arg | type | description |
|---|---|---|
| x | number | |
| z | number |
onReady(fn: () → void
| arg | type | description |
|---|---|---|
| fn | ( |
isReady( ) → boolean
waitReady(ref: any) → void
| arg | type | description |
|---|---|---|
| ref | any |
bake( ) → void
Bakes the field's maps on this peer (once a session) and makes the shared noise. Yields; run in a task. A second caller while it runs waits for the first; a failure is raised to every caller and can be retried.
bakeBody( ) → void
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.