Cogs.Core
DataSetSystem.h
1#pragma once
2
3#include "ExtensionRegistry.h"
4#include "Systems/ComponentSystem.h"
5
6#include "../Components/DataSetComponent.h"
7
8namespace Cogs
9{
10 namespace Core
11 {
12 namespace EchoSounder
13 {
15 {
16 glm::quat vesselOrientationGlobal;
17 glm::vec3 vesselPositionGlobal;
18 glm::quat arrayOrientationVessel;
19 glm::vec3 arrayPositionVessel;
20 glm::quat arrayOrientationGlobal;
21 glm::vec3 arrayPositionGlobal;
22 };
23
25 {
26 uint32_t sliceBegin = 0;
27 uint32_t sliceCount = 0;
30 Memory::TypedBuffer<float> bottomDepths;
31 Memory::TypedBuffer<float> bottomReflectivities;
34 };
35
36 // Data used by re-sampling task, must be kept alive as long
37 // as task is running regardless of component gets removed or not.
39 {
40 // Current data
41 Config config;
42 DataSetBuffers buffer;
43
44 // New data if dataReady is true.
45 Config configNew;
46 DataSetBuffers bufferNew;
47
48 bool dataReady = false;
49 bool configReady = false;
50 bool configValid = false;
51 std::atomic<int> runningTasks = 0;
52 };
53
55 {
57 {
58 persistent.reset(new DataSetPersistent);
59 }
60
61 std::shared_ptr<DataSetPersistent> persistent;
62
63 uint32_t configGen = 0;
64 uint32_t dataGen = 0; //increased when data is changed
65 uint32_t clearGen = 0; //increased when data is cleared
66 uint32_t slicePreservedBegin = 0;
67 uint32_t slicePreservedCount = 0;
68 };
69
71 : public ComponentSystemWithDataPool<DataSetComponent, DataSetData>
72 {
73 public:
74 DataSetSystem(Memory::Allocator * allocator, SizeType capacity) : ComponentSystemWithDataPool(allocator, capacity) {}
75
76 void update(Context * context) override;
77
78 private:
79 bool handleConfigTransition(Context* context, DataSetData& dataData);
80 void handleNewPing(DataSetData& dataData, Ping& ping);
81 void resizeBuffers(DataSetData& dataData);
82
83 void updateGridAngles(DataSetData& dataData);
84 };
85
86 }
87 }
88}
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 all Cogs related functionality.
Definition: FieldSetter.h:23
ComponentIndex SizeType
Type used to track the size of pools.
Definition: Component.h:19