3#include "EntityDefinition.h"
4#include "Resources/Resources.h"
5#include "Systems/ComponentSystem.h"
6#include "Services/TaskManager.h"
8#include "../Components/UniformGridComponent.h"
13#include <unordered_map>
15namespace Cogs::Core::EchoSounder
17 struct UniformGridSampleData;
18 struct UniformGridSystem;
21 uint32_t configId = 0;
22 uint32_t coordSys = 0;
23 uint32_t majorCount = 0;
24 uint32_t minorCount = 0;
25 uint32_t sampleCount = 0;
26 float depthOffset = 0.0f;
27 float depthStep = 0.0f;
28 glm::vec3 transducerAlpha;
29 glm::vec3 transducerOffset;
30 std::vector<float> directionX;
31 std::vector<float> directionY;
32 std::vector<float> beamWidthX;
33 std::vector<float> beamWidthY;
36 uint32_t configId = 0;
37 int64_t timestamp = 0;
39 glm::quat orientation;
42 typedef uint64_t TileKey;
43 inline TileKey encodeTileKey(glm::uvec3 pos)
45 return (((TileKey)(pos.x&0xffff))<<0 |
46 ((TileKey)(pos.y&0xffff))<<16 |
47 ((TileKey)(pos.z&0xffff))<<32);
49 inline glm::uvec3 decodeTileKey(TileKey key)
51 return glm::uvec3((key>>0)&0xffff, (key>>16)&0xffff, (key>>32)&0xffff);
55 float *data =
nullptr;
57 uint64_t ping_number = 0;
58 float minValue = 0.0f;
59 float maxValue = 0.0f;
61 bool update_iso =
false;
68 std::unordered_map<uint32_t ,std::shared_ptr<UniformGridConfig>> config;
71 std::condition_variable cv;
73 bool shutdown =
false;
74 bool change_sv =
false;
75 bool update_iso =
false;
78 std::unordered_map<TileKey, Tile> tiles;
79 std::vector<Entity*> destroy;
84 float decibelMin = 0.0f;
85 float decibelMax = 0.0f;
91 ComputeType compute = ComputeType::Reference;
92 std::vector<float> thresholds;
93 std::vector<MaterialInstanceHandle> layerMaterialInstances;
97 glm::quat vesselOrientationGlobal;
98 glm::vec3 vesselPositionGlobal;
99 std::unordered_map<uint32_t, EntityPtr> boundingFrustum;
101 uint64_t ping_number = 0;
102 uint64_t pings_handled = 0;
103 uint64_t pings_droped = 0;
105 uint64_t evict_number = 0;
109 std::atomic<uint32_t> us = 0;
110 std::atomic<uint32_t> N = 0;
111 } sample_intersecting;
114 std::atomic<uint32_t> us = 0;
115 std::atomic<uint32_t> N = 0;
119 std::atomic<uint32_t> analyze = 0;
120 std::atomic<uint32_t> vtx = 0;
121 std::atomic<uint32_t> idx = 0;
122 std::atomic<uint32_t> N = 0;
125 bool update_isosurface();
134 void sample_intersecting(
size_t start,
size_t end);
135 void sample_inside(
size_t start,
size_t end);
137 void sample_ref(
float *data,
const float *v, uint32_t z, uint32_t y, uint32_t x,
float r2, glm::vec3 q);
138 void sample_sn90_ref(
float *data,
const float *v, uint32_t z, uint32_t y, uint32_t x,
float r2, glm::vec3 q);
144 std::shared_ptr<UniformGridConfig> config;
152 float filter_falloff;
155 uint64_t ping_number;
157 glm::quat vesselOrientationGlobal;
158 glm::vec3 vesselPositionGlobal;
159 glm::quat arrayOrientationGlobal;
160 glm::vec3 arrayPositionGlobal;
161 glm::quat inverseOrientation;
165 float minDistanceSquared;
166 float maxDistanceSquared;
168 glm::vec4 frustum[6];
170 glm::uvec3 maxIndices;
171 glm::vec3 polarShift;
172 glm::vec3 polarScale;
178 std::vector<glm::ivec3> tiles_intersecting;
179 std::vector<glm::ivec3> tiles_inside;
Context * context
Pointer to the Context instance the system lives in.
void preUpdate()
Run the pre-update method of the system.
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.
Base allocator implementation.
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
uint16_t TaskQueueId
Unique id for a task queue.
ComponentIndex SizeType
Type used to track the size of pools.
Handle to a Component instance.
Task id struct used to identify unique Task instances.