Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / client_sheets / sky_object_sheet.h
blobd6a3bff7e858a434195250569fd4e9c9194a49c0
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/>.
17 #ifndef CL_SKY_OBJECT_SHEET_H
18 #define CL_SKY_OBJECT_SHEET_H
21 #include "nel/misc/stream.h"
22 #include "nel/misc/bitmap.h"
23 #include "nel/misc/uv.h"
25 #include "nel/georges/u_form_elm.h"
27 #include <string>
30 const uint SKY_MAX_NUM_STAGE = 4;
31 const uint SKY_MAX_NUM_FX_USER_PARAMS = 4;
33 enum TSkyRefColor { NoColorRef = 0, DiffuseColorRef, ConstantColor0Ref, ConstantColorLastRef = ConstantColor0Ref + SKY_MAX_NUM_STAGE, ParticleEmittersColorRef = ConstantColorLastRef }; // color serves as a reference to see if object must be hiden. This is the case when the alpha is 0
34 enum TSkyColorMode { Unused = 0, BitmapColor, FogColor, BitmapColorModulatedByFogColor };
37 // Sheet describing an object in the sky
38 class CSkyObjectSheet
40 public:
41 ////////////////////////////////////////////////
42 // tells how a color is computed in the shape //
43 ////////////////////////////////////////////////
44 class CColorInfoSheet
46 public:
47 std::string MapName;
48 TSkyColorMode Mode;
49 public:
50 // Build from an external script
51 void build(const NLGEORGES::UFormElm &item, const std::string &prefix);
52 /// Serialize sheet into binary data file.
53 void serial(NLMISC::IStream &f);
55 ////////////////////////////////////////////////////////////////////////////////
56 // tells how a color gradient is computed in the shape (-> sky dome gradient) //
57 ////////////////////////////////////////////////////////////////////////////////
58 class CColorGradientInfoSheet
60 public:
61 sint32 TargetTextureStage; // the texture stage to which the gradient must be applied.
62 /** each bitmap in the following list gives the gradient depending on weather valuet level. The V coordinate gives the gradient values, and U is offseted by the weather value
63 * each bitmap match a weather state. First bitmap maps to light level = 0 and last bitmap maps to light level = 1
64 * for intermediary weather values, the two nearest bitmap are blended to get the value of the gradient
67 std::vector<std::string> WeatherToGradient;
68 public:
69 // ctor
70 CColorGradientInfoSheet() : TargetTextureStage(0) {}
71 // Build from an external script
72 void build(const NLGEORGES::UFormElm &item, const std::string &prefix);
73 /// Serialize sheet into binary data file.
74 void serial(NLMISC::IStream &f);
76 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
77 // A version of a sky object. If materials are too complex, a fallback version may be used instead (on gpu with 2 stages) //
78 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
79 class CVersionSheet
81 public:
82 std::string ShapeName;
83 uint8 TransparencyPriority;
84 TSkyRefColor RefColor;
85 CColorInfoSheet DiffuseColor;
86 CColorInfoSheet ParticleEmitters;
87 CColorInfoSheet ConstantColor[SKY_MAX_NUM_STAGE];
88 CColorGradientInfoSheet ColorGradient;
89 NLMISC::CUV TexPanner[SKY_MAX_NUM_STAGE];
90 NLMISC::CUV OffsetFactor[SKY_MAX_NUM_STAGE];
91 std::string FXUserParamBitmap[SKY_MAX_NUM_FX_USER_PARAMS];
92 // texture scaling : each bitmap gives a scaling factor depending on weather and the hour of the day
93 std::string OffsetUBitmap[SKY_MAX_NUM_STAGE];
94 std::string OffsetVBitmap[SKY_MAX_NUM_STAGE];
95 public:
96 // ctor
97 CVersionSheet() : TransparencyPriority(0), RefColor(NoColorRef)
99 for(uint k = 0; k < SKY_MAX_NUM_STAGE; ++k)
101 TexPanner[k].set(0.f, 0.f);
105 // Build from an external script
106 void build(const NLGEORGES::UFormElm &item, const std::string &prefix);
107 /// Serialize sheet into binary data file.
108 void serial(NLMISC::IStream &f);
110 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
111 CVersionSheet Std; // standard version of the object
112 CVersionSheet FallbackPass[2]; // up to 2 fallback versions (for multi-pass fallback)
113 bool VisibleInMainScene;
114 bool VisibleInEnvMap;
115 public:
116 // ctor
117 CSkyObjectSheet();
118 // Build from an external script
119 void build(const NLGEORGES::UFormElm &item, const std::string &prefix);
120 /// Serialize sheet into binary data file.
121 void serial(NLMISC::IStream &f);
124 #endif