Skip to main content

Module spawn

Module spawn 

Source
Expand description

Runtime entity churn: instantiating a copy of an authored placement, and the two clocks that drive it.

What a copy carries and when one is due is the world’s business and lives here. Allocating the copy’s draw slot and retiring it afterwards are a renderer’s, and reach this through the clone_slot / acquire_slot closures a caller passes in.

Structs§

DueSpawn
One spawn a Spawner is due to emit this step: the template to copy, where to place it, and how long the copy should live.

Functions§

spawn_from_template
Instantiate a runtime copy of template’s renderable: clone each of its backend draw slots at transform through clone_slot, then build a new entity carrying the cloned slots, a copy of the template’s renderer, the placement, and an optional Lifetime.
spawn_skinned_from_template
Instantiate a runtime copy of a skinned template (a SkinnedMesh’s SkeletonPose entity) at transform.
tick_lifetimes
Decrement every Lifetime by dt and return the entities whose countdown reached zero this step, in frame scratch, for the caller to despawn.
tick_spawners
Advance every Spawner’s clock by dt and return the spawns now due, in frame scratch.