Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 7f138801-7…

trees

Port of Painted Valley's src/valley/trees.js (blendi/painted-valley, MIT): growTree (with ports of three's CatmullRomCurve3, Frenet frames and IcosahedronGeometry), plant, the near trees, far trees and bushes (createTrees), the leaf-spray texture, and the shade cast onto the grou…

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2d ago
What it does

trees

Port of Painted Valley's src/valley/trees.js (blendi/painted-valley, MIT): growTree (with ports of three's CatmullRomCurve3, Frenet frames and IcosahedronGeometry), plant, the near trees, far trees and bushes (createTrees), the leaf-spray texture, and the shade cast onto the ground (tShade).

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

native

mulberry(seed: number) → void

argtypedescription
seednumber

f32(v: number) → number

argtypedescription
vnumber

hypot3(x: number, y: number, z: number) → number

argtypedescription
xnumber
ynumber
znumber

smoothstep(x: number, lo: number, hi: number) → number

THREE.MathUtils.smoothstep(x, min, max)

argtypedescription
xnumber
lonumber
hinumber

v3(x: number, y: number, z: number) → V

argtypedescription
xnumber
ynumber
znumber

clone(a: V) → V

argtypedescription
aV

addScaled(a: V, b: V, s: number) → V

a += b * s (addScaledVector)

argtypedescription
aV
bV
snumber

add(a: V, b: V) → V

argtypedescription
aV
bV

lerp(a: V, b: V, t: number) → V

argtypedescription
aV
bV
tnumber

normalize(a: V) → V

argtypedescription
aV

cross(a: V, b: V) → V

argtypedescription
aV
bV

scale(a: V, s: number) → V

argtypedescription
aV
snumber

initNonuniform(x0: number, x1: number, x2: number, x3: number, dt0: number, dt1: number, dt2: number) → void

argtypedescription
x0number
x1number
x2number
x3number
dt0number
dt1number
dt2number

dist2(a: V, b: V) → number

argtypedescription
aV
bV

new(points: { V }) → void

argtypedescription
points{ V }

getPoint(t: number) → V

argtypedescription
tnumber

getLengths( ) → void

getLength( ) → number

getUtoTmapping(u: number) → number

argtypedescription
unumber

getTangent(t: number) → V

argtypedescription
tnumber

rotateAxis(v: V, axis: V, angle: number) → void

applyMatrix4(makeRotationAxis(axis, angle)) on v, in place.

argtypedescription
vV
axisV
anglenumber

computeFrenetFrames(segments: number) → void

argtypedescription
segmentsnumber

icosahedron( ) → void

vert(i: number) → V

argtypedescription
inumber

push(p: V) → void

argtypedescription
pV

leafPixels( ) → void

A spray of leaves, white on black, 256 square: red is how light a leaf is painted, green is where there is leaf at all. The original draws it on a canvas (filled quadratic curves, anti-aliased): here each pixel is sampled 4x4 and painted over what is under it by its coverage, as the canvas composites. Returns RGBA bytes, rows bottom to top (three's CanvasTexture flips Y), and the size.

leaf(x: number, y: number, angle: number, len: number) → void

argtypedescription
xnumber
ynumber
anglenumber
lennumber

leafTexture( ) → any

The leaf texture on the GPU: mipmapped, trilinear, anisotropy 4, repeating; linear values (a CanvasTexture has no colour space).

growTree(seed: number, o: any) → void

Grows one tree, standing at the origin. Returns its wood, its leaves and its core (the dark balls under the sprays) as geometry, and how big its crown is, for its shadow. o.trunk height of the bole, o.girth its radius, o.crown the crown's radius, o.rise the crown's height, o.limbs how many, o.clump the radius of a clump of leaves, o.fill clumps added to round the crown out, o.cards leaf sprays to a clump, o.spray the size of one

argtypedescription
seednumber
oany

reach(a: number) → number

argtypedescription
anumber

plant( ) → void

Where the trees stand: { x, z, kind, scale, turn }. Kind 0 is the great tree.

clear(x: number, z: number, gap: number) → boolean

argtypedescription
xnumber
znumber
gapnumber

copse(u: number, v: number, n: number, spread: number) → void

A copse: n trees packed round (u, v) so their crowns run together into one mass, longer one way than the other, big trees in its middle and small ones at its edge.

argtypedescription
unumber
vnumber
nnumber
spreadnumber

lone(u: number, v: number) → void

One big tree standing alone.

argtypedescription
unumber
vnumber

grow(cardsShare: number?) → void

The kinds of tree and bush, and every one of them planted: { kinds, trees, BUSH }. options.cards 0 to 1, the share of leaf sprays drawn.

argtypedescription
cardsSharenumber?

bush(x: number, z: number, sc: number) → void

argtypedescription
xnumber
znumber
scnumber

indices(n: number) → void

argtypedescription
nnumber

randColors(r: { number }) → void

argtypedescription
r{ number }

meshes(kind: any) → void

argtypedescription
kindany

castInto(data: buffer, kinds: { any }, trees: { any }, BUSH: number, sunDir: { number }, extentMin: { number }, extent: number, stride: number?) → void

Lays every crown's shadow on the ground for this sun, into `data` (RES*RES texels of `stride` bytes, the shade in the first, row j at z). The original's trees.cast. Yields now and then where it can, so a cast at sunset (long shadows) does not hold a frame up.

argtypedescription
databuffer
kinds{ any }
trees{ any }
BUSHnumber
sunDir{ number }
extentMin{ number }
extentnumber
stridenumber?

bindTexture(key: string, slot: string, tex: any) → void

argtypedescription
keystring
slotstring
texany

createTrees(core: any, options: any?) → void

The original's createTrees(field, { cards }): every tree and bush drawn, one kind to a draw for each of wood, core and sprays, and their shade cast onto the ground as tShade (core.setTexture). Returns { trees, kinds, BUSH, shade (texture), cast(sunDir), destroy() }. options.cards 0 to 1, the share of leaf sprays.

argtypedescription
coreany
optionsany?

bindOwn( ) → void

draw(mesh: any, material: any) → void

argtypedescription
meshany
materialany

upload( ) → void

cast(sunDir: any) → void

Lays every crown's shadow on the ground for this sun. Call when the hour changes. sunDir = {x, y, z} (or .x/.y/.z).

argtypedescription
sunDirany

destroy( ) → 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.

7items
▣
module · born here
❒asset
# paintedValley.world The land of Painted Valley (port of blendi/painted-valley src/valley/world.js, MIT): heightAt, land, paint/paintAt, pathDistance, tarnDistance, riverDistance, fieldsAt, forestAt, fbm, ridged and the valley's fixed places (HERO, START, TREE, VILLAGE, TARN). Bit-exact with the original (integer hash included). Every part uses it for CPU placement; the GPU twin is paintedValley.core.valleyLand.
▲ 0↑ born
backing path · paintedValley/village/trees.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ 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".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.