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 #include "sky_object.h"
20 #include "time_client.h"
29 class UPlayListManager
;
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
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
);
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
; }
63 NLMISC::CRGBA
computeFogColor(const CClientDate
&date
, float weatherLevel
) const;
64 float getWaterEnvMapCameraHeight() const { return _WaterEnvMapCameraHeight
; }
65 uint8
getWaterEnvMapAlpha() const { return _WaterEnvMapAlpha
; }
67 std::vector
<CSkyObject
> _Objects
; // all the object in the sky
68 std::vector
<NLMISC::CBitmap
*> _Bitmaps
; // all the bitmaps for the color lookups
70 NL3D::UDriver
*_Driver
;
71 NL3D::UInstanceGroup
*_IG
;
72 double _AnimLengthInSeconds
;
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
,