Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::lod::LodViewState Class Reference

Levels remembered per (view, entity) pair. More...

#include <LodViewState.hpp>

Public Member Functions

void beginFrame ()
 Opens a frame and, now and then, drops what no view still asks about — an entity that died leaves a pair nothing will ever touch again.
u8 lastLevel (u32 view, Entity entity) const
 The level view last drew entity at; level 0 for a pair it has never seen, which is the unbiased answer a first sighting wants.
bool recent (u32 view, Entity entity, u64 frames, u8 &outLevel) const
 The level view drew entity at within the last frames frames, or false when it has not drawn it that lately (it is off that view's screen, or new). What a view culled reads as kCulled.
void remember (u32 view, Entity entity, u8 chosen, u8 unbiased, u8 levels, f32 size)
 Record a decision: what was chosen, what the bare thresholds asked for, how many stand-ins were reachable, and the size all of it read.
bool inspect (u32 view, Entity entity, u8 &outLevel, u8 &outUnbiased, u8 &outLevels, f32 &outSize) const
 The whole recorded decision, or false when this view has not measured this entity — which is not the same as measuring it at 0.
void preview (u32 view, Entity entity, u8 level)
 Hold level up for inspection in this view, or kNoPreview to stop.
u8 previewOf (u32 view, Entity entity) const
 The level this view was told to show, or kNoPreview.
u8 drawn (u32 view, Entity entity, u8 chosen, u8 levels) const
 What to DRAW: the preview if one names a level this group reaches, otherwise chosen.
void clear ()
usize size () const
usize previewCount () const
 How many (view, entity) pairs are currently held up for inspection.

Static Public Attributes

static constexpr u64 kKeepFrames = 120
 How many frames an untouched pair is kept before it is dropped.

Detailed Description

Levels remembered per (view, entity) pair.

Keyed by the view because a level is an answer to "how big does it look from HERE": a minimap and a main camera looking at one object in one frame must be able to disagree. Kept on the entity it would be one answer, and whichever camera drew last would decide for all of them.

The entry carries the whole DECISION, not just its outcome: the size measured, and what that size asks for with no memory behind it. An editor explaining a level then reads facts recorded where the choice was made rather than running the selector a second time.

Definition at line 33 of file LodViewState.hpp.

Member Function Documentation

◆ beginFrame()

void esengine::lod::LodViewState::beginFrame ( )
inline

Opens a frame and, now and then, drops what no view still asks about — an entity that died leaves a pair nothing will ever touch again.

Definition at line 40 of file LodViewState.hpp.

References kKeepFrames.

◆ clear()

void esengine::lod::LodViewState::clear ( )
inline

Definition at line 126 of file LodViewState.hpp.

◆ drawn()

u8 esengine::lod::LodViewState::drawn ( u32 view,
Entity entity,
u8 chosen,
u8 levels ) const
inline

What to DRAW: the preview if one names a level this group reaches, otherwise chosen.

A preview past the last stand-in is ignored rather than clamped: a clamp would answer LOD1 to a request for LOD3 and look like the selector had spoken, and the level asked for does not exist.

Definition at line 121 of file LodViewState.hpp.

References esengine::lod::kNoPreview, and previewOf().

◆ inspect()

bool esengine::lod::LodViewState::inspect ( u32 view,
Entity entity,
u8 & outLevel,
u8 & outUnbiased,
u8 & outLevels,
f32 & outSize ) const
inline

The whole recorded decision, or false when this view has not measured this entity — which is not the same as measuring it at 0.

Definition at line 83 of file LodViewState.hpp.

◆ lastLevel()

u8 esengine::lod::LodViewState::lastLevel ( u32 view,
Entity entity ) const
inline

The level view last drew entity at; level 0 for a pair it has never seen, which is the unbiased answer a first sighting wants.

Definition at line 50 of file LodViewState.hpp.

◆ preview()

void esengine::lod::LodViewState::preview ( u32 view,
Entity entity,
u8 level )
inline

Hold level up for inspection in this view, or kNoPreview to stop.

Deliberately NOT on the component. Written to the entity it would reach a shipped game, a second camera and the shadow pass, none of which anybody asked to change.

Definition at line 102 of file LodViewState.hpp.

References esengine::lod::kNoPreview.

◆ previewCount()

usize esengine::lod::LodViewState::previewCount ( ) const
inline

How many (view, entity) pairs are currently held up for inspection.

Definition at line 131 of file LodViewState.hpp.

◆ previewOf()

u8 esengine::lod::LodViewState::previewOf ( u32 view,
Entity entity ) const
inline

The level this view was told to show, or kNoPreview.

Definition at line 108 of file LodViewState.hpp.

References esengine::lod::kNoPreview.

Referenced by drawn().

◆ recent()

bool esengine::lod::LodViewState::recent ( u32 view,
Entity entity,
u64 frames,
u8 & outLevel ) const
inline

The level view drew entity at within the last frames frames, or false when it has not drawn it that lately (it is off that view's screen, or new). What a view culled reads as kCulled.

Definition at line 57 of file LodViewState.hpp.

◆ remember()

void esengine::lod::LodViewState::remember ( u32 view,
Entity entity,
u8 chosen,
u8 unbiased,
u8 levels,
f32 size )
inline

Record a decision: what was chosen, what the bare thresholds asked for, how many stand-ins were reachable, and the size all of it read.

chosen and unbiased differing IS hysteresis holding a level, which is the one explanation a creator cannot reconstruct from the component: the numbers on screen would say the other level.

Definition at line 72 of file LodViewState.hpp.

References size().

◆ size()

usize esengine::lod::LodViewState::size ( ) const
inline

Definition at line 128 of file LodViewState.hpp.

Referenced by remember().

Member Data Documentation

◆ kKeepFrames

u64 esengine::lod::LodViewState::kKeepFrames = 120
staticconstexpr

How many frames an untouched pair is kept before it is dropped.

Definition at line 36 of file LodViewState.hpp.

Referenced by beginFrame().


The documentation for this class was generated from the following file: