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

Water manager/renderer. More...

#include <water.h>

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
 
CDevicem_device
 
CTerrainm_terrain
 
CParticlem_particle
 
CSoundInterfacem_sound
 
WaterType m_type [2]
 
std::string m_fileName
 
float m_level
 Overall level.
 
float m_glint
 Amplitude of reflections.
 
Math::Vector m_eddy
 Amplitude of swirls.
 
Color m_diffuse
 Diffuse color.
 
Color m_ambient
 Ambient color.
 
float m_time
 
float m_lastLava
 
int m_subdiv
 
int m_brickCount
 Number of brick*mosaics.
 
float m_brickSize
 Size of a item in an brick.
 
std::vector< WaterLinem_lines
 
std::vector< WaterVaporm_vapors
 
bool m_draw
 
bool m_lava
 
Color m_color
 

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: