aboutsummaryrefslogtreecommitdiff
path: root/src/client/sky.h
diff options
context:
space:
mode:
authornumzero <numzer0@yandex.ru>2020-11-22 16:29:31 +0300
committerlhofhansl <larsh@apache.org>2020-11-26 12:49:10 -0800
commit3077afc0a2039cd4c8d64d9df62ed9b2ba6463dc (patch)
tree1e72b17196b7290632ebe7472029e72b53b049bd /src/client/sky.h
parent89cc5bf53730d72744d45f92fc11dc9ab6c232c9 (diff)
downloaddragonfireclient-3077afc0a2039cd4c8d64d9df62ed9b2ba6463dc.tar.xz
Store stars in a single static mesh buffer
Diffstat (limited to 'src/client/sky.h')
-rw-r--r--src/client/sky.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/sky.h b/src/client/sky.h
index 3227e8f59..176545015 100644
--- a/src/client/sky.h
+++ b/src/client/sky.h
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <array>
#include "camera.h"
#include "irrlichttypes_extrabloated.h"
+#include "irr_ptr.h"
#include "skyparams.h"
#pragma once
@@ -77,7 +78,7 @@ public:
void setStarsVisible(bool stars_visible) { m_star_params.visible = stars_visible; }
void setStarCount(u16 star_count, bool force_update);
void setStarColor(video::SColor star_color) { m_star_params.starcolor = star_color; }
- void setStarScale(f32 star_scale) { m_star_params.scale = star_scale; }
+ void setStarScale(f32 star_scale) { m_star_params.scale = star_scale; updateStars(); }
bool getCloudsVisible() const { return m_clouds_visible && m_clouds_enabled; }
const video::SColorf &getCloudColor() const { return m_cloudcolor_f; }
@@ -178,13 +179,16 @@ private:
bool m_default_tint = true;
- std::vector<v3f> m_stars;
+ irr_ptr<scene::SMeshBuffer> m_stars;
video::ITexture *m_sun_texture;
video::ITexture *m_moon_texture;
video::ITexture *m_sun_tonemap;
video::ITexture *m_moon_tonemap;
+ void updateStars();
+ void updateStarsColor(video::SColor color);
+
void draw_sun(video::IVideoDriver *driver, float sunsize, const video::SColor &suncolor,
const video::SColor &suncolor2, float wicked_time_of_day);
void draw_moon(video::IVideoDriver *driver, float moonsize, const video::SColor &mooncolor,