Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / LODComponent

Class: LODComponent ​

Defined in: components/LOD.ts:40

Levels of detail: simpler copies of a model drawn when it's small on screen, and an optional size or distance past which it isn't drawn at all.

Level 0 is the entity's own model. Each entry in levels is a simpler file used once the model covers less than its screenSize of the screen's height; a file loads the first time it's needed. Going back to a more detailed level needs the object to be hysteresis bigger than where it switched, so a model on the edge doesn't flicker between levels.

cullScreenSize and cullDistance work on any entity, models or not: past them it isn't drawn (scripts, physics and audio carry on).

Skinned (animated) models only use the cull options: their extra levels would need their own skeletons. The editor shows level 0.

Extends ​

Constructors ​

Constructor ​

ts
new LODComponent(options?): LODComponent;

Defined in: components/LOD.ts:53

Parameters ​

ParameterType
optionsLODOptions

Returns ​

LODComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDefault valueDescriptionDefined in
enabledbooleantrue-components/LOD.ts:41
levelsLodLevel[][]Simpler versions, most detailed first.components/LOD.ts:43
cullScreenSizenumber0Don't draw below this share of the screen's height (0: always draw).components/LOD.ts:45
cullDistancenumber0Don't draw further than this many metres from the camera (0: no limit).components/LOD.ts:47
hysteresisnumber0.15How much bigger (0.1 = 10%) the object must get to go back to more detail.components/LOD.ts:49
activeLevelnumberundefinedRuntime only: the level drawn now, -1 when culled. Never saved.components/LOD.ts:51