Cogs.Core
LodSystem.h
1#pragma once
2
3#include "Systems/ComponentSystem.h"
4
5#include "Components/Core/LodComponent.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
11 class Context;
12
14 struct LodData
15 {
16 LodData() = default;
17 LodData(const LodData & other) = delete;
18
19 uint8_t currentLodIndex = 0;
20 uint8_t previousLodIndex = (uint8_t)-1;
21 float detailLevel = 1;
22
23 glm::mat4 localToClip;
24 glm::mat4 clipToLocal;
25 };
26
37 class LodSystem : public ComponentSystemWithDataPools<LodComponent, LodData>
38 {
39 public:
40 LodSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPools(allocator, capacity) {}
41
43 void update(Context * context);
44
47
49 GeometricErrorKind geometricErrorKind = GeometricErrorKind::AreaBased;
50 };
51 }
52}
Context * context
Pointer to the Context instance the system lives in.
void update()
Updates the system state to that of the current frame.
Component system template with multiple parallel structures per component stored in separate pools si...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
The LodSystem is responsible for calculating common basic level of detail data for all entities with ...
Definition: LodSystem.h:38
GeometricErrorKind geometricErrorKind
Specifies what kind of error measure that is preferred.
Definition: LodSystem.h:49
float previousFrameStickyness
A number in [0,1] that indicates resilience to change, used to minimize popping.
Definition: LodSystem.h:46
Base allocator implementation.
Definition: Allocator.h:30
GeometricErrorKind
Defines kinds of geometric error calculations.
Definition: LodComponent.h:27
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
Defines level of detail data calculated by the LodSystem.
Definition: LodSystem.h:15