# 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  

landscape_user.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 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_LANDSCAPE_USER_H
00027 #define NL_LANDSCAPE_USER_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/3d/u_landscape.h"
00031 #include "3d/landscape_model.h"
00032 #include "3d/zone_manager.h"
00033 #include "3d/scene.h"
00034 
00035 #define NL3D_MEM_LANDSCAPE                                              NL_ALLOC_CONTEXT( 3dLand )
00036 
00037 namespace NL3D
00038 {
00039 
00040 
00041 //****************************************************************************
00048 class CLandscapeUser : public ULandscape
00049 {
00050 private:
00051         // The Scene.
00052         CScene                          *_Scene;
00053         // The landscape, owned by the scene.
00054         CLandscapeModel         *_Landscape;
00055         // The zoneManager.
00056         CZoneManager            _ZoneManager;
00057 
00058 public:
00059 
00061         // @{
00062         CLandscapeUser(CScene *scene)
00063         {
00064                 NL3D_MEM_LANDSCAPE
00065                 nlassert(scene);
00066                 _Scene= scene;
00067                 _Landscape= (CLandscapeModel*)_Scene->createModel(LandscapeModelId);
00068         }
00069         virtual ~CLandscapeUser()
00070         {
00071                 NL3D_MEM_LANDSCAPE
00072                 _Scene->deleteModel(_Landscape);
00073                 _Landscape= NULL;
00074         }
00075         // @}
00076 
00077 
00080         // @{
00082         virtual void    setZonePath(const std::string &zonePath);
00084         virtual void    loadBankFiles(const std::string &tileBankFile, const std::string &farBankFile);
00086         virtual void    loadAllZonesAround(const CVector &pos, float radius);
00087         virtual void    loadAllZonesAround(const CVector &pos, float radius, std::vector<std::string> &zonesAdded);
00089         virtual void    refreshZonesAround(const CVector &pos, float radius);
00090         virtual void    refreshZonesAround(const CVector &pos, float radius, std::string &zoneAdded, std::string &zoneRemoved);
00092         virtual void    refreshAllZonesAround(const CVector &pos, float radius, std::vector<std::string> &zonesAdded, std::vector<std::string> &zonesRemoved);
00093         virtual void    getAllZoneLoaded(std::vector<std::string>       &zoneLoaded) const;
00094         // @}
00095 
00096 
00098         // @{
00107         virtual void    setupStaticLight (const CRGBA &diffuse, const CRGBA &ambiant, float multiply);
00108 
00109         virtual void    setPointLightDiffuseMaterial(CRGBA diffuse);
00110         virtual CRGBA   getPointLightDiffuseMaterial () const;
00111 
00112         virtual void    setPointLightFactor(const std::string &lightGroupName, NLMISC::CRGBA nFactor);
00113 
00114         virtual void    setUpdateLightingFrequency(float freq);
00115 
00116         virtual void    updateLightingAll();
00117 
00118         // @}
00119 
00120 
00122         // @{
00124         virtual void    setThreshold (float thre);
00126         virtual float   getThreshold () const;
00128         virtual void    setTileNear (float tileNear);
00130         virtual float   getTileNear () const;
00132         virtual void    setTileMaxSubdivision (uint tileDiv);
00134         virtual uint    getTileMaxSubdivision ();
00135         // @}
00136 
00137 
00139         // @{
00141         virtual std::string     getZoneName(const CVector &pos);
00142 
00143         virtual void            show()
00144         {
00145                 NL3D_MEM_LANDSCAPE
00146                 _Landscape->show();
00147         }
00148         virtual void            hide()
00149         {
00150                 NL3D_MEM_LANDSCAPE
00151                 _Landscape->hide();
00152         }
00153 
00154         virtual void            enableAdditive (bool enable);
00155         virtual bool            isAdditiveEnabled () const;
00156 
00157         // @}
00158 
00159 
00161         // @{
00162         virtual CVector         getHeightFieldDeltaZ(float x, float y) const;
00163         virtual void            setHeightField(const CHeightMap &hf);
00164         // @}
00165 
00167         // @{
00168         virtual void            enableVegetable(bool enable);
00169         virtual void            loadVegetableTexture(const std::string &textureFileName);
00170         virtual void            setupVegetableLighting(const CRGBA &ambient, const CRGBA &diffuse, const CVector &directionalLight);
00171         virtual void            setVegetableWind(const CVector &windDir, float windFreq, float windPower, float windBendMin);
00172         virtual void            setVegetableUpdateLightingFrequency(float freq);
00173         // @}
00174 
00175 
00177         // @{
00178         virtual void            setDLMGlobalVegetableColor(CRGBA gvc);
00179         virtual CRGBA           getDLMGlobalVegetableColor() const;
00180         // @}
00181 
00182 public:
00184         // @{
00185         CLandscapeModel         *getLandscape()
00186         {
00187                 NL3D_MEM_LANDSCAPE
00188                 return _Landscape;
00189         }
00190         // @}
00191 
00192 };
00193 
00194 
00195 } // NL3D
00196 
00197 
00198 #endif // NL_LANDSCAPE_USER_H
00199 
00200 /* End of landscape_user.h */