# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

water_pool_manager.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
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 &params = 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         // dtor
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() {}  // private ctor needed to use the singleton pattern
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 // get the only water pool manager (caution : with several dll, there may be duplication however,
00119 // if NL3D is linked as a static lib with several of them, so you may need to pass the address of the manager being used to other dlls)
00120 CWaterPoolManager &GetWaterPoolManager();
00121 
00122 
00123 } // NL3D
00124 
00125 
00126 #endif // NL_WATER_POOL_MANAGER_H
00127 
00128 /* End of water_pool_manager.h */