This class helps managing various waters pools. More...
#include <water_pool_manager.h>
Classes | |
| struct | CWaterHeightMapBuild |
| this struct is used to specify a water pool parameter's More... | |
Public Member Functions | |
| CWaterHeightMap * | createWaterPool (const CWaterHeightMapBuild ¶ms=CWaterHeightMapBuild()) |
| create a water pool with the given id and the given parameters. If the pool existed before, its parameter are reset | |
| CWaterHeightMap & | getPoolByID (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 |
| CWaterPoolManager & | GetWaterPoolManager () |
This class helps managing various waters pools.
Definition at line 48 of file water_pool_manager.h.
typedef std::map<uint32, CWaterHeightMap *> NL3D::CWaterPoolManager::TPoolMap [private] |
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.
| 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.
| CWaterHeightMap * NL3D::CWaterPoolManager::createWaterPool | ( | 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
Definition at line 91 of file water_pool_manager.cpp.
References _PoolMap, NL3D::CWaterPoolManager::CWaterHeightMapBuild::BorderWaves, NL3D::CWaterPoolManager::CWaterHeightMapBuild::Damping, NL3D::CWaterHeightMap::enableWaves(), NL3D::CWaterPoolManager::CWaterHeightMapBuild::FilterWeight, NL3D::CWaterPoolManager::CWaterHeightMapBuild::ID, NL3D::CWaterPoolManager::CWaterHeightMapBuild::Name, NL3D::CWaterHeightMap::setDamping(), NL3D::CWaterHeightMap::setFilterWeight(), NL3D::CWaterHeightMap::setName(), NL3D::CWaterHeightMap::setSize(), NL3D::CWaterHeightMap::setUnitSize(), NL3D::CWaterHeightMap::setWaves(), NL3D::CWaterPoolManager::CWaterHeightMapBuild::Size, NL3D::CWaterPoolManager::CWaterHeightMapBuild::UnitSize, NL3D::CWaterPoolManager::CWaterHeightMapBuild::WaveIntensity, NL3D::CWaterPoolManager::CWaterHeightMapBuild::WavePeriod, NL3D::CWaterPoolManager::CWaterHeightMapBuild::WaveRadius, and NL3D::CWaterPoolManager::CWaterHeightMapBuild::WavesEnabled.
Referenced by getPoolByID().
| 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().
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.
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
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.
| 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) |
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.
| 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] |
Definition at line 141 of file water_pool_manager.cpp.
References _WaterShapes.
Referenced by NL3D::CWaterShape::envMapUpdate(), and NL3D::CWaterShape::~CWaterShape().
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.
TPoolMap NL3D::CWaterPoolManager::_PoolMap [private] |
Definition at line 114 of file water_pool_manager.h.
Referenced by createWaterPool(), getNumPools(), getPoolByID(), getPoolID(), hasPool(), removePool(), and reset().
Definition at line 121 of file water_pool_manager.h.
Referenced by isWaterShapeObserver(), registerWaterShape(), releaseBlendTextures(), setBlendFactor(), and unRegisterWaterShape().
1.6.1