Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / client_sheets / sky_sheet.cpp
blobc6a04bd68654375a5c060fddc2327e5ce4d316a6
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 #include "stdpch.h"
18 #include "sky_sheet.h"
20 // *****************************************************************************************************
21 CSkySheet::CSkySheet()
23 AnimLengthInSeconds = 3; // by default, anim last 3 secconds (over 90 frames)
24 Type = SKY;
25 WaterEnvMapCameraHeight = 0.f;
26 WaterEnvMapAlpha = 255;
29 // *****************************************************************************************************
30 void CSkySheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix)
32 item.getValueByName(InstanceGroupName, (prefix + "InstanceGroupName").c_str());
33 item.getValueByName(AnimationName, (prefix + "AnimationName").c_str());
34 item.getValueByName(AnimLengthInSeconds, (prefix + "AnimLengthInSeconds").c_str());
35 const NLGEORGES::UFormElm *elm = NULL;
36 if(item.getNodeByName (&elm, "Objects") && elm)
38 uint numObjects;
39 nlverify (elm->getArraySize (numObjects));
40 Objects.resize(numObjects);
41 // For each sky object
42 for(uint k = 0; k < numObjects; ++k)
44 const NLGEORGES::UFormElm *objectForm;
45 if (elm->getArrayNode (&objectForm, k) && objectForm)
47 Objects[k].build(*objectForm, "");
51 item.getValueByName(AmbientSunLightBitmap, (prefix + "AmbientSunLightBitmap").c_str());
52 item.getValueByName(DiffuseSunLightBitmap, (prefix + "DiffuseSunLightBitmap").c_str());
53 item.getValueByName(FogColorBitmap, (prefix + "FogColorBitmap").c_str());
54 item.getValueByName(WaterEnvMapCameraHeight, (prefix + "WaterEnvMapCameraHeight").c_str());
55 item.getValueByName(WaterEnvMapAlpha, (prefix + "WaterEnvMapAlpha").c_str());
58 // *****************************************************************************************************
59 void CSkySheet::serial(NLMISC::IStream &f)
61 f.serial(InstanceGroupName);
62 f.serial(AnimationName);
63 f.serial(AnimLengthInSeconds);
64 f.serialCont(Objects);
65 f.serial(AmbientSunLightBitmap);
66 f.serial(DiffuseSunLightBitmap);
67 f.serial(FogColorBitmap);
68 f.serial(WaterEnvMapCameraHeight);
69 f.serial(WaterEnvMapAlpha);
72 // *****************************************************************************************************
73 void CSkySheet::build(const NLGEORGES::UFormElm &item)
75 build(item, "");