Cogs.Core
BadgeSetSystem.h
1#pragma once
2
3#include "BadgeSetComponent.h"
4
5#include "Resources/Resources.h"
6#include "Resources/MeshStreamsLayout.h"
7#include "Systems/ComponentSystem.h"
8#include "BadgeSetPicker.h"
9
10#include <memory>
11
12namespace Cogs {
13 namespace Core {
14 class Context;
15
16 struct BadgeSetData {
17 bool initialized = false;
18 bool texturesLoaded = false;
19 glm::vec4 viewPlaneLocal;
20 glm::vec3 viewXLocal;
21 glm::vec3 viewYLocal;
22
23 MaterialInstanceHandle materialInstance;
24 };
25
29 class BadgeSetSystem : public ComponentSystemWithDataPool<BadgeSetComponent, BadgeSetData> {
31 public:
32 BadgeSetSystem(Memory::Allocator* allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
34
35 virtual void initialize(Context* context) override;
36 virtual void generateMesh(Context* context);
37 virtual void update(Context* /*context*/) override;
38 virtual void cleanup(Context* context) override;
39
40 private:
41 MeshHandle quadMesh;
42 MaterialHandle instMaterial;
43
44 VertexFormatHandle vertexFormatHandle;
45
46 VariableKey viewPlaneLocalKey = NoProperty;
47 VariableKey viewXLocalKey = NoProperty;
48 VariableKey viewYLocalKey = NoProperty;
49 VariableKey pointSizeKey = NoProperty;
50 VariableKey anchorPointOffsetKey = NoProperty;
51 VariableKey nearCutoffKey = NoProperty;
52 VariableKey farCutoffKey = NoProperty;
53 VariableKey nearVisibilityLimitKey = NoProperty;
54 VariableKey farVisibilityLimitKey = NoProperty;
55 VariableKey outputAlphaValueKey = NoProperty;
56 VariableKey iconTextureKey = NoProperty;
57 VariableKey styleTextureKey = NoProperty;
58 VariableKey digitTextureKey = NoProperty;
59
60 std::unique_ptr<BadgeSetPicker> picker;
61 };
62 }
63}
The BadgeSet system manages and displays BadgeSets as instanced quads.
virtual void initialize(Context *context) override
Initialize the system.
virtual void cleanup(Context *context) override
Provided for custom cleanup logic in derived systems.
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 with parallel data per component stored in a pool similar to how the components them...
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base allocator implementation.
Definition: Allocator.h:30
uint16_t VariableKey
Used to lookup material properties.
Definition: Resources.h:46
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19