FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
UnderwaterPass.h
1#pragma once
2#ifdef FH_VISUALIZATION
3
4# include <OgreTexture.h>
5# include <OgreVector.h>
6# include <vector>
7
8namespace Ogre
9{
10class Pass;
11class Viewport;
12} // namespace Ogre
13
14namespace visual
15{
16
18struct UnderwaterState
19{
20 bool enabled = false;
21 Ogre::Vector4 waterPlane {0, 0, 1, 0};
22 float seaLevel = 0.0f;
23 Ogre::Vector3 absorption {0.45f, 0.07f, 0.04f};
24 Ogre::Vector3 backscatter {0.004f, 0.005f, 0.006f};
25 float clarityScale = 1.0f;
26 bool depthDimming = true;
27 Ogre::Vector3 sunBelow {0.0f, 0.0f, 0.0f};
28 Ogre::Vector3 skyBelow {1.0f, 1.0f, 1.0f};
29 Ogre::Vector3 sunBelowClear {0.0f, 0.0f, 0.0f};
30 bool cloudShadowMap = false;
31 Ogre::Vector3 sunDirection {0.0f, 0.0f, -1.0f};
32 float caustics = 1.0f;
33 float time = 0.0f;
34 std::vector<float> waveAmp;
35 std::vector<float> waveData;
36 Ogre::TexturePtr tailMoments;
37 Ogre::Vector4 tailLayer0 {1, 0, 0.05f, 0};
38
39 // Fog above the water (`Visual.FogVisibility`, `Visual.FogHeight`): an exponential layer, coloured by the sky just
40 // above the horizon in each direction plus the sun's forward scattering.
41 float fogExtinction = 0.0f;
42 float hazeExtinction = 0.0f;
43 Ogre::Vector4 lens {0.0f, 0.0f, 0.0f, 0.0f};
44 float fogHeight = 50.0f;
45 float fogBanks = 0.0f;
46 float fogBankSize = 1500.0f;
47 float rainExtinction = 0.0f;
48 float rainTop = 1500.0f;
49 Ogre::Vector3 fogSun {0.0f, 0.0f, 0.0f};
50 Ogre::TexturePtr skyCube;
51 Ogre::Matrix4 skyToCube = Ogre::Matrix4::IDENTITY;
52 float skyMaxMip = 0.0f;
53 float skyIntensity = 1.0f;
54
55 Ogre::TexturePtr waterMap;
56 Ogre::Vector4 waterMapRect {0.0f, 0.0f, 1.0f, 1.0f};
57 // Volumetric clouds in front of the scene, when the camera is in or above them (ADR 0009 D22, D24).
58 bool cloudsOn = false;
59 Ogre::TexturePtr cloudImage;
60};
61
66class UnderwaterPass
67{
68public:
70 static constexpr const char* kMaterial = "Environment/Underwater/Pass";
71
73 explicit UnderwaterPass(Ogre::Viewport* viewport);
74 ~UnderwaterPass();
75 UnderwaterPass(const UnderwaterPass&) = delete;
76 UnderwaterPass& operator=(const UnderwaterPass&) = delete;
77
79 void SetState(const UnderwaterState& state) { m_state = state; }
80
85 void Apply(Ogre::Pass& pass);
86
87private:
88 Ogre::Viewport* m_viewport;
89 UnderwaterState m_state;
90 Ogre::Texture* m_boundTail = nullptr;
91 Ogre::Texture* m_boundSky = nullptr;
92 Ogre::Texture* m_boundMap = nullptr;
93};
94
95} // namespace visual
96#endif
Visualization utilities.
Definition VisualDomain.h:12