3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "irrlichttypes_extrabloated.h"
21 #include <ISceneNode.h>
26 #define SKY_MATERIAL_COUNT 3
27 #define SKY_STAR_COUNT 200
29 // Skybox, rendered with zbuffer turned off, before all other nodes.
30 class Sky : public scene::ISceneNode
34 Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id);
36 virtual void OnRegisterSceneNode();
39 virtual void render();
41 virtual const core::aabbox3d<f32>& getBoundingBox() const;
43 // Used by Irrlicht for optimizing rendering
44 virtual video::SMaterial& getMaterial(u32 i)
45 { return m_materials[i]; }
47 // Used by Irrlicht for optimizing rendering
48 virtual u32 getMaterialCount() const
49 { return SKY_MATERIAL_COUNT; }
51 void update(float m_time_of_day, float time_brightness,
52 float direct_brightness, bool sunlight_seen);
54 float getBrightness(){ return m_brightness; }
55 video::SColor getBgColor(){ return m_bgcolor; }
56 video::SColor getSkyColor(){ return m_skycolor; }
58 bool getCloudsVisible(){ return m_clouds_visible; }
59 video::SColorf getCloudColor(){ return m_cloudcolor_f; }
62 core::aabbox3d<f32> Box;
63 video::SMaterial m_materials[SKY_MATERIAL_COUNT];
67 float m_time_brightness;
70 float m_cloud_brightness;
71 bool m_clouds_visible;
72 video::SColorf m_bgcolor_bright_f;
73 video::SColorf m_skycolor_bright_f;
74 video::SColorf m_cloudcolor_bright_f;
75 video::SColor m_bgcolor;
76 video::SColor m_skycolor;
77 video::SColorf m_cloudcolor_f;
78 v3f m_stars[SKY_STAR_COUNT];
79 u16 m_star_indices[SKY_STAR_COUNT*4];
80 video::S3DVertex m_star_vertices[SKY_STAR_COUNT*4];