1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef CL_CONTINENT_H
23 #define CL_CONTINENT_H
30 #include "nel/misc/types_nl.h"
31 #include "nel/misc/vector.h"
32 #include "nel/misc/rgba.h"
34 #include "game_share/season.h"
35 #include "game_share/dir_light_setup.h"
37 #include "client_sheets/continent_sheet.h"
39 #include "streamable_entity_composite.h"
41 #include "game_share/fog_of_war.h"
42 #include "game_share/fog_type.h"
43 #include "game_share/time_weather_season/weather_function.h"
44 #include "sky_material_setup.h"
47 #include "sky.h" // new style sky
49 #include "water_map.h"
51 #include "continent_manager_build.h"
63 class IProgressCallback
;
73 // Landmark created by the user
79 enum EUserLandMarkType
111 UserLandMarkTypeCount
114 NLMISC::CVector2f Pos
; // Pos in local map
115 ucstring Title
; // FIXME: UTF-8 (serial)
118 //User LandMarks Colors
119 static NLMISC::CRGBA _LandMarksColor
[UserLandMarkTypeCount
];
129 /// Get user landmark color
130 NLMISC::CRGBA
getColor () const;
132 void serial(NLMISC::IStream
&f
)
134 f
.serial(Pos
, Title
, Type
);
140 * Class to manage the fog of war over a continent
141 * \author Matthieu 'Trap' Besson
142 * \author Nevrax France
145 class CFogOfWar
: public IFogOfWar
150 NL3D::UTextureMem
*Tx
; // Here store the real size
161 void load(const std::string
&contName
);
162 void save(const std::string
&contName
);
164 // Implementation of IFogOfWar
165 virtual uint8
*getData();
166 virtual bool createData(sint16 w
, sint16 h
);
167 virtual void explored(sint16 mapPosX
, sint16 mapPosY
);
168 virtual sint16
getRealWidth();
169 virtual sint16
getRealHeight();
174 * Class to manage a continent.
175 * \author Guillaume PUZIN (GUIGUI)
176 * \author Nevrax France
179 class CContinent
: public CContinentParameters
182 // name of the sheet used to create the continent
183 std::string SheetName
;
187 // backup setup of sky for day
188 CSkyMaterialSetup DaySkySetup
;
190 // backup setup of sky for day
191 CSkyMaterialSetup NightSkySetup
;
200 EGSPD::CSeason::TSeason Season
;
202 // A group of village
203 CStreamableEntityComposite _Villages
;
205 // A group of outposts
206 std::vector
<COutpost
> _Outposts
;
211 // Weather functions for each season
212 CWeatherFunction WeatherFunction
[EGSPD::CSeason::Invalid
];
214 // user landmarks (saved)
215 std::vector
<CUserLandMark
> UserLandMarks
;
217 // continent landmarks (not saved but static data)
218 std::vector
<CContLandMark
> ContLandMarks
;
220 // Continent occupation zone
221 NLLIGO::CPrimZone Zone
;
223 // Center of the occupation zone
224 NLMISC::CVector2f ZoneCenter
;
234 /// setup the continent from a sheet (use the SheetName that MUST be set)
238 * Update global parameters like the texture for the micro veget.
240 void select(const NLMISC::CVectorD
&pos
, NLMISC::IProgressCallback
&progress
, bool complete
, bool unhibernate
, EGSPD::CSeason::TSeason season
);
242 /// This will remove extra rsc used by the continent (fog maps ..)
245 /** Test whether the next call to updateStreamable will be blocking.
246 * This happen for example when the player is too near of a village and when asynchronous loading is not sufficient.
247 * \param pos player position
249 bool isLoadingforced(const NLMISC::CVector
&playerPos
) const;
251 /** Given the position of the player, load / unload objects (asynchronously when possible)
253 void updateStreamable(const NLMISC::CVector
&playerPos
);
255 /** Given the position of the player, load / unload objects (always in a synchronous fashion)
257 void forceUpdateStreamable(const NLMISC::CVector
&playerPos
, NLMISC::IProgressCallback
&progress
);
259 /** Remove all villages from the continents
261 void removeVillages();
264 COutpost
*getOutpost (uint i
);
267 void getFogState(TFogType fogType
, float dayNight
, float duskRatio
, CLightCycleManager::TLightState lightState
, const NLMISC::CVectorD
&pos
, CFogState
&result
, bool overideByWeatherFogDist
= true);
271 /** Enum ig of the continent
272 * (for now, these are currently instanciated villages)
273 * \return false if the enumeration has been stopped
275 bool enumIGs(IIGEnum
*callback
);
278 ///\name ig added observers.
280 void registerObserver(IIGObserver
*obs
);
281 void removeObserver(IIGObserver
*obs
);
282 bool isObserver(IIGObserver
*obs
) const;
285 // load (or reload) the micro-life primitives
286 void loadMicroLife();
288 // init the water map
291 /** get corners min / zone max
292 * \return true if success
294 bool getCorners(NLMISC::CVector2f
&cornerMin
, NLMISC::CVector2f
&cornerMax
) const;
296 // dump village loading zones in a bitmap
297 void dumpVillagesLoadingZones(const std::string
&filename
);
299 enum TChannel
{ ChannelR
= 0, ChannelG
= 1, ChannelB
= 2, ChannelA
= 3, ChannelRGBA
};
300 // dump fog map, blended with continent map, and with camera pos
301 // If a single channel is used, then channelLookup is used pick up the final color
302 void dumpFogMap(CFogMapBuild::TMapType mapType
, const std::string
&filename
, TChannel channel
= ChannelRGBA
, const CRGBA channelLookup
[256] = NULL
);
306 // init release the sky
310 /// Return the max number of user landmarks (standard + bonus ones)
311 static uint
getMaxNbUserLandMarks();
315 // Register outpost (collsions...)
318 // Remove all outpost (collisions...)
319 void removeOutpost();
324 // Load the weather functions
325 void loadWeatherFunctions(const NLGEORGES::UFormElm
&item
);
330 #endif // CL_CONTINENT_H
332 /* End of continent.h */