Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / LODSystem

Class: LODSystem ​

Defined in: systems/LODSystem.ts:58

Draws a simpler level of a model when it's small on screen, and nothing when it's past its cull size or distance (LODComponent).

Screen size is the share of the screen's height the object's bounding sphere covers, so it follows the camera's field of view and the object's scale. A default system, after the camera has moved for the frame. The editor shows level 0 and draws everything.

Implements ​

Constructors ​

Constructor ​

ts
new LODSystem(isEditor?): LODSystem;

Defined in: systems/LODSystem.ts:79

Parameters ​

ParameterTypeDefault value
isEditorbooleanfalse

Returns ​

LODSystem

Properties ​

PropertyModifierTypeDefault valueDescriptionDefined in
runsWhilePausedreadonlytruetrueKeep ticking while the world is paused. Leave it unset for anything that moves the game on: such a system stops at world.pause() and picks up where it was at world.resume().systems/LODSystem.ts:59
biaspublicnumber | nullnullMultiplies every screen size. Below 1 drops to simpler levels sooner. Null follows the quality preset (low 0.6, medium 0.8, high 1, ultra 1.25).systems/LODSystem.ts:67
switchespublicnumber0Level switches since the game started, for the profiler.systems/LODSystem.ts:69
spreadpublicnumber4Each object is looked at one frame in this many (all of them after the camera jumps): a level is chosen from distances that hardly change in a frame. 1 looks at every object every frame.systems/LODSystem.ts:75

Methods ​

holds() ​

ts
holds(url): boolean;

Defined in: systems/LODSystem.ts:82

Whether any entity's level of detail holds this file now.

Parameters ​

ParameterType
urlstring

Returns ​

boolean


effectiveBias() ​

ts
effectiveBias(world): number;

Defined in: systems/LODSystem.ts:86

Parameters ​

ParameterType
worldWorld

Returns ​

number


update() ​

ts
update(world): void;

Defined in: systems/LODSystem.ts:92

Parameters ​

ParameterType
worldWorld

Returns ​

void

Implementation of ​

EcsSystem.update


releaseEntity() ​

ts
releaseEntity(world, entityId): string[];

Defined in: systems/LODSystem.ts:336

Drop an entity's extra levels now (streaming freed its model) and say which files they came from, so the caller can release them.

Parameters ​

ParameterType
worldWorld
entityIdnumber

Returns ​

string[]