marble3 / Cleanup
Class: Cleanup
Defined in: src/entity/cleanup.ts:8
An invisible entity that runs a function, once, when it is removed or the world is torn down. It is how to free something that is not itself an entity, such as a post-processing composer or an audio handle: fps.add(new Cleanup(() => composer.dispose())).
Extends
Constructors
Constructor
new Cleanup(
fn):Cleanup
Defined in: src/entity/cleanup.ts:9
Parameters
fn
() => void
Returns
Cleanup
Overrides
Properties
disposed
protecteddisposed:boolean=false
Defined in: src/entity/graphic.ts:19
Inherited from
id
id:
string
Defined in: src/entity/graphic.ts:16
Unique per entity. Keys FPS.entities, and is stamped on collision shapes so a ray or contact hit resolves back to its entity.
Inherited from
three
three:
Group
Defined in: src/entity/graphic.ts:18
The entity's node in the scene; FPS.add() puts it there. Add your meshes under it.
Inherited from
Methods
dispose()
dispose():
void
Defined in: src/entity/cleanup.ts:13
Frees the geometry and instance buffers under three and takes it out of the scene. Idempotent. Materials and textures are not freed, since they are often shared: dispose your own. A subclass frees what else it owns, then calls super.dispose().
Returns
void
Overrides
update()
update(
_delta?,_engine?):void
Defined in: src/entity/graphic.ts:45
Called every frame the world is not paused, with the seconds since the last frame and the FPS the entity lives in (for its world and entities).
Parameters
_delta?
number = 0
_engine?
Returns
void