Cogs.Core
LodComponent.cpp
1#include "LodComponent.h"
2
3#include "RenderComponent.h"
4
5#include "Types.h"
6
7using namespace Cogs::Reflection;
8
10{
11 static constexpr EnumeratorDef enumerators [] = {
12 { "None", LodPolicy::None },
13 { "CenterDistance", LodPolicy::CenterDistance },
14 { "GeometricTolerance", LodPolicy::GeometricTolerance }
15 };
16
17 TypeDatabase::createType<LodPolicy>().setEnumerators(enumerators);
18
19 static constexpr EnumeratorDef errorEnumerators[] = {
20 { "AreaBased", GeometricErrorKind::AreaBased },
21 { "DistanceBased", GeometricErrorKind::DistanceBased },
22 };
23
24 TypeDatabase::createType<GeometricErrorKind>().setEnumerators(errorEnumerators);
25
26 Field fields[] = {
27 Field("thresholds", &LodComponent::thresholds),
28 Field("policy", &LodComponent::policy),
29 Field("geometricTolerance", &LodComponent::geometricTolerance),
30 Field("separateHierarchies", &LodComponent::separateHierarchies)
31 };
32
33 TypeDatabase::createType<LodComponent>().setBase<Component>().setFields(fields);
34}
std::vector< float > thresholds
Threshold values to switch levels of detail at when the policy in use is distance based (for example ...
Definition: LodComponent.h:63
LodPolicy policy
The policy used for determining the level of detail for this entity.
Definition: LodComponent.h:51
float geometricTolerance
Geometric tolerance value applied when the lodPolicy field is set to LodPolicy::GeometricTolerance.
Definition: LodComponent.h:68
static void registerType()
Register the type in the type system.
Definition: LodComponent.cpp:9
bool separateHierarchies
Enable old-style lod'ing with a completely separate hierarchy for each lod-level.
Definition: LodComponent.h:73
Field definition describing a single data member of a data structure.
Definition: Field.h:68
@ GeometricTolerance
Use a geometric error bound to determine how refined geometry needs to be at its current position.
@ None
No policy applied, the LodSystem will take no action on the entity.
Contains reflection support.
Definition: Component.h:11