CullStateComponent class
Opt-in view-culling state, maintained each frame by ViewCullingSystem.
Add this component to any entity that should be culled based on distance from the camera. Entities without it are never touched by culling — the player, for instance, should simply never get one.
isVisible and isActive are two separate radii rather than one shared
threshold: isVisible uses a tight radius matching what's actually on
screen (an entity leaving it is hidden — RenderableComponent.renderable .visible set false by ViewCullingSystem, and shown again when it comes
back — so RenderSystem skips drawing it with no extra wiring), while
isActive uses a larger radius so simulation (this
engine's MovementSystem/PhysicsSystem, and any game-specific system
that checks it, e.g. AI) keeps running for entities approaching the
screen — they arrive already moving instead of snapping to life right at
the visible edge.
Constructors
Properties
- componentType → Type
-
Type identifier for this component
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hidesRenderable ↔ bool
-
Whether
ViewCullingSystemis what holds the entity's renderable hidden: it setvisiblefalse when the entity left the render radius, and will set it true when it comes back. False while the entity is in view, and while the game itself has it hidden.getter/setter pair - isActive ↔ bool
-
Within the larger active/simulation radius this frame. Built-in
MovementSystem/PhysicsSystemskip entities where this isfalse.getter/setter pair - isVisible ↔ bool
-
Within the tighter render radius this frame.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAttach(
EntityId entityId) → void -
Called when this component is added to an entity.
inherited
-
onDetach(
EntityId entityId) → void -
Called when this component is removed from an entity.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited