diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/sky.cpp | 35 | ||||
-rw-r--r-- | src/script/lua_api/l_object.cpp | 2 | ||||
-rw-r--r-- | src/skyparams.h | 9 |
3 files changed, 15 insertions, 31 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 diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 70e21f088..23ed1ffe0 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -2059,7 +2059,7 @@ int ObjectRef::l_set_stars(lua_State *L) lua_pop(L, 1); star_params.scale = getfloatfield_default(L, 2, - "size", star_params.scale); + "scale", star_params.scale); getServer(L)->setStars(player, star_params); lua_pushboolean(L, true); diff --git a/src/skyparams.h b/src/skyparams.h index 877907e31..9fdfd89da 100644 --- a/src/skyparams.h +++ b/src/skyparams.h @@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once -struct skycolor +struct SkyColor { video::SColor day_sky; video::SColor day_horizon; @@ -36,7 +36,7 @@ struct SkyboxParams std::string type; std::vector<std::string> textures; bool clouds; - skycolor sky_color; + SkyColor sky_color; video::SColor sun_tint; video::SColor moon_tint; std::string tint_type; @@ -72,9 +72,9 @@ struct StarParams class SkyboxDefaults { public: - const skycolor getSkyColorDefaults() + const SkyColor getSkyColorDefaults() { - skycolor sky; + SkyColor sky; // Horizon colors sky.day_horizon = video::SColor(255, 155, 193, 240); sky.indoors = video::SColor(255, 100, 100, 100); @@ -112,6 +112,7 @@ public: const StarParams getStarDefaults() { StarParams stars; + stars.visible = true; stars.count = 1000; stars.starcolor = video::SColor(105, 235, 235, 255); stars.scale = 1; |