API Three.js
TransformComponent
Standard component class for a Three.js object transform.
position: Vector3rotation: Eulerscale: Vector3
Object3DComponent
Wraps a Three.js Object3D so it can live on an entity.
createThreeWorld(scene)
Creates a World preconfigured with:
SceneAttachmentSystemTransformSyncSystem
Use it when you only need one scene.
TransformSyncSystem
Copies TransformComponent values to Three.js objects using a component query.
SceneAttachmentSystem
Keeps Object3D instances attached to the current scene while the entity exists.
ThreeSceneManager
Manages multiple named scenes, each with its own World.
createScene(name, scene?)
Creates a named scene record and its ECS world.
hasScene(name)
Checks whether a scene exists.
getScene(name)
Returns a scene record or undefined.
getActiveScene()
Returns the active scene or undefined.
getActiveWorld()
Returns the active scene world or undefined.
setActiveScene(name)
Switches the active scene.
update(deltaTime)
Updates the active scene only.
updateScene(name, deltaTime)
Updates a specific scene by name.
removeScene(name)
Removes a scene, clears its scene graph, and clears its world.
ThreeCanvasManager
Manages a Three.js renderer canvas with sizing, aspect ratio, and centering.
ThreeCanvasOptions
container?: HTMLElementwidth?: numberheight?: numberaspectRatio?: numberantialias?: booleanalpha?: booleancenter?: boolean
getRenderer()
Returns the underlying Three.js renderer.
getCanvas()
Returns the managed canvas element.
getSize()
Returns the current logical canvas size.
getAspectRatio()
Returns the enforced aspect ratio, if any.
setAspectRatio(aspectRatio)
Updates the forced aspect ratio.
setSize(width, height?)
Sets the canvas size while honoring the aspect ratio when one is enforced.
fitToContainer()
Fits the canvas to the current container size.
centerCanvas()
Reapplies centering styles.
render(scene, camera)
Renders a Three.js scene with the provided camera.
dispose()
Removes the canvas and disposes the renderer.