Cogs.Core
ZipSystem.h
1#pragma once
2
3#include "Systems/ComponentSystem.h"
4
5#include "../Components/ZipComponent.h"
6
7#include "Resources/Resources.h"
8
9#include "Foundation/ComponentModel/ComponentDataPool.h"
10
11namespace Cogs
12{
13 namespace Core
14 {
15 class Context;
16
17 struct ZipData
18 {
19 ZipData() = default;
20 ZipData(const ZipData & other) = delete;
21
22 std::vector<float> depthList;
23 std::vector<float> samples;
24
25 std::vector<glm::vec3> basePositions;
26 std::vector<glm::vec3> baseDirections;
27
28 std::vector<float> values;
29
30 glm::vec3 axis;
31 float radius = 0.0f;
32 };
33
34 class ZipSystem : public ComponentSystemWithDataPool<ZipComponent, ZipData>
35 {
37 public:
38 ZipSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
39
40 void update(Context * context) override;
41 void cleanup(Context* context) override;
42
43 private:
44 bool setupComponent(Context * context, ZipComponent & component);
45 bool needsUpdate(Context * context, ZipComponent & component);
46
47 void updateStaticLog(Context * context, ZipComponent & component);
48 bool updateStaticHighLight(Context * context, ZipComponent & component);
49 void updateDynamic(Context * context, ZipComponent & component);
50
51 void setupMaterial(Context * context);
52
53 void resetComponent(ZipComponent & component);
54
56 bool useGpu = false;
57
58 VariableKey axisKey = {};
59 VariableKey parameterKey = {};
60 VariableKey diffuseColorKey = {};
61 VariableKey colorMapKey = {};
62 };
63 }
64}
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
void cleanup(Context *context) override
Provided for custom cleanup logic in derived systems.
Definition: ZipSystem.cpp:288
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
static const ResourceHandle_t NoHandle
Handle representing a default (or none if default not present) resource.
Component displaying a 3D log on a trajectory.
Definition: ZipComponent.h:17