|
Colobot
|
Water manager/renderer. More...
#include <src/graphics/engine/water.h>
Classes | |
| struct | WaterLine |
| Water strip. More... | |
| struct | WaterVapor |
| Water particle effect. More... | |
Public Member Functions | |
| CWater (CEngine *engine) | |
| bool | EventProcess (const Event &event) |
| void | Flush () |
| Removes all the water. More... | |
| void | Create (WaterType type1, WaterType type2, const std::string &fileName, Color diffuse, Color ambient, float level, float glint, Math::Vector eddy) |
| Creates all expanses of water. More... | |
| void | DrawBack () |
| Draw the back surface of the water. More... | |
| void | DrawSurf () |
| Draws the flat surface of the water. More... | |
| void | SetLevel (float level) |
| Changes the level of the water. More... | |
| float | GetLevel () |
| Returns the current level of water. More... | |
| float | GetLevel (CObject *object) |
| Returns the current level of water for a given object. More... | |
| void | SetLava (bool lava) |
| Management of the mode of lava/water. More... | |
| bool | GetLava () |
| void | AdjustEye (Math::Vector &eye) |
| Adjusts the eye of the camera, not to be in the water. More... | |
Protected Member Functions | |
| bool | EventFrame (const Event &event) |
| Makes water evolve. More... | |
| void | LavaFrame (float rTime) |
| Makes evolve the steam jets on the lava. More... | |
| void | AdjustLevel (Math::Vector &pos, Math::Vector &norm, Math::Point &uv1, Math::Point &uv2) |
| Adjusts the position to normal, to imitate reflections on an expanse of water at rest. More... | |
| bool | GetWater (int x, int y) |
| Indicates if there is water in a given position. More... | |
| void | CreateLine (int x, int y, int len) |
| Updates the positions, relative to the ground. More... | |
| void | VaporFlush () |
| Removes all the steam jets. More... | |
| bool | VaporCreate (ParticleType type, Math::Vector pos, float delay) |
| Creates a new steam. More... | |
| void | VaporFrame (int i, float rTime) |
| Makes evolve a steam jet. More... | |
Protected Attributes | |
| CEngine * | m_engine = nullptr |
| CDevice * | m_device = nullptr |
| CTerrain * | m_terrain = nullptr |
| CParticle * | m_particle = nullptr |
| CSoundInterface * | m_sound = nullptr |
| WaterType | m_type [2] = {} |
| std::string | m_fileName |
| float | m_level = 0.0f |
| Overall level. More... | |
| float | m_glint = 0.0f |
| Amplitude of reflections. More... | |
| Math::Vector | m_eddy |
| Amplitude of swirls. More... | |
| Color | m_diffuse |
| Diffuse color. More... | |
| Color | m_ambient |
| Ambient color. More... | |
| float | m_time = 0.0f |
| float | m_lastLava = 0.0f |
| int | m_subdiv = 4 |
| int | m_brickCount = 0 |
| Number of brick*mosaics. More... | |
| float | m_brickSize = 0 |
| Size of a item in an brick. More... | |
| std::vector< WaterLine > | m_lines |
| std::vector< WaterVapor > | m_vapors |
| bool | m_draw = true |
| bool | m_lava = false |
| Color | m_color = Color(1.0f, 1.0f, 1.0f, 1.0f) |
Water manager/renderer.
Water is drawn where the terrain is below specified level. The mapping is based on terrain coordinates - for each "brick" coordinate, the level of terrain is tested. For every Y coordinate, many lines in X direction are created (WaterLines).
There are two parts of drawing process: drawing the background image blocking the normal sky layer and drawing the surface of water. The surface is drawn with texture, so with proper texture it can be lava.
| void Gfx::CWater::Flush | ( | ) |
Removes all the water.
| void Gfx::CWater::Create | ( | WaterType | type1, |
| WaterType | type2, | ||
| const std::string & | fileName, | ||
| Color | diffuse, | ||
| Color | ambient, | ||
| float | level, | ||
| float | glint, | ||
| Math::Vector | eddy | ||
| ) |
Creates all expanses of water.
| void Gfx::CWater::DrawBack | ( | ) |
Draw the back surface of the water.
This surface prevents to see the sky (background) underwater!
| void Gfx::CWater::DrawSurf | ( | ) |
Draws the flat surface of the water.
| void Gfx::CWater::SetLevel | ( | float | level | ) |
Changes the level of the water.
| float Gfx::CWater::GetLevel | ( | ) |
Returns the current level of water.
| float Gfx::CWater::GetLevel | ( | CObject * | object | ) |
Returns the current level of water for a given object.
| void Gfx::CWater::SetLava | ( | bool | lava | ) |
Management of the mode of lava/water.
| void Gfx::CWater::AdjustEye | ( | Math::Vector & | eye | ) |
Adjusts the eye of the camera, not to be in the water.
|
protected |
Makes water evolve.
|
protected |
Makes evolve the steam jets on the lava.
|
protected |
Adjusts the position to normal, to imitate reflections on an expanse of water at rest.
|
protected |
Indicates if there is water in a given position.
|
protected |
Updates the positions, relative to the ground.
|
protected |
Removes all the steam jets.
|
protected |
Creates a new steam.
|
protected |
Makes evolve a steam jet.
|
protected |
Overall level.
|
protected |
Amplitude of reflections.
|
protected |
Amplitude of swirls.
|
protected |
Diffuse color.
|
protected |
Ambient color.
|
protected |
Number of brick*mosaics.
|
protected |
Size of a item in an brick.
1.8.16