ThreeRenderer
The scene writer: Wardic's values written onto three.js objects once a frame, in the frame that computed them. A scene object's transform keys go in one call per vector:
x,yandzasposition.set;rotateX,rotateYandrotateZ, in degrees, as onerotation.setin radians;scale, andscaleX,scaleYandscaleZ, as onescale.set, an axis's own key overscale.
Any other key goes where the lookup finds it: the object's own number, its material's (each of an
array of them), a uniform's value, a TSL uniform node's, or a vector's axis. Two of three's own
rules follow a write: a camera's projection keys end with updateProjectionMatrix(), and a
material's opacity below 1 draws it transparent. layer is what WardicThree provides; GATE is what its
Flush gate reads of an object; writer draws a Batch of objects.
import * as ThreeRenderer from "@wardic/three/ThreeRenderer"
ThreeRenderer.commit(mesh, { x: 2, rotateY: 90, opacity: 0.5 })
// mesh.position.x === 2, mesh.rotation.y === Math.PI / 2, mesh.material.opacity === 0.5Its exports also name types the module doesn't export: its internal types.
Variables
GATE
const GATE: FlushGate.GateEnvironment;The Flush gate's reads of an object: nothing saved before a write, and a template key no object has.
layer
const layer: Layer.Layer<Renderer.Renderer>;The scene writer as the Environment's Renderer.
writer
const writer: Batch.Writer<object>;The scene writer for a Batch of objects: each member's transforms grouped as the commit's are, any other key where the lookup finds it. Its keys' places are found once, by index.
Functions
commit()
function commit(target, patch): void;patch written onto target: a scene object's transforms grouped, every other key where the lookup finds it.
Parameters
target
unknown
patch
Patch
Returns
void
project()
function project(values): Patch;A scene's patch: its values as they are; the commit groups them.
Parameters
values
Readonly<Record<string, unknown>>
Returns
Patch
writeTransforms()
function writeTransforms(
object,
x,
y,
z,
rx,
ry,
rz,
s,
sx,
sy,
sz
): void;A scene object's transforms written, NaN for a key not given: one position.set, one rotation.set
from degrees, one scale.set, each only where one of its keys is given, the rest of its axes kept.
Parameters
object
x
number
y
number
z
number
rx
number
ry
number
rz
number
s
number
sx
number
sy
number
sz
number
Returns
void