@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 ​
new LODComponent(options?): LODComponent;Defined in: components/LOD.ts:53
Parameters ​
| Parameter | Type |
|---|---|
options | LODOptions |
Returns ​
LODComponent
Overrides ​
Properties ​
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
enabled | boolean | true | - | components/LOD.ts:41 |
levels | LodLevel[] | [] | Simpler versions, most detailed first. | components/LOD.ts:43 |
cullScreenSize | number | 0 | Don't draw below this share of the screen's height (0: always draw). | components/LOD.ts:45 |
cullDistance | number | 0 | Don't draw further than this many metres from the camera (0: no limit). | components/LOD.ts:47 |
hysteresis | number | 0.15 | How much bigger (0.1 = 10%) the object must get to go back to more detail. | components/LOD.ts:49 |
activeLevel | number | undefined | Runtime only: the level drawn now, -1 when culled. Never saved. | components/LOD.ts:51 |

