buildings
Port of Painted Valley's src/valley/village.js (blendi/painted-valley, MIT): the shapes of the village's buildings (eight kinds), layVillage / layFarm, and drawing them with the building material (building.shader) through renderer.mesh.drawInstanced.
buildings
Port of Painted Valley's src/valley/village.js (blendi/painted-valley, MIT): the shapes of the village's buildings (eight kinds), layVillage / layFarm, and drawing them with the building material (building.shader) through renderer.mesh.drawInstanced.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2native
mulberry(seed: number, skip: number?) → void
mulberry32(seed), advanced `skip` draws (its state is a counter, so skipping is one multiply).
| arg | type | description |
|---|---|---|
| seed | number | |
| skip | number? |
cylinder(radiusTop: number, radiusBottom: number, height: number, radialSegments: number, heightSegments: number, openEnded: boolean) → void
CylinderGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded), as triangle soup: { positions, normals } in the order toNonIndexed() gives.
| arg | type | description |
|---|---|---|
| radiusTop | number | |
| radiusBottom | number | |
| height | number | |
| radialSegments | number | |
| heightSegments | number | |
| openEnded | boolean |
cap(top: boolean) → void
| arg | type | description |
|---|---|---|
| top | boolean |
sphere(radius: number, widthSegments: number, heightSegments: number, phiStart: number, phiLength: number, thetaStart: number, thetaLength: number) → void
SphereGeometry(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength), unindexed.
| arg | type | description |
|---|---|---|
| radius | number | |
| widthSegments | number | |
| heightSegments | number | |
| phiStart | number | |
| phiLength | number | |
| thetaStart | number | |
| thetaLength | number |
translate(g: any, x: number, y: number, z: number) → void
| arg | type | description |
|---|---|---|
| g | any | |
| x | number | |
| y | number | |
| z | number |
P(x: number, y: number, z: number, u: number, r: number?, hl: number?) → Corner
A corner: where it is, how far up the wall (or the roof), and along the wall from its middle with half the wall's length.
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number | |
| u | number | |
| r | number? | |
| hl | number? |
shell( ) → void
Collects flat-faced pieces of a building. A corner is a point with `u`: how far up the wall it is.
tri(a: Corner, b: Corner, c: Corner, p: number) → void
| arg | type | description |
|---|---|---|
| a | Corner | |
| b | Corner | |
| c | Corner | |
| p | number |
quad(a: Corner, b: Corner, c: Corner, e: Corner, p: number) → void
| arg | type | description |
|---|---|---|
| a | Corner | |
| b | Corner | |
| c | Corner | |
| e | Corner | |
| p | number |
add(g: any, p: number, upAt: (number) → void
A ready-made geometry (a cylinder, a dome): p is wall or roof, upAt gives how far up each point is.
| arg | type | description |
|---|---|---|
| g | any | |
| p | number | |
| upAt | (number |
data( ) → void
walls(m: any, w: number, d: number, h: number, cx: number?, cz: number?) → void
Four walls round (cx, cz), w wide and d long, up to h.
| arg | type | description |
|---|---|---|
| m | any | |
| w | number | |
| d | number | |
| h | number | |
| cx | number? | |
| cz | number? |
gable(m: any, w: number, d: number, h: number, r: number, cx: number?, cz: number?) → void
A pitched roof with gables at both ends, its ridge r above the eaves and running the length of the house.
| arg | type | description |
|---|---|---|
| m | any | |
| w | number | |
| d | number | |
| h | number | |
| r | number | |
| cx | number? | |
| cz | number? |
hip(m: any, w: number, d: number, h: number, r: number, cx: number?, cz: number?) → void
A roof that slopes on all four sides to a short ridge.
| arg | type | description |
|---|---|---|
| m | any | |
| w | number | |
| d | number | |
| h | number | |
| r | number | |
| cx | number? | |
| cz | number? |
cap(m: any, s: number, y0: number, tall: number, cx: number?, cz: number?) → void
A pointed cap on a square tower s across, from y0 up by tall.
| arg | type | description |
|---|---|---|
| m | any | |
| s | number | |
| y0 | number | |
| tall | number | |
| cx | number? | |
| cz | number? |
chimney(m: any, cx: number, cz: number, y0: number, y1: number, s: number?) → void
A chimney: a plain stack s square from y0 up to y1.
| arg | type | description |
|---|---|---|
| m | any | |
| cx | number | |
| cz | number | |
| y0 | number | |
| y1 | number | |
| s | number? |
c(x: number, y: number, z: number) → Corner
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
round(x: number, _y: number, z: number) → void
(round it, a wall has no ends: only how far round you are)
| arg | type | description |
|---|---|---|
| x | number | |
| _y | number | |
| z | number |
make(m: ?) → void
| arg | type | description |
|---|---|---|
| m | ? |
layVillage(random: () → void
Where the village's buildings stand: a tight cluster on its rise, the towers and the tall houses at the top, the cottages and barns round the edge, set along two streets and not every which way. Returns { { x, z, turn, scale, shape, wall, roof } }.
| arg | type | description |
|---|---|---|
| random | ( |
pick(from: { any }) → any
| arg | type | description |
|---|---|---|
| from | { any } |
put(du: number, dv: number, shape: string, scale: number, turn: number, wall: any?, roof: any?) → void
| arg | type | description |
|---|---|---|
| du | number | |
| dv | number | |
| shape | string | |
| scale | number | |
| turn | number | |
| wall | any? | |
| roof | any? |
layFarm(random: () → void
A farmstead at (u, v): a house, a barn bigger than it, a shed.
| arg | type | description |
|---|---|---|
| random | ( |
layAll( ) → void
Every building the original's farwoods.js puts up: layVillage, then a farm at each of FARMS, from the same random stream at the same point in it.
meshFrom(d: any) → any
Packs a shell's attributes into a Zero mesh (uv = aUp, aFace.x; colour = aPart, aFace.y, see the top).
| arg | type | description |
|---|---|---|
| d | any |
shapeData(name: string) → void
The geometry of one kind of building, as the original's shell().build() makes it.
| arg | type | description |
|---|---|---|
| name | string |
compose(x: number, y: number, z: number, turn: number, sx: number, sy: number?, sz: number?) → void
Column-major matrix of compose(position, rotation about y by turn, uniform scale), and that rotation's quaternion.
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number | |
| turn | number | |
| sx | number | |
| sy | number? | |
| sz | number? |
createBuildingMaterial(core: any, key: string?) → void
The building material (the original's createBuildingMaterial): one for every building in the valley.
| arg | type | description |
|---|---|---|
| core | any | |
| key | string? |
drawShells(mesh: any, material: any, items: { any }, name: string, parent: any?) → void
Draws `count` copies of a building mesh with the building material. `items[i]` = { matrix (16, column-major), quat {x,y,z,w}, scale, origin {x,y,z}, roof {r,g,b}, wall {r,g,b} }. Returns a handle with :set(i, item) to move one (the mill's sails) and :destroy(). `parent` (an entity at the origin) stands the copies in its space.
| arg | type | description |
|---|---|---|
| mesh | any | |
| material | any | |
| items | { any } | |
| name | string | |
| parent | any? |
pack(list: { any }) → void
| arg | type | description |
|---|---|---|
| list | { any } |
set(_self: ?, i: number, it: any) → void
| arg | type | description |
|---|---|---|
| _self | ? | |
| i | number | |
| it | any |
destroy(_self: ?) → void
| arg | type | description |
|---|---|---|
| _self | ? |
addBuildingEntities(material: any, list: { any }, parent: any) → void
Puts every building in the list on the ground (the original's addBuildings), each as a local, temporary entity under `parent`: a Model wearing its kind's mesh (made once a kind) and the building material as a session material, with the building's instance lanes set on it. Entities, not instanced draws, because the frame's tag pass (the original's "already painted" alpha, 0.4) finds what it tags by entity. Returns { entities, meshes, destroy() }.
| arg | type | description |
|---|---|---|
| material | any | |
| list | { any } | |
| parent | any |
destroy(_self: ?) → void
| arg | type | description |
|---|---|---|
| _self | ? |
addBuildings(material: any, list: { any }, prefix: string?, parent: any?) → void
Puts every building in the list on the ground, one instanced draw to a kind (the original's addBuildings, drawn the way it draws them; the frame's tag pass does not reach instanced draws, so the valley uses addBuildingEntities).
| arg | type | description |
|---|---|---|
| material | any | |
| list | { any } | |
| prefix | string? | |
| parent | 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.
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.