Cogs.Core
BeamGroupComponent.h
1#pragma once
2
3#include "Components/Core/DynamicComponent.h"
4
5#include "Resources/Resources.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
11 namespace EchoSounder
12 {
13 struct DataSetComponent;
14 struct DataSetSystem;
15
16 enum struct Topology : uint32_t
17 {
18 SingleBeam,
19 VerticalPlane,
20 TransversalPlane,
21 ConeSector,
22 Grid,
23 Cone
24 };
25
27 {
28 static void registerType();
29
30 void initialize(Context * context);
31
32 void update();
33
35 void requestCallback(std::function<void(Context*)> func) { callback = func; }
36
37 bool sane = false; // maintained by update
38 uint32_t gen = 1; // Changes if beamgroup or referenced data has changed the layout.
39
40 Topology topology = Topology::SingleBeam;
41
42 uint32_t majorCount = 0;
43 uint32_t minorCount = 0;
44 std::vector<uint32_t> beams;
45
46 std::vector<float> directionX;
47 std::vector<float> directionY;
48 float minDirectionX = 0.0f;
49 float maxDirectionX = 0.0f;
50 float minDirectionY = 0.0f;
51 float maxDirectionY = 0.0f;
52 float maxBeamWidthX = 0.0f;
53 float maxBeamWidthY = 0.0f;
54 float minDistance = 0.0f;
55 float maxDistance = 0.0f;
56 bool minorClosed = false;
57
58
59 private:
60 Context * context = nullptr;
61 DataSetComponent * dataComp_ = nullptr;
62 uint32_t dataConfGen = 0;
63 uint32_t majorCount_ = 0;
64 uint32_t minorCount_ = 0;
65 std::vector<uint32_t> beams_;
66 std::function<void(Context*)> callback;
67 };
68
69 }
70 }
71}
72
73template<> inline Cogs::StringView getName<Cogs::Core::EchoSounder::Topology>() { return "EchoTopology"; }
74
75template<> inline Cogs::StringView getName<Cogs::Core::EchoSounder::BeamGroupComponent>() { return "EchoBeamGroupComponent"; }
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Base class for components implementing dynamic behavior.
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
@ Cone
Generic cone shape.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
bool minorClosed
Maintained by BeamGroupComponent::update.
std::vector< float > directionY
Subset of directions, maintained by BeamGroupComponent::update.
float minDistance
Along ray, maintained by BeamGroupComponent::update.
float maxBeamWidthY
Maintained by BeamGroupComponent::update.
void requestCallback(std::function< void(Context *)> func)
Used by OctProviderSystem to get a hook.
float maxBeamWidthX
Maintained by BeamGroupComponent::update.
float minDirectionY
Maintained by BeamGroupComponent::update.
float minDirectionX
Maintained by BeamGroupComponent::update.
std::vector< float > directionX
Subset of directions, maintained by BeamGroupComponent::update.
float maxDirectionX
Maintained by BeamGroupComponent::update.
float maxDistance
Along ray, maintained by BeamGroupComponent::update.
float maxDirectionY
Maintained by BeamGroupComponent::update.