version 3.3

EnvironmentRenderer::WaterSurface Class Reference

A WaterSurface is a polygonal area that is rendered as a water surface with typical water effects such as waves, reflections, etc. More...

#include <vrs/environment/watersurface.h>

Inheritance diagram for EnvironmentRenderer::WaterSurface:

VRS::MappedVertexAttributeShapeGL VRS::Shape VRS::RenderObj VRS::SharedObj VRS::Visitable EnvironmentRenderer::PolygonSetWaterSurface

List of all members.

Public Member Functions

 WaterSurface (VRS::SO< VRS::Iterator< VRS::SO< VRS::Facet > > > surface, const VRS::Vector &flowDirection, const VRS::Color &waterColor=VRS::Color::slate_blue, float fresnelBias=0.0f, const VertexData2f &reflectionScale=VertexData2f(0.2f, 0.2f), const VertexData2f &refractionScale=VertexData2f(0.2f, 0.2f), double junctionSize=0.0, bool refracting=false, const VRS::Matrix &waveTf=VRS::Matrix::identity)
 'surface' specifies the geometry.
virtual VRS::Bounds boundingBox () const
 see shape.h
VRS::SO< VRS::Iterator
< VRS::SO< VRS::Facet > > > 
getSurface () const
void setSurface (VRS::SO< VRS::Iterator< VRS::SO< VRS::Facet > > > surface)
const VRS::VectorgetFlowDirection () const
void setFlowDirection (const VRS::Vector &flowDirection)
void setReflectionScale (const VRS::VertexData< 2, float > &scale)
const VRS::VertexData< 2, float > & getReflectionScale () const
void setRefractionScale (const VRS::VertexData< 2, float > &scale)
const VRS::VertexData< 2, float > & getRefractionScale () const
void setRefracting (bool enable)
bool isRefracting ()
void setFresnelBias (float bias)
float getFresnelBias () const
void setWaterColor (const VRS::Color &color)
const VRS::ColorgetWaterColor () const
double getJunctionSize () const
void setJunctionSize (double size)
void setWaveTf (const VRS::Matrix &tf)
const VRS::MatrixwaveTf () const
const PlanegetPlane () const
void setPlane (const Plane &p)
 VRS_TYPEINFO (WaterSurface, VRS::Shape)
 VRS_SERIALIZABLE (WaterSurface)

Protected Member Functions

 WaterSurface ()
void createGeometry ()

Protected Attributes

VRS::SO< VRS::Iterator
< VRS::SO< VRS::Facet > > > 
m_surface
VRS::Vector m_flowDirection
VRS::VertexData< 2, float > m_reflectionScale
VRS::VertexData< 2, float > m_refractionScale
float m_fresnelBias
VRS::Color m_waterColor
VRS::Bounds m_boundingBox
Plane m_plane
double m_junctionSize
bool m_refracting
VRS::Matrix m_waveTransform

Classes

class  Plane


Detailed Description

A WaterSurface is a polygonal area that is rendered as a water surface with typical water effects such as waves, reflections, etc.

The geometry of the water surface is defined by one or more coplanar polygons. To specify some scene objects that shall be reflected in the water surface:


Constructor & Destructor Documentation

EnvironmentRenderer::WaterSurface::WaterSurface ( VRS::SO< VRS::Iterator< VRS::SO< VRS::Facet > > >  surface,
const VRS::Vector flowDirection,
const VRS::Color waterColor = VRS::Color::slate_blue,
float  fresnelBias = 0.0f,
const VertexData2f reflectionScale = VertexData2f(0.2f, 0.2f),
const VertexData2f refractionScale = VertexData2f(0.2f, 0.2f),
double  junctionSize = 0.0,
bool  refracting = false,
const VRS::Matrix waveTf = VRS::Matrix::identity 
)

'surface' specifies the geometry.

Must not be NULL and must contain at least one valid facet. The unification of all facets in 'surface' define the water surface. All facets need to be coplanar. If they are not, the last facet is used as reference. Due to the 'planar mirror'-technique, the rendering of all other facets will not be correct. Except for the coplanarity, there are no further restrictions on the facets. Even vertical watersurfaces are allowed. 'flowDirection' defines the flow direction for the water waves in object- coordinates, defined by normal, tangent and bitangent. 'flowDirection.x' relates to the tangent, 'flowDirection.y' relates to the bitangent. 'flowDirection.z' controls the rippling-speed. with higher values, the water looks more turbulent. the values are measured in units-per-second, i.e. with a value of 1.0 the texture moves exactly one texture-repitition in one second into the given direction, with 2.0 two repetitions, etc. see the Plane-description below on how tangent and bitangent are calculated. 'waterColor' defines the color which is used for the water, if neither reflection nor refraction is applied to the watersurface. if a watersurface is reflected by another watersurface, this color is used in the reflection (the same applies to refraction). 'ref**ctionScale' adjust the amount of distortion for reflection and refraction, where 0.0 results in no distortion and 1.0 produces strong distortion. values can be specified individually for x- and y-direction (in camera-space). values outside [0;1] are clamped. 'fresnelBias' will adjust the amount of reflection and refraction. 1.0 will result in full reflection (no refraction), -1.0 results in strong refraction and almost no reflection. values outside [-1;1] are clamped 'junctionSize' specifies a region around the watersurface (junctionSize units above and below the surface) which will be treated as both, reflecting and refracting (if the particular attributes are set) to reduce texture lookup-artifacts where geometry intersects the watersurface. This value should be chosen wisely, because too large values may result in reflections or refractions of geometry, which actually should not be seen (example: imagine a pool of water, where the watersurface is 0.5 units below the pool's rim. chosing a junctionSize greater than 0.5 will cause underwater pool walls to be reflected on the surface) the value cannot be negative. negative values are clamped to 0.0. 'refracting' enables refraction for the water surface 'waveTf' specifies a matrix that allows arbitrary transformation for the waves' normal texture that can be specified per watersurface. first, the transformation is applied, then the time-dependent translation is applied, regarding the defined matrix.

EnvironmentRenderer::WaterSurface::WaterSurface (  )  [protected]


Member Function Documentation

virtual VRS::Bounds EnvironmentRenderer::WaterSurface::boundingBox (  )  const [virtual]

VRS::SO<VRS::Iterator<VRS::SO<VRS::Facet> > > EnvironmentRenderer::WaterSurface::getSurface (  )  const

void EnvironmentRenderer::WaterSurface::setSurface ( VRS::SO< VRS::Iterator< VRS::SO< VRS::Facet > > >  surface  ) 

const VRS::Vector& EnvironmentRenderer::WaterSurface::getFlowDirection (  )  const

void EnvironmentRenderer::WaterSurface::setFlowDirection ( const VRS::Vector flowDirection  ) 

void EnvironmentRenderer::WaterSurface::setReflectionScale ( const VRS::VertexData< 2, float > &  scale  ) 

const VRS::VertexData<2, float>& EnvironmentRenderer::WaterSurface::getReflectionScale (  )  const

void EnvironmentRenderer::WaterSurface::setRefractionScale ( const VRS::VertexData< 2, float > &  scale  ) 

const VRS::VertexData<2, float>& EnvironmentRenderer::WaterSurface::getRefractionScale (  )  const

void EnvironmentRenderer::WaterSurface::setRefracting ( bool  enable  ) 

bool EnvironmentRenderer::WaterSurface::isRefracting (  ) 

void EnvironmentRenderer::WaterSurface::setFresnelBias ( float  bias  ) 

float EnvironmentRenderer::WaterSurface::getFresnelBias (  )  const

void EnvironmentRenderer::WaterSurface::setWaterColor ( const VRS::Color color  ) 

const VRS::Color& EnvironmentRenderer::WaterSurface::getWaterColor (  )  const

double EnvironmentRenderer::WaterSurface::getJunctionSize (  )  const

void EnvironmentRenderer::WaterSurface::setJunctionSize ( double  size  ) 

void EnvironmentRenderer::WaterSurface::setWaveTf ( const VRS::Matrix tf  )  [inline]

const VRS::Matrix& EnvironmentRenderer::WaterSurface::waveTf (  )  const [inline]

const Plane& EnvironmentRenderer::WaterSurface::getPlane (  )  const

void EnvironmentRenderer::WaterSurface::setPlane ( const Plane p  ) 

EnvironmentRenderer::WaterSurface::VRS_TYPEINFO ( WaterSurface  ,
VRS::Shape   
)

EnvironmentRenderer::WaterSurface::VRS_SERIALIZABLE ( WaterSurface   ) 

void EnvironmentRenderer::WaterSurface::createGeometry (  )  [protected]


Member Data Documentation


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

Generated on Mon May 20 06:00:24 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact