Cogs.Core
CubeMarkerSystem.h
1#pragma once
2
3#include "Systems/ComponentSystem.h"
4
5#include "../Components/CubeMarkerComponent.h"
6
7#include "Resources/Resources.h"
8
9#include <unordered_map>
10
11namespace Cogs
12{
13 namespace Core
14 {
15 class Context;
16
18 {
21 WeakEntityPtr centerMarkerShape;
22 WeakEntityPtr wallMarkerShapes[3];
23 uint32_t colorKeys[3] = {};
24 };
25
26 class CubeMarkerSystem : public ComponentSystemWithDataPool<CubeMarkerComponent, CubeMarkerData>
27 {
28 public:
29 CubeMarkerSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
30
31 void update(Context * context) override;
32
33 private:
35 {
38 };
39
40 std::unordered_map<uint32_t, WallMarkerMaterials> wallMarkerMaterials;
41
42 void createCenterMarker(CubeMarkerData& cmapData, CubeMarkerComponent& cmapComp);
43
44 void updateCenterMarker(CubeMarkerData& cubeMarkerData, CubeMarkerComponent& cubeMarkerComp, bool force);
45
46 void destroyCenterMarker(CubeMarkerData& cmapData, CubeMarkerComponent& cmapComp);
47
48 void createWallMarkers(CubeMarkerData& cmapData, CubeMarkerComponent& cmapComp);
49
50 void updateWallMarkers(CubeMarkerData& cubeMarkerData, CubeMarkerComponent& cubeMarkerComp, bool force);
51
52 void destroyWallMarkers(CubeMarkerData& cmapData, CubeMarkerComponent& cmapComp);
53
54 MeshHandle createWallMarkerMesh(Context * context);
55
56 MaterialInstanceHandle createUnshadedMaterialInstance(Context * context, const glm::vec4 color);
57 };
58 } // namespace Core
59} // namespace Cogs
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
std::weak_ptr< ComponentModel::Entity > WeakEntityPtr
Weak Smart pointer for Entity access.
Definition: EntityPtr.h:18
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19