NL3D::CWaterModel Class Reference

A water surface. More...

#include <water_model.h>

Inherits NL3D::CTransformShape.

List of all members.

Public Member Functions

 CWaterModel ()
 ctor
 ~CWaterModel ()
void init ()
virtual ITrackgetDefaultTrack (uint valueId)
 Default Track Values are identity (pos,pivot= 0, scale= 1, rots=0).
virtual uint32 getWaterHeightMapID () const
 inherited from UWaterInstance
virtual float getHeightFactor () const
 inherited from UWaterInstance
virtual float getHeight (const NLMISC::CVector2f &pos)
 inherited from UWaterInstance
virtual float getAttenuatedHeight (const NLMISC::CVector2f &pos, const NLMISC::CVector &viewer)
 inherited from UWaterInstance
uint getNumWantedVertices ()
uint fillVB (void *dataStart, uint startTri, IDriver &drv)
void debugDumpMem (void *&clippedPolyBegin, void *&clippedPolyEnd)
void debugClearClippedPoly ()
void unlink ()
void link ()
CTransform traverse specialisation



virtual void traverseRender ()
 no-op by default
virtual bool clip ()
 clip method called by traverseClip(). deafult is always visible

Static Public Member Functions

static void registerBasic ()
 Call at the begining of the program, to register the model.
static CTransformcreator ()
static void setupVertexBuffer (CVertexBuffer &vb, uint numWantedVertices, IDriver *drv)

Public Attributes

CWaterModel ** _Prev
CWaterModel_Next

Protected Member Functions

void setupMaterialNVertexShader (IDriver *drv, CWaterShape *shape, const NLMISC::CVector &obsPos, bool above, float zHeight)
 store a value in a water vertex buffer, and increment the pointer
void setupSimpleRender (CWaterShape *shape, const NLMISC::CVector &obsPos, bool above)
void computeClippedPoly ()

Private Member Functions

void updateDiffuseMapMatrix (bool force=false)
uint fillVBHard (void *dataStart, uint startIndex)
uint fillVBSoft (void *dataStart, uint startIndex)

Private Attributes

CSmartPtr< CTextureEmboss_EmbossTexture
NLMISC::CVector2f _ColorMapMatColumn0
NLMISC::CVector2f _ColorMapMatColumn1
NLMISC::CVector2f _ColorMapMatPos
uint64 _MatrixUpdateDate
NLMISC::CPolygon2D::TRasterVect _Inside
sint _MinYInside
NLMISC::CPolygon _ClippedPoly
std::vector< NLMISC::CVector2f_ClippedTris
std::vector< uint_ClippedTriNumVerts
uint32 _StartTri
uint32 _NumTris

Static Private Attributes

static NLMISC::CRefPtr< IDriver_CurrDrv
static CMaterial _WaterMat
static CMaterial _SimpleWaterMat

Friends

class CWaterShape

Detailed Description

A water surface.

In order to get precise reflections, we tesselate the shape by projecting it on screen, and by subdividing it by a fixed size grid. For each grid cell :

Author:
Nicolas Vizerie
Nevrax France
Date:
2001

Definition at line 64 of file water_model.h.


Constructor & Destructor Documentation

NL3D::CWaterModel::CWaterModel (  ) 
NL3D::CWaterModel::~CWaterModel (  ) 

Member Function Documentation

bool NL3D::CWaterModel::clip (  )  [virtual]
void NL3D::CWaterModel::computeClippedPoly (  )  [protected]
static CTransform* NL3D::CWaterModel::creator (  )  [inline, static]

Reimplemented from NL3D::CTransformShape.

Definition at line 81 of file water_model.h.

Referenced by registerBasic().

void NL3D::CWaterModel::debugClearClippedPoly (  ) 

Definition at line 1960 of file water_model.cpp.

References _ClippedPoly, and NLMISC::CPolygon::Vertices.

void NL3D::CWaterModel::debugDumpMem ( void *&  clippedPolyBegin,
void *&  clippedPolyEnd 
)

Definition at line 1953 of file water_model.cpp.

References _ClippedPoly, and NLMISC::CPolygon::Vertices.

Referenced by NL3D::CRenderTrav::debugWaterModelMemory().

uint NL3D::CWaterModel::fillVB ( void *  dataStart,
uint  startTri,
IDriver drv 
)
uint NL3D::CWaterModel::fillVBHard ( void *  dataStart,
uint  startIndex 
) [private]
uint NL3D::CWaterModel::fillVBSoft ( void *  dataStart,
uint  startIndex 
) [private]
float NL3D::CWaterModel::getAttenuatedHeight ( const NLMISC::CVector2f pos,
const NLMISC::CVector viewer 
) [virtual]
ITrack * NL3D::CWaterModel::getDefaultTrack ( uint  valueId  )  [virtual]
float NL3D::CWaterModel::getHeight ( const NLMISC::CVector2f pos  )  [virtual]
float NL3D::CWaterModel::getHeightFactor (  )  const [virtual]
uint NL3D::CWaterModel::getNumWantedVertices (  ) 
uint32 NL3D::CWaterModel::getWaterHeightMapID (  )  const [virtual]
void NL3D::CWaterModel::init ( void   )  [inline]

Definition at line 74 of file water_model.h.

References updateDiffuseMapMatrix().

Referenced by NL3D::CWaterShape::createInstance(), and setupSimpleRender().

void NL3D::CWaterModel::link (  ) 
void NL3D::CWaterModel::registerBasic (  )  [static]

Call at the begining of the program, to register the model.

Reimplemented from NL3D::CTransformShape.

Definition at line 118 of file water_model.cpp.

References creator(), NL3D::CScene::registerModel(), NL3D::TransformShapeId, and NL3D::WaterModelClassId.

Referenced by NL3D::CScene::registerBasics().

void NL3D::CWaterModel::setupMaterialNVertexShader ( IDriver drv,
CWaterShape shape,
const NLMISC::CVector obsPos,
bool  above,
float  zHeight 
) [protected]

store a value in a water vertex buffer, and increment the pointer

set matrix

set all our constants in one call

Definition at line 899 of file water_model.cpp.

References NL3D::CWaterShape::_BumpMap, NL3D::CWaterShape::_ColorMap, _ColorMapMatColumn0, _ColorMapMatColumn1, _ColorMapMatPos, NL3D::CWaterShape::_EnvMap, NL3D::CWaterShape::_HeightMapScale, NL3D::CWaterShape::_HeightMapSpeed, NL3D::CWaterShape::_UsesSceneWaterEnvMap, NL3D::CWaterShape::_VertexProgramNoWave, NL3D::CWaterShape::_VertexProgramNoWaveDiffuse, _WaterMat, NL3D::IDriver::activeVertexProgram(), NL3D::CWaterShape::envMapUpdate(), NL3D::CScene::getCurrentTime(), NL3D::CWaterEnvMap::getEnvMap2D(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getWaterEnvMap(), NL3D::IDriver::Identity, NL3D::CWaterShape::initVertexProgram(), NL3D::CMaterial::invsrcalpha, NL3D::IDriver::ModelViewProjection, NLMISC::CVectorH::set(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setColor(), NL3D::IDriver::setConstant(), NL3D::IDriver::setConstantFog(), NL3D::IDriver::setConstantMatrix(), NL3D::CMaterial::setDoubleSided(), NL3D::CMaterial::setDstBlend(), NL3D::CMaterial::setLighting(), NL3D::CMaterial::setShader(), NL3D::CMaterial::setSrcBlend(), NL3D::CMaterial::setTexture(), NL3D::CMaterial::setZWrite(), NL3D::CMaterial::srcalpha, updateDiffuseMapMatrix(), NL3D::CMaterial::Water, NLMISC::CRGBA::White, NLMISC::CVector::x, NLMISC::CVector2f::x, NLMISC::CVector2f::y, NLMISC::CVector::y, and NLMISC::CVector::z.

Referenced by traverseRender().

void NL3D::CWaterModel::setupSimpleRender ( CWaterShape shape,
const NLMISC::CVector obsPos,
bool  above 
) [protected]

Definition at line 985 of file water_model.cpp.

References NL3D::CWaterShape::_BumpMap, NL3D::CWaterShape::_ColorMap, _ColorMapMatColumn0, _ColorMapMatColumn1, _ColorMapMatPos, _EmbossTexture, NL3D::CWaterShape::_EnvMap, NL3D::CWaterShape::_HeightMapScale, NL3D::CWaterShape::_HeightMapSpeed, _SimpleWaterMat, NL3D::CWaterShape::_UsesSceneWaterEnvMap, NL3D::CMaterial::enableUserTexMat(), NL3D::CScene::getCurrentTime(), NL3D::CWaterEnvMap::getEnvMap2D(), NL3D::CTextureBump::getHeightMap(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getWaterEnvMap(), init(), NL3D::CMaterial::invsrcalpha, NL3D::CMaterial::Modulate, NL3D::CMaterial::Normal, NL3D::CMaterial::Previous, NL3D::CMaterial::Replace, NLMISC::CMatrix::scale(), NLMISC::CMatrix::set(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDoubleSided(), NL3D::CMaterial::setDstBlend(), NL3D::CMaterial::setLighting(), NLMISC::CMatrix::setPos(), NL3D::CMaterial::setShader(), NL3D::CMaterial::setSrcBlend(), NL3D::CMaterial::setTexCoordGen(), NL3D::CMaterial::setTexCoordGenMode(), NL3D::CMaterial::setTexture(), NL3D::CMaterial::setUserTexMat(), NL3D::CMaterial::setZWrite(), NL3D::CMaterial::SrcAlpha, NL3D::CMaterial::srcalpha, NL3D::CMaterial::SrcColor, NL3D::CMaterial::TexCoordGenObjectSpace, NL3D::CMaterial::texEnvArg0Alpha(), NL3D::CMaterial::texEnvArg0RGB(), NL3D::CMaterial::texEnvArg1Alpha(), NL3D::CMaterial::texEnvArg1RGB(), NL3D::CMaterial::texEnvOpAlpha(), NL3D::CMaterial::texEnvOpRGB(), NL3D::CMaterial::Texture, updateDiffuseMapMatrix(), NLMISC::CRGBA::White, NLMISC::CVector::x, NLMISC::CVector2f::x, NLMISC::CVector::y, and NLMISC::CVector2f::y.

Referenced by traverseRender().

void NL3D::CWaterModel::setupVertexBuffer ( CVertexBuffer vb,
uint  numWantedVertices,
IDriver drv 
) [static]
void NL3D::CWaterModel::traverseRender (  )  [virtual]
void NL3D::CWaterModel::unlink (  ) 

Definition at line 1180 of file water_model.cpp.

References _Next, _Prev, and nlassert.

Referenced by NL3D::CRenderTrav::clearWaterModelList(), clip(), and ~CWaterModel().

void NL3D::CWaterModel::updateDiffuseMapMatrix ( bool  force = false  )  [private]

Friends And Related Function Documentation

friend class CWaterShape [friend]

Definition at line 118 of file water_model.h.


Member Data Documentation

Definition at line 148 of file water_model.h.

Referenced by fillVBHard(), fillVBSoft(), and getNumWantedVertices().

Definition at line 146 of file water_model.h.

Referenced by fillVBHard(), fillVBSoft(), and getNumWantedVertices().

Definition at line 127 of file water_model.h.

Referenced by setupVertexBuffer().

Definition at line 128 of file water_model.h.

Referenced by setupSimpleRender().

Definition at line 136 of file water_model.h.

Referenced by fillVBHard(), fillVBSoft(), and getNumWantedVertices().

Definition at line 131 of file water_model.h.

Referenced by CWaterModel(), and updateDiffuseMapMatrix().

Definition at line 137 of file water_model.h.

Referenced by fillVBHard(), fillVBSoft(), and getNumWantedVertices().

Definition at line 151 of file water_model.h.

Referenced by fillVBHard(), fillVBSoft(), and traverseRender().

Definition at line 142 of file water_model.h.

Referenced by CWaterModel(), link(), and unlink().

Definition at line 134 of file water_model.h.

Referenced by setupSimpleRender(), and traverseRender().

Definition at line 150 of file water_model.h.

Referenced by fillVBHard(), fillVBSoft(), and traverseRender().

Definition at line 133 of file water_model.h.

Referenced by setupMaterialNVertexShader(), and traverseRender().


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

Generated on Thu Jan 7 08:30:14 2010 for NeL by  doxygen 1.6.1