Marine systems simulation
Loading...
Searching...
No Matches
FlowPlane.h
1#pragma once
2#ifdef FH_VISUALIZATION
3
4# include <OgreManualObject.h>
5# include <OgreRoot.h>
6# include <OgreSceneNode.h>
7# include <OgreSubMesh.h>
8# include <array>
9# include <fhsim_environment/EnvironmentProvider.h>
10# include <functional>
11# include <vector>
12
13namespace visual
14{
15
17struct FlowPlaneSettings
18{
20 double position[3] = {0.0, 0.0, 0.0};
22 double localX[3] = {1.0, 0.0, 0.0};
24 double localY[3] = {0.0, 1.0, 0.0};
26 double size[2] = {50.0, 50.0};
28 int vertexCounts[2] = {50, 50};
30 double visibleRange[2] = {0.0, 1.0};
32 double colorRange[2] = {0.0, 1.0};
34 double alphaRange[2] = {0.3, 0.6};
35};
36
38using ComputeFunction = std::function<double(double T, const double pos[3])>;
39
46class FlowPlane
47{
48public:
56 FlowPlane(Ogre::Root* ogreRoot,
57 environment::EnvironmentProvider* provider,
58 const FlowPlaneSettings& settings,
59 ComputeFunction computeFunc = nullptr);
60
61 ~FlowPlane() = default;
62 FlowPlane(const FlowPlane&) = delete;
63 FlowPlane& operator=(const FlowPlane&) = delete;
64
69 void Update(double T);
70
77 void SetTransform(const double position[3], const double localX[3], const double localY[3]);
78
86 void SetComputeFunction(ComputeFunction func);
87
88private:
93 void UpdateVertexPositions();
94
99 void UpdateOgreNodeOrientation();
100
102 environment::EnvironmentProvider* m_provider;
104 Ogre::SceneNode* m_node;
106 Ogre::SubMesh* m_subMesh;
108 int m_vertexCounts[2];
110 double m_size[2];
112 double m_position[3];
114 double m_localX[3];
116 double m_localY[3];
118 double m_speedMin;
120 double m_speedMax;
122 std::vector<std::array<double, 3>> m_vertexWorldPos;
124 ComputeFunction m_computeFunction;
126 Ogre::Entity* m_entity;
128 int m_defaultRenderQueueGroup;
129};
130
131} // namespace visual
132#endif // FH_VISUALIZATION
Visualization utilities.
Definition EnvironmentSettings.h:13