NL3D::CWaterPoolManager Class Reference

This class helps managing various waters pools. More...

#include <water_pool_manager.h>

List of all members.

Classes

struct  CWaterHeightMapBuild
 this struct is used to specify a water pool parameter's More...

Public Member Functions

CWaterHeightMapcreateWaterPool (const CWaterHeightMapBuild &params=CWaterHeightMapBuild())
 create a water pool with the given id and the given parameters. If the pool existed before, its parameter are reset
CWaterHeightMapgetPoolByID (uint32 ID)
 Get a water pool by its ID. If the ID doesn't exist, a new pool is created with default parameters.
bool hasPool (uint32 ID) const
 test whether a pool of the given ID exists
void removePool (uint32 ID)
 remove the pool of the given ID
uint getNumPools () const
 Get the number of pools.
uint getPoolID (uint i) const
 get the id of the i-th pool (O(n) lookup)
void reset ()
 delete all heightmaps
 ~CWaterPoolManager ()
void setBlendFactor (IDriver *drv, float factor)
 Set a blend factor for all pool (more precisely, all models based on a water shape) that have a blend texture for their envmap (to have cycle between night and day for example) NB : once this is called, textures are not released from memory because subsequent blends are expected to happend when transition has finished, one should call releaseBlendTexture to eventually release textures from system memory.
void releaseBlendTextures ()
 release blend textures from memory
void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial the pools data's

Private Types

typedef std::map< uint32,
CWaterHeightMap * > 
TPoolMap
typedef std::vector
< CWaterShape * > 
TWaterShapeVect

Private Member Functions

 CWaterPoolManager ()
void registerWaterShape (CWaterShape *shape)
 register a water height map. The water height map will be notified when a setBlend is applied
void unRegisterWaterShape (CWaterShape *shape)
bool isWaterShapeObserver (const CWaterShape *shape) const

Private Attributes

TPoolMap _PoolMap
TWaterShapeVect _WaterShapes

Friends

class CWaterShape
CWaterPoolManagerGetWaterPoolManager ()

Detailed Description

This class helps managing various waters pools.

Author:
Nicolas Vizerie
Nevrax France
Date:
2001

Definition at line 48 of file water_pool_manager.h.


Member Typedef Documentation

Definition at line 113 of file water_pool_manager.h.

typedef std::vector<CWaterShape *> NL3D::CWaterPoolManager::TWaterShapeVect [private]

Definition at line 120 of file water_pool_manager.h.


Constructor & Destructor Documentation

NL3D::CWaterPoolManager::~CWaterPoolManager (  )  [inline]

Definition at line 92 of file water_pool_manager.h.

References reset().

NL3D::CWaterPoolManager::CWaterPoolManager (  )  [inline, private]

Definition at line 112 of file water_pool_manager.h.


Member Function Documentation

CWaterHeightMap * NL3D::CWaterPoolManager::createWaterPool ( const CWaterHeightMapBuild params = CWaterHeightMapBuild()  ) 
uint NL3D::CWaterPoolManager::getNumPools (  )  const

Get the number of pools.

Definition at line 195 of file water_pool_manager.cpp.

References _PoolMap.

Referenced by getPoolID().

CWaterHeightMap & NL3D::CWaterPoolManager::getPoolByID ( uint32  ID  ) 

Get a water pool by its ID. If the ID doesn't exist, a new pool is created with default parameters.

Definition at line 107 of file water_pool_manager.cpp.

References _PoolMap, and createWaterPool().

Referenced by NL3D::CWaveMakerShape::clip(), NL3D::CWaterModel::getAttenuatedHeight(), NL3D::CWaterModel::getHeight(), NL3D::UWaterHeightMapManager::getWaterHeightMapFromID(), and NL3D::CWaveMakerModel::traverseAnimDetail().

uint NL3D::CWaterPoolManager::getPoolID ( uint  i  )  const

get the id of the i-th pool (O(n) lookup)

Definition at line 202 of file water_pool_manager.cpp.

References _PoolMap, getNumPools(), and nlassert.

bool NL3D::CWaterPoolManager::hasPool ( uint32  ID  )  const

test whether a pool of the given ID exists

Definition at line 84 of file water_pool_manager.cpp.

References _PoolMap.

Referenced by removePool().

bool NL3D::CWaterPoolManager::isWaterShapeObserver ( const CWaterShape shape  )  const [private]

Definition at line 188 of file water_pool_manager.cpp.

References _WaterShapes.

void NL3D::CWaterPoolManager::registerWaterShape ( CWaterShape shape  )  [private]

register a water height map. The water height map will be notified when a setBlend is applied

Definition at line 133 of file water_pool_manager.cpp.

References _WaterShapes, and nlassert.

Referenced by NL3D::CWaterShape::envMapUpdate().

void NL3D::CWaterPoolManager::releaseBlendTextures (  ) 

release blend textures from memory

See also:
setblendFactor

Definition at line 169 of file water_pool_manager.cpp.

References _WaterShapes, NL3D::CTextureBlend::release(), and NL3D::ITexture::setReleasable().

Referenced by NL3D::UWaterHeightMapManager::releaseBlendTextures().

void NL3D::CWaterPoolManager::removePool ( uint32  ID  ) 

remove the pool of the given ID

Definition at line 212 of file water_pool_manager.cpp.

References _PoolMap, hasPool(), and nlassert.

void NL3D::CWaterPoolManager::reset (  ) 

delete all heightmaps

Definition at line 121 of file water_pool_manager.cpp.

References _PoolMap.

Referenced by NL3D::UDriver::purgeMemory(), and ~CWaterPoolManager().

void NL3D::CWaterPoolManager::serial ( NLMISC::IStream f  )  throw (NLMISC::EStream)

serial the pools data's

Definition at line 221 of file water_pool_manager.cpp.

References void().

void NL3D::CWaterPoolManager::setBlendFactor ( IDriver drv,
float  factor 
)

Set a blend factor for all pool (more precisely, all models based on a water shape) that have a blend texture for their envmap (to have cycle between night and day for example) NB : once this is called, textures are not released from memory because subsequent blends are expected to happend when transition has finished, one should call releaseBlendTexture to eventually release textures from system memory.

Parameters:
factor The blend factor which range from 0 to 1

Definition at line 150 of file water_pool_manager.cpp.

References _WaterShapes, nlassert, NL3D::CTextureBlend::setBlendFactor(), NL3D::ITexture::setReleasable(), and NL3D::IDriver::setupTexture().

Referenced by NL3D::UWaterHeightMapManager::setBlendFactor().

void NL3D::CWaterPoolManager::unRegisterWaterShape ( CWaterShape shape  )  [private]

Friends And Related Function Documentation

friend class CWaterShape [friend]

Definition at line 110 of file water_pool_manager.h.

CWaterPoolManager& GetWaterPoolManager (  )  [friend]

Definition at line 76 of file water_pool_manager.cpp.


Member Data Documentation


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