Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / sky.h
blob9c9f56d1f5a7674ed41fd78b0ddc05d71383e375
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/>.
16 #ifndef CL_SKY_H
17 #define CL_SKY_H
19 #include "sky_object.h"
20 #include "time_client.h"
22 #include <vector>
25 namespace NL3D
27 class UDriver;
28 class UAnimationSet;
29 class UPlayListManager;
30 class UPlayList;
33 class CSkySheet;
37 class CSky
39 public:
40 // ctor
41 CSky();
42 // dtor
43 ~CSky();
44 /** init from a sky sheet and a scene
45 * \param unsupportedObjects If not NULL, will be filled with the names of the shapes that the driver cannot render
47 void init(NL3D::UDriver *drv, const CSkySheet &sheet, bool forceFallbaclVersion = false, float numHourInDay = 24.f, std::vector<std::string> *unsupportedObjects = NULL);
48 // release all datas, including the sky scene
49 void release();
50 /** Setup the sky
51 * \param skyScene the sky is rendered fof
52 * \return the number of visible objects
54 uint setup(const CClientDate &date, const CClientDate &animationDate, float weatherLevel, CRGBA fogColor, const NLMISC::CVector &sunLightDir, bool envMapScene);
55 // Get the sky scene
56 NL3D::UScene *getScene() { return _Scene; }
57 // Get number of objects in the sky
58 uint getNumObjects() const { return uint(_Objects.size()); }
59 const CSkyObject &getObject(uint index) const { return _Objects[index]; }
60 // test if the sky has a fog color
61 bool hasFogColor() const { return _FogColor != NULL; }
62 // compute fog color
63 NLMISC::CRGBA computeFogColor(const CClientDate &date, float weatherLevel) const;
64 float getWaterEnvMapCameraHeight() const { return _WaterEnvMapCameraHeight; }
65 uint8 getWaterEnvMapAlpha() const { return _WaterEnvMapAlpha; }
66 private:
67 std::vector<CSkyObject> _Objects; // all the object in the sky
68 std::vector<NLMISC::CBitmap *> _Bitmaps; // all the bitmaps for the color lookups
69 NL3D::UScene *_Scene;
70 NL3D::UDriver *_Driver;
71 NL3D::UInstanceGroup *_IG;
72 double _AnimLengthInSeconds;
73 float _NumHourInDay;
74 NL3D::UAnimationSet *_AnimationSet;
75 NL3D::UPlayListManager *_PlayListManager;
76 NL3D::UPlayList *_PlayList;
77 // Bitmap that gives the lighting of the sky scene depending on weather & hour
78 NLMISC::CBitmap *_AmbientSunLight;
79 NLMISC::CBitmap *_DiffuseSunLight;
80 NLMISC::CBitmap *_FogColor;
81 float _WaterEnvMapCameraHeight;
82 uint8 _WaterEnvMapAlpha;
86 // retrieve a bitmap from its name, find it in the map if it has already been built, or load it and add it otherwise
87 NLMISC::CBitmap *buildSharedBitmap(const std::string &filename,
88 std::map<std::string, NLMISC::CBitmap *> &bitmapByName,
89 std::vector<NLMISC::CBitmap *> &builtBitmaps,
90 bool &alreadyBuilt
93 #endif