Cogs.Core
DataSetComponent.h
1#pragma once
2
3#include "Resources/Buffer.h"
4
5#include "Foundation/ComponentModel/Component.h"
6#include "Foundation/Memory/MemoryBuffer.h"
7
8#include <glm/vec3.hpp>
9
10#include <vector>
11
12namespace Cogs
13{
14 namespace Core
15 {
16 namespace EchoSounder
17 {
18
19 struct Config
20 {
21 uint32_t coordSys = 0;
22 uint32_t capacity = 0;
23 uint32_t beamCount = 0;
24 uint32_t sampleCount = 0;
25 float depthOffset = 0;
26 float depthStep = 0;
27 bool useDecibel = true;
28 bool tryPreserve = true;
29 glm::vec3 transducerAlpha;
30 glm::vec3 transducerOffset;
31 std::vector<float> directionX;
32 std::vector<float> directionY;
33 std::vector<float> beamWidthX;
34 std::vector<float> beamWidthY;
35 };
36
37 struct Ping
38 {
39 uint32_t beamCount = 0;
40 uint32_t sampleCount = 0;
41
42 int64_t timestamp = 0;
43 glm::vec3 position;
44 glm::quat orientation;
45
46 const size_t valuesOffset() const { return 0; }
47 const size_t valuesSize() const { return sizeof(float)*beamCount * sampleCount; }
48
49 const size_t depthsOffset() const { return valuesOffset() + valuesSize(); }
50 const size_t bottomDepthsSize() const { return sizeof(float)*beamCount; }
51
52 const size_t bottomReflectivitiesOffset() const { return depthsOffset() + bottomDepthsSize(); }
53 const size_t bottomReflectivitiesSize() const { return sizeof(float)*beamCount; }
54
55 const size_t storageSize() const { return bottomReflectivitiesOffset() + bottomReflectivitiesSize(); }
56
57 float* values() { return (float*)((char*)(storage.data()) + valuesOffset()); }
58 float* bottomDepths() { return (float*)((char*)(storage.data()) + depthsOffset()); }
59 float* bottomReflectivities() { return (float*)((char*)(storage.data()) + bottomReflectivitiesOffset()); }
60
62 };
63
65 {
66 virtual ~MessageBase() {}
67 };
68
70 {
71 };
72
74 {
75 Config config;
76 };
77
79 {
80 Ping ping;
81 };
82
84 {
85 glm::vec3 position;
86 glm::vec4 orientation;
87 };
88
90 {
91 std::list<MessageBase*> messages;
92
93 static void registerType();
94 };
95 }
96 }
97}
98
99template<> inline
100Cogs::StringView getName<Cogs::Core::EchoSounder::DataSetComponent>()
101{
102 return "EchoDataSetComponent";
103}
Base class for Component instances.
Definition: Component.h:143
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains all Cogs related functionality.
Definition: FieldSetter.h:23