@motion-script/core / Tex
Variable: Tex
constTex:object
Defined in: render3d/builders.ts:107
Texture descriptors.
Tex.image takes a manifest path and is loaded through core's ordinary
image pipeline, so the pixels are resident before the frame that needs them
draws. A bare string works anywhere a texture is expected, so Tex.image is
only needed when passing sampler options.
Type Declaration
data
readonlydata: (data,width,height,o?) =>DataTexture3D
A texture from raw RGBA8888 bytes — gradient ramps, noise, LUTs.
Parameters
data
ArrayLike<number>
width
number
height
number
o?
TextureOptions3D & object
Returns
image
readonlyimage: (src,o?) =>ImageTexture3D
Parameters
src
string
o?
Returns
surface
readonlysurface: (source,width,height,o?) =>SurfaceTexture3D
A texture painted from Motion Script's own 2D output — the bridge from 2D onto 3D geometry.
source is a value: a built Graphics command list, or a Node
subtree for anything needing real layout, shaped Text or a loaded
Image. Both are passed directly; there is no name to match and nothing
has to be mounted anywhere in particular.
const scope = new Graphics().line({ points: trace(phase()) }).stroke(…); g3.plane({ map: Tex.surface(scope, 1024, 640) });
const stats = ; g3.plane({ map: Tex.surface(stats, 1024, 640) });
width/height are the buffer's resolution. Hoist the source rather
than rebuilding it each frame — see SurfaceTexture3D.
Parameters
source
width
number
height
number
o?
TextureOptions3D & object