Cogs.Core
PingOutlineComponent.h
1#pragma once
2#include <string>
3
4#include "EntityDefinition.h"
5#include "Components/Core/DynamicComponent.h"
6
7#include "Resources/Resources.h"
8
9#include <glm/vec3.hpp>
10#include <glm/vec4.hpp>
11
12namespace Cogs
13{
14 namespace Core
15 {
16 namespace EchoSounder
17 {
18 struct Config;
19 struct BeamGroupComponent;
20 struct DataSetComponent;
21 struct DataSetSystem;
22 struct DataSetData;
23
24 enum class AnnotationType
25 {
26 VerticalDepth,
27 Range,
28 };
29
30 enum class ConnectedTicksMode {
31 None,
32 Fan,
33 Grid,
34 };
35
36 //describes where to put the annotation markers. Only meaningfull for grids, at it has four sides it can be placed on
37 enum class AnnotationPosition {
38 Front,
39 Right,
40 };
41
43 {
44 static void registerType();
45
46 void initialize(Context * context);
47
48 void update();
49
50 bool flat = false;
51 bool individualBeams = false; // Individual beam geometry or just outline of fan.
52 ConnectedTicksMode connectedTicks = ConnectedTicksMode::None; // Let tick-marks span across fan.
53 AnnotationPosition annotationPosition = AnnotationPosition::Front;
54 bool showVesselCoordsys = false;
55 bool showBoundingFrustum = false;
56 bool showAABB = false;
57
58 AnnotationType annotationType = AnnotationType::Range;
59 int numTickMarks = 10; // Approx number of ticks, 0 to disable.
60 float tickLength = 0.2f; // Size of tick relative to distance between ticks.
61 std::string unit = ""; // Unit of depth values.
62 float widthScaleAlongship = 1.f;
63 float widthScaleAthwartship = 1.f;
64 float depthStart = std::numeric_limits<float>::quiet_NaN();// Set individual depth start, nan uses dataset start.
65 float depthRange = std::numeric_limits<float>::quiet_NaN(); // Set individual depth range, nan uses dataset range.
66 float verticalDepthMax = std::numeric_limits<float>::quiet_NaN();
67
68 glm::vec4 textColor;
69 private:
70 Context* context = nullptr;
71 DataSetSystem* dataSystem = nullptr;
72 uint32_t configGen = 0;
73 EntityPtr annotation[2];
74 EntityPtr vesselCoordSys;
75 EntityPtr boundingFrustum;
76 EntityPtr axisAlignedBBox;
77 EntityPtr annoLineMesh;
78
79 void createTickGeometryAndAnnotations(Context* context,
80 const std::vector<float>& directionX,
81 const std::vector<float>& directionY,
82 const uint32_t minorCount,
83 const uint32_t majorCount,
84 const bool minorClosed,
85 const Config& config);
86
87 void addAnnotations(std::vector<glm::vec3> &V,
88 std::vector<uint32_t> &indices,
89 size_t tickA, size_t tickB, float depthStep,
90 const std::vector<glm::vec3> &dirs,
91 const glm::vec3 & translation,
92 float maxDistance, bool showTicks, bool connectTicks);
93
94 void createBeamCenterGeometry(std::vector<glm::vec3>& V,
95 std::vector<uint32_t>& indices,
96 Context* context,
97 const std::vector<float>& directionX,
98 const std::vector<float>& directionY,
99 bool individualBeams,
100 const uint32_t bN,
101 const Config& config);
102
103 void createBeamExtentGeometry(std::vector<glm::vec3>& V,
104 std::vector<uint32_t>& indices,
105 Context* context,
106 const std::vector<float>& directionX,
107 const std::vector<float>& directionY,
108 const uint32_t bN,
109 const Config& config);
110 };
111 }
112 }
113}
114template<> inline Cogs::StringView getName<Cogs::Core::EchoSounder::ConnectedTicksMode>() { return "EchoConnectedTicksMode"; }
115template<> inline Cogs::StringView getName<Cogs::Core::EchoSounder::AnnotationType>() { return "EchoAnnotationType"; }
116template<> inline Cogs::StringView getName<Cogs::Core::EchoSounder::AnnotationPosition>() { return "EchoAnnotationPosition"; }
117
118template<> inline Cogs::StringView getName<Cogs::Core::EchoSounder::PingOutlineComponent>() { return "EchoPingOutlineComponent"; }
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
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
Definition: EntityPtr.h:12
@ Front
Front face of primitives discarded before rasterization.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23