aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/sky.cpp35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/client/sky.cpp b/src/client/sky.cpp
index f2cab2f0f..7a7b188ce 100644
--- a/src/client/sky.cpp
+++ b/src/client/sky.cpp
@@ -724,10 +724,10 @@ void Sky::draw_stars(video::IVideoDriver * driver, float wicked_time_of_day)
if (m_star_params.starcolor.getAlpha() < 1)
return;
#if ENABLE_GLES
- u16 *indices = new u16[m_star_count * 3];
+ u16 *indices = new u16[m_star_params.count * 3];
video::S3DVertex *vertices =
- new video::S3DVertex[m_star_count * 3];
- for (u32 i = 0; i < m_star_count; i++) {
+ new video::S3DVertex[m_star_params.count * 3];
+ for (u32 i = 0; i < m_star_params.count; i++) {
indices[i * 3 + 0] = i * 3 + 0;
indices[i * 3 + 1] = i * 3 + 1;
indices[i * 3 + 2] = i * 3 + 2;
@@ -750,8 +750,8 @@ void Sky::draw_stars(video::IVideoDriver * driver, float wicked_time_of_day)
vertices[i * 3 + 2].Pos = p2;
vertices[i * 3 + 2].Color = starcolor;
}
- driver->drawIndexedTriangleList(vertices.data(), m_star_count * 3,
- indices.data(), m_star_count);
+ driver->drawIndexedTriangleList(vertices, m_star_params.count * 3,
+ indices, m_star_params.count);
delete[] indices;
delete[] vertices;
#else
@@ -864,7 +864,7 @@ void Sky::setSunTexture(std::string sun_texture,
}
}
-void Sky::setSunriseTexture(std::string sunglow_texture,
+void Sky::setSunriseTexture(std::string sunglow_texture,
ITextureSource* tsrc)
{
// Ignore matching textures (with modifiers) entirely.
@@ -876,7 +876,7 @@ void Sky::setSunriseTexture(std::string sunglow_texture,
);
}
-void Sky::setMoonTexture(std::string moon_texture,
+void Sky::setMoonTexture(std::string moon_texture,
std::string moon_tonemap, ITextureSource *tsrc)
{
// Ignore matching textures (with modifiers) entirely,
@@ -914,25 +914,8 @@ void Sky::setMoonTexture(std::string moon_texture,
void Sky::setStarCount(u16 star_count, bool force_update)
{
- // Force updating star count at game init.
- if (force_update) {
- m_star_params.count = star_count;
- m_stars.clear();
- // Rebuild the stars surrounding the camera
- for (u16 i = 0; i < star_count; i++) {
- v3f star = v3f(
- myrand_range(-10000, 10000),
- myrand_range(-10000, 10000),
- myrand_range(-10000, 10000)
- );
-
- star.normalize();
- m_stars.emplace_back(star);
- }
- // Ignore changing star count if the new value is identical
- } else if (m_star_params.count == star_count)
- return;
- else {
+ // Allow force updating star count at game init.
+ if (m_star_params.count != star_count || force_update) {
m_star_params.count = star_count;
m_stars.clear();
// Rebuild the stars surrounding the camera