FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CloudImage.h
1#pragma once
2#ifdef FH_VISUALIZATION
3
4# include <OgreTexture.h>
5# include <OgreVector.h>
6# include <array>
7# include <string>
8
9namespace Ogre
10{
11class Camera;
12class Rectangle2D;
13class SceneManager;
14class Viewport;
15} // namespace Ogre
16
17namespace visual
18{
19
27class CloudImage
28{
29public:
31 struct Clouds
32 {
33 Ogre::TexturePtr weather, shape, skyCube;
34 Ogre::Matrix4 skyToCube = Ogre::Matrix4::IDENTITY;
35 Ogre::Vector4 params, scale, drift, volume;
36 Ogre::Vector3 sunDirection, sun, sky, airExtinction;
37 float hazeLight = 1.0f;
38 };
39
40 CloudImage();
41 ~CloudImage();
42 CloudImage(const CloudImage&) = delete;
43 CloudImage& operator=(const CloudImage&) = delete;
44
50 void Render(Ogre::Viewport* viewport, const Clouds& clouds, float seaZ, bool withHaze);
51
55 void RenderCube(const Ogre::TexturePtr& cube, const Clouds& clouds, const Ogre::Vector3& eye, const Ogre::Matrix3& cubeToWorld);
56
58 Ogre::TexturePtr Texture() const { return m_targets[m_current]; }
59
61 bool Flipped() const { return m_flipped; }
62
63private:
64 void Create(int width, int height);
65 void Destroy();
66
67 Ogre::SceneManager* m_sceneMgr = nullptr;
68 Ogre::Camera* m_camera = nullptr;
69 Ogre::Rectangle2D* m_rect = nullptr;
70 Ogre::Rectangle2D* m_cubeRect = nullptr; // with the cube face material, shown only while the cube is drawn
71 Ogre::Texture* m_cubeWithViewports = nullptr;
72 std::array<Ogre::TexturePtr, 2> m_targets;
73 int m_current = 0;
74 int m_width = 0, m_height = 0;
75 bool m_flipped = true;
76 bool m_historyValid = false;
77 float m_frame = 0.0f;
78 Ogre::Vector3 m_prevEye {0.0f, 0.0f, 0.0f}, m_prevForward {1.0f, 0.0f, 0.0f}, m_prevRight {0.0f, 1.0f, 0.0f}, m_prevUp {0.0f, 0.0f, -1.0f};
79 Ogre::Vector2 m_prevTan {1.0f, 1.0f};
80 Ogre::Vector4 m_prevDrift {0.0f, 0.0f, 0.0f, 0.0f};
81};
82
83} // namespace visual
84#endif
Visualization utilities.
Definition VisualDomain.h:12
@ Texture
The image set of Visual.Sky (also the only choice of the classic look).