Cogs.Core
HighlightRegionSystem.h
1#pragma once
2
3#include "Rendering/Common.h"
4
5#include "Resources/Resources.h"
6
7#include "Systems/ComponentSystem.h"
8
9#include "HighlightRegionComponent.h"
10
11namespace Cogs::Core {
12
13 struct HighlightRegionBounds;
14 struct HighlightRegionPicker;
15 struct HighlightRegionRenderer;
16 struct RenderMaterialInstance;
17
19 {
20 glm::mat4 data0;
21 glm::mat4 data1;
22 };
23
25 {
26 MaterialInstanceHandle materialInstance;
27 RenderMaterialInstance* renderMaterialInstance = nullptr;
28
29 Cogs::BufferHandle instanceDataHandle;
30
31 std::vector<HighlightRegionInstanceData> instanceData;
32 glm::vec3 boundsMin;
33 glm::vec3 boundsMax;
34 glm::mat4 worldMatrix;
35
36 bool instanceDataUpdated = false;
37 bool debugForceNoSplit = false;
38 };
39
40 struct HighlightRegionSystem : public ComponentSystemWithDataPool<HighlightRegionComponent, HighlightRegionData>
41 {
42 public:
43 HighlightRegionSystem(Memory::Allocator* allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
44
45 void update(Context* context) override;
46
48
49 void destroyComponent(ComponentHandle component) override;
50
51 MaterialHandle material;
52 HighlightRegionBounds* bounds = nullptr;
53 HighlightRegionPicker* picker = nullptr;
54 HighlightRegionRenderer* renderer = nullptr;
55 };
56}
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
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19
Handle to a Component instance.
Definition: Component.h:67
void destroyComponent(ComponentHandle component) override
ComponentHandle createComponent() override