1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CL_CONTINENT_H
20 #define CL_CONTINENT_H
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/vector.h"
29 #include "nel/misc/rgba.h"
31 #include "game_share/season.h"
32 #include "game_share/dir_light_setup.h"
34 #include "client_sheets/continent_sheet.h"
36 #include "streamable_entity_composite.h"
38 #include "game_share/fog_of_war.h"
39 #include "game_share/fog_type.h"
40 #include "game_share/time_weather_season/weather_function.h"
41 #include "sky_material_setup.h"
44 #include "sky.h" // new style sky
46 #include "water_map.h"
48 #include "continent_manager_build.h"
60 class IProgressCallback
;
70 // Landmark created by the user
76 enum EUserLandMarkType
108 UserLandMarkTypeCount
111 NLMISC::CVector2f Pos
; // Pos in local map
112 ucstring Title
; // FIXME: UTF-8 (serial)
115 //User LandMarks Colors
116 static NLMISC::CRGBA _LandMarksColor
[UserLandMarkTypeCount
];
126 /// Get user landmark color
127 NLMISC::CRGBA
getColor () const;
129 void serial(NLMISC::IStream
&f
)
131 f
.serial(Pos
, Title
, Type
);
137 * Class to manage the fog of war over a continent
138 * \author Matthieu 'Trap' Besson
139 * \author Nevrax France
142 class CFogOfWar
: public IFogOfWar
147 NL3D::UTextureMem
*Tx
; // Here store the real size
158 void load(const std::string
&contName
);
159 void save(const std::string
&contName
);
161 // Implementation of IFogOfWar
162 virtual uint8
*getData();
163 virtual bool createData(sint16 w
, sint16 h
);
164 virtual void explored(sint16 mapPosX
, sint16 mapPosY
);
165 virtual sint16
getRealWidth();
166 virtual sint16
getRealHeight();
171 * Class to manage a continent.
172 * \author Guillaume PUZIN (GUIGUI)
173 * \author Nevrax France
176 class CContinent
: public CContinentParameters
179 // name of the sheet used to create the continent
180 std::string SheetName
;
184 // backup setup of sky for day
185 CSkyMaterialSetup DaySkySetup
;
187 // backup setup of sky for day
188 CSkyMaterialSetup NightSkySetup
;
197 EGSPD::CSeason::TSeason Season
;
199 // A group of village
200 CStreamableEntityComposite _Villages
;
202 // A group of outposts
203 std::vector
<COutpost
> _Outposts
;
208 // Weather functions for each season
209 CWeatherFunction WeatherFunction
[EGSPD::CSeason::Invalid
];
211 // user landmarks (saved)
212 std::vector
<CUserLandMark
> UserLandMarks
;
214 // continent landmarks (not saved but static data)
215 std::vector
<CContLandMark
> ContLandMarks
;
217 // Continent occupation zone
218 NLLIGO::CPrimZone Zone
;
220 // Center of the occupation zone
221 NLMISC::CVector2f ZoneCenter
;
231 /// setup the continent from a sheet (use the SheetName that MUST be set)
235 * Update global parameters like the texture for the micro veget.
237 void select(const NLMISC::CVectorD
&pos
, NLMISC::IProgressCallback
&progress
, bool complete
, bool unhibernate
, EGSPD::CSeason::TSeason season
);
239 /// This will remove extra rsc used by the continent (fog maps ..)
242 /** Test whether the next call to updateStreamable will be blocking.
243 * This happen for example when the player is too near of a village and when asynchronous loading is not sufficient.
244 * \param pos player position
246 bool isLoadingforced(const NLMISC::CVector
&playerPos
) const;
248 /** Given the position of the player, load / unload objects (asynchronously when possible)
250 void updateStreamable(const NLMISC::CVector
&playerPos
);
252 /** Given the position of the player, load / unload objects (always in a synchronous fashion)
254 void forceUpdateStreamable(const NLMISC::CVector
&playerPos
, NLMISC::IProgressCallback
&progress
);
256 /** Remove all villages from the continents
258 void removeVillages();
261 COutpost
*getOutpost (uint i
);
264 void getFogState(TFogType fogType
, float dayNight
, float duskRatio
, CLightCycleManager::TLightState lightState
, const NLMISC::CVectorD
&pos
, CFogState
&result
, bool overideByWeatherFogDist
= true);
268 /** Enum ig of the continent
269 * (for now, these are currently instanciated villages)
270 * \return false if the enumeration has been stopped
272 bool enumIGs(IIGEnum
*callback
);
275 ///\name ig added observers.
277 void registerObserver(IIGObserver
*obs
);
278 void removeObserver(IIGObserver
*obs
);
279 bool isObserver(IIGObserver
*obs
) const;
282 // load (or reload) the micro-life primitives
283 void loadMicroLife();
285 // init the water map
288 /** get corners min / zone max
289 * \return true if success
291 bool getCorners(NLMISC::CVector2f
&cornerMin
, NLMISC::CVector2f
&cornerMax
) const;
293 // dump village loading zones in a bitmap
294 void dumpVillagesLoadingZones(const std::string
&filename
);
296 enum TChannel
{ ChannelR
= 0, ChannelG
= 1, ChannelB
= 2, ChannelA
= 3, ChannelRGBA
};
297 // dump fog map, blended with continent map, and with camera pos
298 // If a single channel is used, then channelLookup is used pick up the final color
299 void dumpFogMap(CFogMapBuild::TMapType mapType
, const std::string
&filename
, TChannel channel
= ChannelRGBA
, const CRGBA channelLookup
[256] = NULL
);
303 // init release the sky
307 /// Return the max number of user landmarks (standard + bonus ones)
308 static uint
getMaxNbUserLandMarks();
312 // Register outpost (collsions...)
315 // Remove all outpost (collisions...)
316 void removeOutpost();
321 // Load the weather functions
322 void loadWeatherFunctions(const NLGEORGES::UFormElm
&item
);
327 #endif // CL_CONTINENT_H
329 /* End of continent.h */