00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef NL_WATER_POOL_MANAGER_H
00027 #define NL_WATER_POOL_MANAGER_H
00028
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/smart_ptr.h"
00031 #include "nel/misc/stream.h"
00032
00033 #include <map>
00034 #include <vector>
00035 #include <string>
00036
00037 namespace NL3D {
00038
00039 class CWaterHeightMap;
00040 class IDriver;
00041
00048 class CWaterPoolManager
00049 {
00050 public:
00052 struct CWaterHeightMapBuild
00053 {
00054 uint32 ID;
00055 uint32 Size;
00056 std::string Name;
00057 float Damping;
00058 float FilterWeight;
00059 float UnitSize;
00060 bool WavesEnabled;
00061 float WaveIntensity;
00062 uint32 WaveRadius;
00063 float WavePeriod;
00064 bool BorderWaves;
00065 CWaterHeightMapBuild() : ID(0), Size(256), WavesEnabled(false), Damping(0.99f), FilterWeight(3), UnitSize(0.30f), WaveIntensity(1.5), WavePeriod(0.05f), WaveRadius(3), BorderWaves(true) {}
00066 };
00068 CWaterHeightMap *createWaterPool(const CWaterHeightMapBuild ¶ms = CWaterHeightMapBuild());
00069
00071 CWaterHeightMap &getPoolByID(uint32 ID);
00072
00074 bool hasPool(uint32 ID) const;
00075
00077 void removePool(uint32 ID);
00078
00080 uint getNumPools() const;
00081
00083 uint getPoolID(uint i) const;
00084
00085
00086
00087
00089 void reset();
00090
00091
00092 ~CWaterPoolManager() { reset(); }
00093
00097 void setBlendFactor(IDriver *drv, float factor);
00098
00100 void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00101
00102 private:
00103 friend class CWaterShape;
00104 friend CWaterPoolManager &GetWaterPoolManager();
00105 CWaterPoolManager() {}
00106 typedef std::map<uint32, CWaterHeightMap *> TPoolMap;
00107 TPoolMap _PoolMap;
00108
00110 void registerWaterShape(CWaterShape *shape);
00111 void unRegisterWaterShape(CWaterShape *shape);
00112 bool isWaterShapeObserver(const CWaterShape *shape) const;
00113 typedef std::vector<CWaterShape *> TWaterShapeVect;
00114 TWaterShapeVect _WaterShapes;
00115 };
00116
00117
00118
00119
00120 CWaterPoolManager &GetWaterPoolManager();
00121
00122
00123 }
00124
00125
00126 #endif // NL_WATER_POOL_MANAGER_H
00127
00128