Colobot
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Gfx::CWater Class Reference

Water manager/renderer. More...

#include <water.h>

Classes

struct  WaterLine
 Water strip. More...
 
struct  WaterVapor
 Water particle effect. More...
 

Public Member Functions

 CWater (CEngine *engine)
 
void SetDevice (CDevice *device)
 
bool EventProcess (const Event &event)
 
void Flush ()
 Removes all the water.
 
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.
 
void DrawBack ()
 Draw the back surface of the water. More...
 
void DrawSurf ()
 Draws the flat surface of the water.
 
void SetLevel (float level)
 Changes the level of the water.
 
float GetLevel ()
 Returns the current level of water.
 
float GetLevel (CObject *object)
 Returns the current level of water for a given object.
 
void AdjustEye (Math::Vector &eye)
 Adjusts the eye of the camera, not to be in the water.
 
void SetLava (bool lava)
 Management of the mode of lava/water.
 
bool GetLava ()
 

Protected Member Functions

bool EventFrame (const Event &event)
 Makes water evolve.
 
void LavaFrame (float rTime)
 Makes evolve the steam jets on the lava.
 
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.
 
bool GetWater (int x, int y)
 Indicates if there is water in a given position.
 
void CreateLine (int x, int y, int len)
 Updates the positions, relative to the ground.
 
void VaporFlush ()
 Removes all the steam jets.
 
bool VaporCreate (ParticleType type, Math::Vector pos, float delay)
 Creates a new steam.
 
void VaporFrame (int i, float rTime)
 Makes evolve a steam jet.
 

Protected Attributes

CEnginem_engine = nullptr
 
CDevicem_device = nullptr
 
CTerrainm_terrain = nullptr
 
CParticlem_particle = nullptr
 
CSoundInterfacem_sound = nullptr
 
WaterType m_type [2] = {}
 
std::string m_fileName
 
float m_level = 0.0f
 Overall level.
 
float m_glint = 0.0f
 Amplitude of reflections.
 
Math::Vector m_eddy
 Amplitude of swirls.
 
Color m_diffuse
 Diffuse color.
 
Color m_ambient
 Ambient color.
 
float m_time = 0.0f
 
float m_lastLava = 0.0f
 
int m_subdiv = 4
 
int m_brickCount = 0
 Number of brick*mosaics.
 
float m_brickSize = 0
 Size of a item in an brick.
 
std::vector< WaterLinem_lines
 
std::vector< WaterVaporm_vapors
 
bool m_draw = true
 
bool m_lava = false
 
Color m_color = Color(1.0f, 1.0f, 1.0f, 1.0f)
 

Detailed Description

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.

Member Function Documentation

void Gfx::CWater::DrawBack ( )

Draw the back surface of the water.

This surface prevents to see the sky (background) underwater!


The documentation for this class was generated from the following files: