Binds a scene mesh to a new THREE.Mesh and keeps it in sync on every
SceneLike.commitFrame: dirty ranges are copied into the attributes'
mirrors and marked with addUpdateRange, attributes are recreated when the
mesh's slot counts change, the colour attribute comes and goes with the
mesh's colouring, the uv attribute with its UVs, and object.matrix
follows its placement.
Dead vertex slots keep stale positions, so the geometry's bounding box and
sphere are computed from the vertices of live triangles only (a removed
triangle reads 0, 0, 0 in the index). They are recomputed when positions
or indices change, never on placement-only frames.
With shading: "fragment" the colour attribute is replaced by the
colouring's values (fmValue), coloured per fragment by a shader chunk the
binding adds to the material (see BindMeshOptions.shading).
When the scene mesh is removed, the binding detaches: it stops following
the scene and leaves the object as it was (remove it from your THREE.Scene
and call BoundMesh.dispose).
The object must sit under an untransformed parent (its matrix is a world
matrix); a transformed ancestor is detected and warned about once.
With a debug scene (new Scene({ debug: true })), the views the binding
copies from are checked Proxy objects (see SceneOptions.debug for
their cost); the mirrors it uploads are always plain typed arrays.
The adapter only listens through SceneLike.onChanges: call
scene.commitFrame() once per animation frame, before rendering.
Binds a scene mesh to a new THREE.Mesh and keeps it in sync on every SceneLike.commitFrame: dirty ranges are copied into the attributes' mirrors and marked with
addUpdateRange, attributes are recreated when the mesh's slot counts change, the colour attribute comes and goes with the mesh's colouring, theuvattribute with its UVs, andobject.matrixfollows its placement.Dead vertex slots keep stale positions, so the geometry's bounding box and sphere are computed from the vertices of live triangles only (a removed triangle reads
0, 0, 0in the index). They are recomputed when positions or indices change, never on placement-only frames.With
shading: "fragment"the colour attribute is replaced by the colouring's values (fmValue), coloured per fragment by a shader chunk the binding adds to the material (see BindMeshOptions.shading).When the scene mesh is removed, the binding detaches: it stops following the scene and leaves the object as it was (remove it from your THREE.Scene and call BoundMesh.dispose).
The object must sit under an untransformed parent (its
matrixis a world matrix); a transformed ancestor is detected and warned about once.With a debug scene (
new Scene({ debug: true })), the views the binding copies from are checkedProxyobjects (seeSceneOptions.debugfor their cost); the mirrors it uploads are always plain typed arrays.The adapter only listens through SceneLike.onChanges: call
scene.commitFrame()once per animation frame, before rendering.