CrystalSpace

Public API Reference

iWaterFactoryState Struct Reference
[Mesh plugins]

The water mesh is a simple mesh representation for a horizontal square. More...

#include <imesh/watermesh.h>

Inheritance diagram for iWaterFactoryState:

List of all members.

Public Types

enum  waterMeshType { WATER_TYPE_LOCAL, WATER_TYPE_OCEAN }
 

Types of water meshes.

More...

Public Member Functions

virtual uint GetGranularity ()=0
 Get the granularity of the mesh. See iWaterFactoryState::SetGranularity();.
virtual uint GetLength ()=0
 Get the length of the mesh in the x direction.
virtual float GetMurkiness ()=0
 Get the murkiness (alpha) of the water.
virtual uint GetWidth ()=0
 Get the width of the mesh in the z direction.
virtual void Invalidate ()=0
 Invalidates the render buffers.
virtual bool isOcean ()=0
 Returns true if the factory represents an ocean mesh.
virtual void SetAmplitudes (float amp1, float amp2, float amp3)=0
 Set the wave amplitudes.
virtual void SetDirections (csVector2 dir1, csVector2 dir2, csVector2 dir3)=0
 Set the wave directions.
virtual void SetFrequencies (float freq1, float freq2, float freq3)=0
 Set the wave frequencies.
virtual void SetGranularity (uint granularity)=0
 Get the granularity of the mesh.
virtual void SetLength (uint length)=0
 Set the length of the mesh in the x direction.
virtual void SetMurkiness (float murk)=0
 Set the murkiness (alpha) of the water.
virtual void SetPhases (float phase1, float phase2, float phase3)=0
 Set the wave phases.
virtual void SetWaterType (waterMeshType type)=0
 Set the water type.
virtual void SetWidth (uint width)=0
 Set the width of the mesh in the z direction.

Detailed Description

The water mesh is a simple mesh representation for a horizontal square.

It is best used in conjunction with a shader able to properly simulate the behavior of water. The mesh supports ocean rendering with extremely basic LOD.

The different properties that can be set for the waves are given by the amplitudes, phases, frequencies, and directions of combinations of sine and cosine waves used to permute the vertices. These values get passed to the proper shader via shader variables which permute the vertices in shader vertex programs.

These are the wave properties as outlined in section 4.1 in this paper by Jerry Tessendorf, presented in 2004, which uses ideas from Fournier and Reeves' paper from Siggraph '86 Proceedings:

http://www.finelightvisualtechnology.com/docs/coursenotes2004.pdf http://www.iro.umontreal.ca/~poulin/fournier/papers/p75-fournier.pdf

TODO: Move from Gerstner waves to a statistical model representation using Fast Fourier Transforms as described in section 4.3 of Tessendorf's paper.

Definition at line 54 of file watermesh.h.


Member Enumeration Documentation

Types of water meshes.

Note, that setting the type as WATER_TYPE_OCEAN ignores the values specified by iWaterFactoryState::SetLength(), iWaterFactoryState::SetWidth() and iWaterFactoryState::SetGranularity()

Enumerator:
WATER_TYPE_LOCAL 

Local water, used for a finite amount.

WATER_TYPE_OCEAN 

Ocean water, used for an infinite amount.

Definition at line 64 of file watermesh.h.


Member Function Documentation

virtual uint iWaterFactoryState::GetGranularity (  )  [pure virtual]

Get the granularity of the mesh. See iWaterFactoryState::SetGranularity();.

virtual uint iWaterFactoryState::GetLength (  )  [pure virtual]

Get the length of the mesh in the x direction.

virtual float iWaterFactoryState::GetMurkiness (  )  [pure virtual]

Get the murkiness (alpha) of the water.

virtual uint iWaterFactoryState::GetWidth (  )  [pure virtual]

Get the width of the mesh in the z direction.

virtual void iWaterFactoryState::Invalidate (  )  [pure virtual]

Invalidates the render buffers.

This function should be called when there has been a significant change to the dimensions and or granularity of the water mesh.

virtual bool iWaterFactoryState::isOcean (  )  [pure virtual]

Returns true if the factory represents an ocean mesh.

virtual void iWaterFactoryState::SetAmplitudes ( float  amp1,
float  amp2,
float  amp3 
) [pure virtual]

Set the wave amplitudes.

virtual void iWaterFactoryState::SetDirections ( csVector2  dir1,
csVector2  dir2,
csVector2  dir3 
) [pure virtual]

Set the wave directions.

virtual void iWaterFactoryState::SetFrequencies ( float  freq1,
float  freq2,
float  freq3 
) [pure virtual]

Set the wave frequencies.

virtual void iWaterFactoryState::SetGranularity ( uint  granularity  )  [pure virtual]

Get the granularity of the mesh.

This determines the number of vertices that get used per unit length. A higher granularity gives nicer effects for wave simulation and fluid dynamics, but is more expensive to draw. Default value is 1.

virtual void iWaterFactoryState::SetLength ( uint  length  )  [pure virtual]

Set the length of the mesh in the x direction.

virtual void iWaterFactoryState::SetMurkiness ( float  murk  )  [pure virtual]

Set the murkiness (alpha) of the water.

virtual void iWaterFactoryState::SetPhases ( float  phase1,
float  phase2,
float  phase3 
) [pure virtual]

Set the wave phases.

virtual void iWaterFactoryState::SetWaterType ( waterMeshType  type  )  [pure virtual]

Set the water type.

virtual void iWaterFactoryState::SetWidth ( uint  width  )  [pure virtual]

Set the width of the mesh in the z direction.


The documentation for this struct was generated from the following file:

Generated for Crystal Space 2.0 by doxygen 1.6.1