Namespace in reactor_3d_world.js
Reactor3D.MapScene
31 public functions in 3 groups · show internal (_) functions
Quick Reference
Actions 10
| addRockChunk() | Lay a chunk's meshed rock faces into the scene. |
| addPieceChunkMesh() | One chunk's mesh of one material (and its ghost for the cut), laid in the pieces group. |
| clear() | Clear. |
| addPieces() | Lay every piece down, cast into the static shadow rows. |
| addWaterHaze() | Hang the haze over a sheet just laid (mesh): its layers stand with the lights' glowing bodies, share the shee… |
| removeWaterHaze() | Take the sheets' haze and what they give the halo down (the water laid again); the surface is the sheet's own… |
| runFollowUp() | The next work kept by followUp (one that fails is told of and passed over). |
| addWater() | The water sheets: one waving translucent surface per sheet, in the world's own pass. |
| addFalls() | A river's waterfalls: a curtain down each, foam where it lands, and spray and mist rising there. |
| removeFalls() | Take the waterfalls down (a rebuild or a new map). |
Updating & Drawing 7
| updateTerrain() | Bend the built scene through the terrain again, in place, after the grid changed under it. |
| updateCutCaps() | Caps over the cut: a top laid over every wall-high piece the cut plane passes through inside box (x0, z0, x1,… |
| updatePieces() | Lay the pieces down again after an edit. |
| updateWater() | Each frame: the waves run and the image drifts. |
| updateRipples() | Updates the ripples each frame. |
| updateWaterSheets() | Lay the water again after an edit; the rest of the scene stays. |
| updateGround() | The ground types changed: the paint is written again (region in cells, or all of it) and each type's tint and… |
Other 14
| piecesGroup() | The group the pieces stand in: part of the world, drawn with the ground pass. |
| materialTexture() | A material's texture, repeating, made once per scene. |
| materialDetail() | A material's detail, made once per scene: its packed maps (map, neutral until they arrive), params (normal st… |
| pieceMaterial() | One material's material object (in a surface, when it has one), shared by every chunk that wears it. |
| pieceGhostMaterial() | The see-through twin of a piece material: what the sight corridor holds is drawn with this, at a third. |
| layPieceChunks() | Lay the pieces of the chunks named in keys (every chunk when null). |
| layPieceChunk() | One chunk's pieces other than rocks: a mesh per material and surface. |
| layRockChunks() | The rocks of the chunks in wanted (every chunk a rock reaches when null): each chunk meshes the rock field ov… |
| queueRockChunks() | Lay worker results only into the build and chunk that still want them. |
| groundLoader() | The loader a rock's "ground" cap reads with: the room's floor image, by the loader the room was laid with; wi… |
| layQueuedPieces() | Lay queued chunks (addPieces with later) until budget milliseconds have gone, one at least; the rocks after t… |
| followUp() | Work that follows a step of the build (the land past the border and the plants, after the water): done now, o… |
| noteWaterVolume() | The scene's water sheets as volumes (world boxes and levels) for the lit shader; the nearest four to focus (a… |
| groundLayers() | The ground types as the floor's shader reads them, made once per scene: the paint as an array texture of RGBA… |
Actions
addRockChunk
method sourceReactor3D.MapScene.prototype.addRockChunk(key, buckets, load)
Lay a chunk's meshed rock faces into the scene.
addPieceChunkMesh
method sourceReactor3D.MapScene.prototype.addPieceChunkMesh(key, name, surface, geometry, load, both)
One chunk's mesh of one material (and its ghost for the cut), laid in the pieces group.
clear
method sourceReactor3D.MapScene.prototype.clear()
Clear.
addPieces
method sourceReactor3D.MapScene.prototype.addPieces(mapData, load, later)
Lay every piece down, cast into the static shadow rows.
Details
Lay every piece down, cast into the static shadow rows. later: the chunks are only listed, in the
order they would have been laid, and layQueuedPieces lays them a few a frame (a map opened in the game,
a neighbor's world): a village of a few thousand pieces is otherwise one long frame.
addWaterHaze
method sourceReactor3D.MapScene.prototype.addWaterHaze(mesh)
Hang the haze over a sheet just laid (mesh): its layers stand with the lights' glowing bodies, share the sheet's surface, and show only while the sheet glows.
Details
Hang the haze over a sheet just laid (mesh): its layers stand with the
lights' glowing bodies, share the sheet's surface, and show only while the
sheet glows. Kept in _waterHaze. The same surface once more is what the
sheet gives the halo (Reactor3D.Halo.feed), kept in _waterHalo and
showing while the sheet's shine passes the halo's threshold. Both are taken
down when the water is laid again.
removeWaterHaze
method sourceReactor3D.MapScene.prototype.removeWaterHaze()
Take the sheets' haze and what they give the halo down (the water laid again); the surface is the sheet's own and goes with the sheet.
runFollowUp
method sourceReactor3D.MapScene.prototype.runFollowUp()
The next work kept by followUp (one that fails is told of and passed over).
Details
The next work kept by followUp (one that fails is told of and passed over). True when none is left.
addWater
method sourceReactor3D.MapScene.prototype.addWater(mapData, load)
The water sheets: one waving translucent surface per sheet, in the world's own pass.
addFalls
method sourceReactor3D.MapScene.prototype.addFalls(region, load, sheet)
A river's waterfalls: a curtain down each, foam where it lands, and spray and mist rising there.
Details
A river's waterfalls: a curtain down each, foam where it lands, and spray and mist rising there. Kept in
_waterFalls. sheet is the river's own material: its falls read its colour and glow live.
removeFalls
method sourceReactor3D.MapScene.prototype.removeFalls()
Take the waterfalls down (a rebuild or a new map).
Updating & Drawing
updateTerrain
method sourceReactor3D.MapScene.prototype.updateTerrain(mapData, region)
Bend the built scene through the terrain again, in place, after the grid changed under it.
Details
Bend the built scene through the terrain again, in place, after the grid
changed under it. Only vertices inside region (corner-grid bounds
{x0, x1, z0, z1} in tiles, or null for the whole map) are touched: a
brush dab moves a few hundred vertices instead of throwing the scene away
and building it again, which is what made every dab pause and reset the
sky's drift. Returns the geometries it changed, or null when the scene was
built without terrain vertices and has to be rebuilt to get them.
updateCutCaps
method sourceReactor3D.MapScene.prototype.updateCutCaps(mapData, cutTop, box)
Caps over the cut: a top laid over every wall-high piece the cut plane passes through inside box (x0, z0, x1, z1 in world tiles), so the storey the player stands in reads as though it had no floor above it.
Details
Caps over the cut: a top laid over every wall-high piece the cut plane
passes through inside box (x0, z0, x1, z1 in world tiles), so the
storey the player stands in reads as though it had no floor above it.
One mesh per material in the pieces group, wearing the piece material
(its top mapping: the image by world x and z); made again when the cut
changes and dropped when it ends. A doorway's header sits under the
plane, so a doorway gets none and stays an opening.
updatePieces
method sourceReactor3D.MapScene.prototype.updatePieces(mapData, load, region)
Lay the pieces down again after an edit.
Details
Lay the pieces down again after an edit. Only the chunks region
(cell bounds {x0, y0, x1, y1}, inclusive; null for all) touches are
dropped and laid again; the tiles, ground, room, sky and every other
chunk stay as they are. Returns the meshes laid.
updateWater
method sourceReactor3D.MapScene.prototype.updateWater(frame, focus)
Each frame: the waves run and the image drifts.
Details
Each frame: the waves run and the image drifts. focus (a world point) picks the water volumes nearest it.
updateRipples
method sourceReactor3D.MapScene.prototype.updateRipples(frame, characters)
Updates the ripples each frame.
updateWaterSheets
method sourceReactor3D.MapScene.prototype.updateWaterSheets(mapData, load)
Lay the water again after an edit; the rest of the scene stays.
updateGround
method sourceReactor3D.MapScene.prototype.updateGround(mapData, region)
The ground types changed: the paint is written again (region in cells, or all of it) and each type's tint and scale read again, in place.
Details
The ground types changed: the paint is written again (region in cells, or
all of it) and each type's tint and scale read again, in place. False when
the types themselves changed (another count or material): the scene is built again.
Other
piecesGroup
method sourceReactor3D.MapScene.prototype.piecesGroup()
The group the pieces stand in: part of the world, drawn with the ground pass.
materialTexture
method sourceReactor3D.MapScene.prototype.materialTexture(name, load)
A material's texture, repeating, made once per scene.
Details
A material's texture, repeating, made once per scene. A bitmap still loading (the game's ImageManager hands those out) fills the texture when it arrives; the wall is drawn plain until then and textured a frame later.
materialDetail
method sourceReactor3D.MapScene.prototype.materialDetail(name, load)
A material's detail, made once per scene: its packed maps (map, neutral until they arrive), params (normal strength, gloss, reflect, 1 once the maps are in), and the repeat of a box piece (uvScale) and of a rock (triScale) from its settings.
Details
A material's detail, made once per scene: its packed maps (map, neutral until
they arrive), params (normal strength, gloss, reflect, 1 once the maps are in),
and the repeat of a box piece (uvScale) and of a rock (triScale) from its
settings. Null when the material has no companions. The game asks the disk
which companions exist (an image that is not there would stop it); the editor's
loader answers null for one it has not got.
pieceMaterial
method sourceReactor3D.MapScene.prototype.pieceMaterial(name, load, surface, both)
One material's material object (in a surface, when it has one), shared by every chunk that wears it.
Details
One material's material object (in a surface, when it has one), shared by every chunk that
wears it. both draws both faces: a rock's mesh can fold a face over at a crease.
pieceGhostMaterial
method sourceReactor3D.MapScene.prototype.pieceGhostMaterial(name, load)
The see-through twin of a piece material: what the sight corridor holds is drawn with this, at a third.
layPieceChunks
method sourceReactor3D.MapScene.prototype.layPieceChunks(mapData, load, keys)
Lay the pieces of the chunks named in keys (every chunk when null).
layPieceChunk
method sourceReactor3D.MapScene.prototype.layPieceChunk(key, byMaterial, mapData, load)
One chunk's pieces other than rocks: a mesh per material and surface.
layRockChunks
method sourceReactor3D.MapScene.prototype.layRockChunks(mapData, load, rocks, wanted)
The rocks of the chunks in wanted (every chunk a rock reaches when null): each chunk meshes the rock field over its own cells, from every rock that reaches it, one mesh per material and per cap.
Details
The rocks of the chunks in wanted (every chunk a rock reaches when
null): each chunk meshes the rock field over its own cells, from every
rock that reaches it, one mesh per material and per cap. A chunk whose
rocks are the same as when it was last meshed (an edit beside it, an
undo) takes its arrays again instead of meshing.
queueRockChunks
method sourceReactor3D.MapScene.prototype.queueRockChunks(pool, jobs, load, floor)
Lay worker results only into the build and chunk that still want them.
groundLoader
method sourceReactor3D.MapScene.prototype.groundLoader()
The loader a rock's "ground" cap reads with: the room's floor image, by the loader the room was laid with; with no floor, the Grass material.
layQueuedPieces
method sourceReactor3D.MapScene.prototype.layQueuedPieces(budget)
Lay queued chunks (addPieces with later) until budget milliseconds have gone, one at least; the rocks after the rest, as a whole map's are laid (those round the player meshed now, the rest on the background meshers).
Details
Lay queued chunks (addPieces with later) until budget milliseconds have gone, one at least; the
rocks after the rest, as a whole map's are laid (those round the player meshed now, the rest on the
background meshers). True when nothing is left to lay.
followUp
method sourceReactor3D.MapScene.prototype.followUp(work)
Work that follows a step of the build (the land past the border and the plants, after the water): done now, or, while the scene is laid over several frames (Reactor3D.Arrival sets _followUps to a list), kept in order for the frames after (runFollowUp).
noteWaterVolume
method sourceReactor3D.MapScene.prototype.noteWaterVolume(focus)
The scene's water sheets as volumes (world boxes and levels) for the lit shader; the nearest four to focus (a world point: the player in the game, the camera's target in the editor) when there are more.
Details
The scene's water sheets as volumes (world boxes and levels) for the
lit shader; the nearest four to focus (a world point: the player in the
game, the camera's target in the editor) when there are more. A level
sheet is one box. A river is a box per stretch, as wide as its water there
and as high as the stretch's lower end, so its dry banks (below the river
upstream, above it here) are never taken for water; falls have none.
groundLayers
method sourceReactor3D.MapScene.prototype.groundLayers(mapData)
The ground types as the floor's shader reads them, made once per scene: the paint as an array texture of RGBA layers (four types a layer, a channel each, a texel a cell), each type's tint, scale, picture and maps as a column of a small float texture (info), the materials' images as the layers of one array texture and their normal and roughness maps as another (types of one material share a layer)…
Details
The ground types as the floor's shader reads them, made once per scene: the
paint as an array texture of RGBA layers (four types a layer, a channel each,
a texel a cell), each type's tint, scale, picture and maps as a column of a
small float texture (info), the materials' images as the layers of one
array texture and their normal and roughness maps as another (types of one
material share a layer), so the floor costs four or five samplers however
many types a map has. A layer is grey until its image arrives.