Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / light_cycle.h
blobc4682778f8d332dde02e34869c888717e5d7e0ea
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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 RY_LIGHT_CYCLE_H
20 #define RY_LIGHT_CYCLE_H
22 #include "season.h"
24 namespace NLGEORGES
26 class UFormElm;
29 /** Description of light cycle for a single season
31 struct CSeasonLightCycle
33 float DayHour;
34 float DayToDuskHour;
35 float DuskToNightHour;
36 float NightHour;
37 float NightToDayHour;
38 ///////////////////////////////////////////////////////////////
39 // ctor
40 CSeasonLightCycle();
41 // build from a Georges form
42 void build(const NLGEORGES::UFormElm &item);
43 // serial in a stream
44 void serial(NLMISC::IStream &f)
46 f.serial(DayHour, DayToDuskHour, DuskToNightHour, NightHour, NightToDayHour);
51 /** Description of a complete light cycle for each season
53 struct CLightCycle
55 float RealDayLength; // real length of the day, in seconds
56 float NumHours; // number of ryzom hours in a day
57 uint32 MaxNumColorSteps; // the max number of color steps
58 CSeasonLightCycle SeasonLightCycle[EGSPD::CSeason::Invalid]; // description of each season
59 ///////////////////////////////////////////////////////////////
60 // ctor
61 CLightCycle();
62 // build from a Georges form
63 void build(const NLGEORGES::UFormElm &item);
64 // Build from a sheet file
65 void build(const char *sheetName);
67 void serial(NLMISC::IStream &f)
69 f.serial(RealDayLength, NumHours, MaxNumColorSteps);
70 for(uint k = 0; k < EGSPD::CSeason::Invalid; ++k)
72 f.serial(SeasonLightCycle[k]);
81 #endif