From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03722.html | 952 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 952 insertions(+) create mode 100644 docs/doxygen/nel/a03722.html (limited to 'docs/doxygen/nel/a03722.html') diff --git a/docs/doxygen/nel/a03722.html b/docs/doxygen/nel/a03722.html new file mode 100644 index 00000000..558dfa2b --- /dev/null +++ b/docs/doxygen/nel/a03722.html @@ -0,0 +1,952 @@ + + +NeL: NL3D::CWaterPoolManager class Reference + + + +
+

NL3D::CWaterPoolManager Class Reference

#include <water_pool_manager.h> +

+


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. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

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

uint getNumPools () const
 Get the number of pools.

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

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

bool hasPool (uint32 ID) const
 test wether a pool of the given ID exists

void releaseBlendTextures ()
void removePool (uint32 ID)
 remove the pool of the given ID

void reset ()
 delete all heightmaps

void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial the pools data's

void setBlendFactor (IDriver *drv, float factor)
 ~CWaterPoolManager ()

Private Types

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

Private Member Functions

 CWaterPoolManager ()
bool isWaterShapeObserver (const CWaterShape *shape) const
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)

Private Attributes

TPoolMap _PoolMap
TWaterShapeVect _WaterShapes

Friends

class CWaterShape
CWaterPoolManagerGetWaterPoolManager ()
+


Member Typedef Documentation

+

+ + + + +
+ + +
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.

+


Constructor & Destructor Documentation

+

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

+ +

+Definition at line 92 of file water_pool_manager.h. +

+References reset(). +

+

00092 { reset(); }
+
+

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

+ +

+Definition at line 112 of file water_pool_manager.h. +

+

00112 {}      // private ctor needed to use the singleton pattern
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
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 93 of file water_pool_manager.cpp. +

+References _PoolMap, NL3D::CWaterHeightMap::enableWaves(), params, NL3D::CWaterHeightMap::setDamping(), NL3D::CWaterHeightMap::setFilterWeight(), NL3D::CWaterHeightMap::setName(), NL3D::CWaterHeightMap::setSize(), NL3D::CWaterHeightMap::setUnitSize(), and NL3D::CWaterHeightMap::setWaves(). +

+Referenced by getPoolByID(). +

+

00094 {
+00095         CWaterHeightMap *whm = _PoolMap.count(params.ID) == 0 ? new CWaterHeightMap : _PoolMap[params.ID];      
+00096         whm->setDamping(params.Damping);
+00097         whm->setFilterWeight(params.FilterWeight);
+00098         whm->setSize(params.Size);
+00099         whm->setUnitSize(params.UnitSize);
+00100         whm->setWaves(params.WaveIntensity, params.WavePeriod, params.WaveRadius, params.BorderWaves);
+00101         whm->enableWaves(params.WavesEnabled);
+00102         whm->setName(params.Name);
+00103         _PoolMap[params.ID] = whm; // in case it was just created
+00104         return whm;
+00105 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CWaterPoolManager::getNumPools  )  const
+
+ + + + + +
+   + + +

+Get the number of pools. +

+ +

+Definition at line 197 of file water_pool_manager.cpp. +

+References _PoolMap, and uint. +

+Referenced by getPoolID(). +

+

00198 {
+00199         return _PoolMap.size();
+00200 }
+
+

+ + + + +
+ + + + + + + + + + +
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 109 of file water_pool_manager.cpp. +

+References _PoolMap, createWaterPool(), and uint32. +

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

+

00110 {
+00111         if(_PoolMap.count(ID))
+00112         {
+00113                 return *_PoolMap[ID];
+00114         }
+00115         else
+00116         {
+00117                 return *createWaterPool();      
+00118         }
+00119 }
+
+

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

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

+ +

+Definition at line 204 of file water_pool_manager.cpp. +

+References _PoolMap, getNumPools(), nlassert, and uint. +

+

00205 {
+00206         nlassert(i < getNumPools());
+00207         TPoolMap::const_iterator it =  _PoolMap.begin();
+00208         while (i--) ++it;
+00209         return it->first;
+00210 }
+
+

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

+test wether a pool of the given ID exists +

+ +

+Definition at line 86 of file water_pool_manager.cpp. +

+References _PoolMap, and uint32. +

+Referenced by removePool(). +

+

00087 {
+00088         return _PoolMap.count(ID) != 0;
+00089 }
+
+

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

+ +

+Definition at line 190 of file water_pool_manager.cpp. +

+References _WaterShapes. +

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

+

00191 {
+00192         return std::find(_WaterShapes.begin(), _WaterShapes.end(), shape) != _WaterShapes.end();
+00193 }
+
+

+ + + + +
+ + + + + + + + + + +
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 135 of file water_pool_manager.cpp. +

+References _WaterShapes, and nlassert. +

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

+

00136 {       
+00137         nlassert(std::find(_WaterShapes.begin(), _WaterShapes.end(), shape) == _WaterShapes.end()); // Shape registered twice!
+00138         _WaterShapes.push_back(shape);
+00139 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CWaterPoolManager::releaseBlendTextures  ) 
+
+ + + + + +
+   + + +

+release blend textures from memory

See also:
setblendFactor
+ +

+Definition at line 171 of file water_pool_manager.cpp. +

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

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

+

00172 {
+00173         for (TWaterShapeVect::iterator it = _WaterShapes.begin(); it != _WaterShapes.end(); ++it)
+00174         {
+00175                 CTextureBlend *tb;
+00176                 for (uint k = 0; k < 2; ++k)
+00177                 {
+00178                         tb = dynamic_cast<CTextureBlend *>((*it)->getEnvMap(k));
+00179                         if (tb)
+00180                         {
+00181                                 tb->setReleasable(true);
+00182                                 tb->release();                          
+00183                         }
+00184                 }
+00185         }
+00186 }
+
+

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

+remove the pool of the given ID +

+ +

+Definition at line 214 of file water_pool_manager.cpp. +

+References _PoolMap, hasPool(), nlassert, and uint32. +

+

00215 {
+00216         nlassert(hasPool(ID));
+00217         TPoolMap::iterator it = _PoolMap.find(ID);
+00218         delete it->second;
+00219         _PoolMap.erase(_PoolMap.find(ID));
+00220 }
+
+

+ + + + +
+ + + + + + + + + +
void NL3D::CWaterPoolManager::reset  ) 
+
+ + + + + +
+   + + +

+delete all heightmaps +

+ +

+Definition at line 123 of file water_pool_manager.cpp. +

+References _PoolMap. +

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

+

00124 {
+00125         for (TPoolMap::iterator it = _PoolMap.begin(); it != _PoolMap.end(); ++it)
+00126         {
+00127                 delete it->second;
+00128         }
+00129         _PoolMap.clear ();
+00130 }
+
+

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

+serial the pools data's +

+ +

+Definition at line 223 of file water_pool_manager.cpp. +

+References size, and uint32. +

+

00224 {       
+00225         f.xmlPush("WaterPoolManager");
+00226         (void)f.serialVersion(0);       
+00227         uint32 size;
+00228         TPoolMap::iterator it;
+00229         if (!f.isReading())
+00230         {
+00231                 size = _PoolMap.size();
+00232                 it  = _PoolMap.begin();
+00233         }
+00234         else
+00235         {
+00236                 reset();
+00237         }
+00238         f.xmlSerial(size, "NUM_POOLS");
+00239         while (size --)
+00240         {               
+00241                 f.xmlPush("PoolDesc");
+00242                 if (f.isReading())
+00243                 {
+00244                         CWaterHeightMap *whm;
+00245                         uint32 id;
+00246                         f.xmlSerial(id, "POOL_ID");
+00247                         f.serialPtr(whm);
+00248                         _PoolMap[id] = whm;     
+00249                 }
+00250                 else
+00251                 {
+00252                         uint32 id = it->first;
+00253                         f.xmlSerial(id, "POOL_ID");
+00254                         f.serialPtr(it->second);
+00255                         ++it;
+00256                 }
+00257                 f.xmlPop();
+00258         }
+00259         f.xmlPop();             
+00260 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
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 152 of file water_pool_manager.cpp. +

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

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

+

00153 {
+00154         nlassert(factor >= 0 && factor <= 1);
+00155         for (TWaterShapeVect::iterator it = _WaterShapes.begin(); it != _WaterShapes.end(); ++it)
+00156         {
+00157                 CTextureBlend *tb;
+00158                 for (uint k = 0; k < 2; ++k)
+00159                 {
+00160                         tb = dynamic_cast<CTextureBlend *>((*it)->getEnvMap(k));
+00161                         if (tb && tb->setBlendFactor((uint16) (256.f * factor)))
+00162                         {
+00163                                 tb->setReleasable(false);
+00164                                 drv->setupTexture(*tb);
+00165                         }
+00166                 }
+00167         }
+00168 }
+
+

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

+ +

+Definition at line 143 of file water_pool_manager.cpp. +

+References _WaterShapes. +

+Referenced by NL3D::CWaterShape::envMapUpdate(), and NL3D::CWaterShape::~CWaterShape(). +

+

00144 {
+00145         TWaterShapeVect::iterator it = std::find(_WaterShapes.begin(), _WaterShapes.end(), shape);
+00146 //      nlassert(it != _WaterShapes.end()); // shape not registered!
+00147         if (it != _WaterShapes.end())
+00148                 _WaterShapes.erase(it);
+00149 }
+
+


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 78 of file water_pool_manager.cpp. +

+

00079 {
+00080         static CWaterPoolManager singleton;
+00081         return singleton;
+00082 }
+
+


Field Documentation

+

+ + + + +
+ + +
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().

+

+ + + + +
+ + +
TWaterShapeVect NL3D::CWaterPoolManager::_WaterShapes [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 121 of file water_pool_manager.h. +

+Referenced by isWaterShapeObserver(), registerWaterShape(), releaseBlendTextures(), setBlendFactor(), and unRegisterWaterShape().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 08:30:35 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1