From b14f4f8b4b32413f62b42bfc6197dcdb19b894e3 Mon Sep 17 00:00:00 2001 From: Hleb Valoshka <375gnu@gmail.com> Date: Mon, 11 Nov 2019 01:13:39 +0300 Subject: [PATCH] Tiny cleanup in renderer --- src/celengine/render.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/celengine/render.cpp b/src/celengine/render.cpp index 91de7158..364fc7d3 100644 --- a/src/celengine/render.cpp +++ b/src/celengine/render.cpp @@ -3513,8 +3513,7 @@ void Renderer::draw(const Observer& observer, glDisable(GL_LIGHTING); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_FILL); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glDisable(GL_BLEND); glDepthMask(GL_TRUE); @@ -4579,9 +4578,11 @@ void Renderer::renderObject(const Vector3f& pos, Texture* cloudTex = nullptr; Texture* cloudNormalMap = nullptr; float cloudTexOffset = 0.0f; - if (obj.atmosphere != nullptr) + // Ugly cast required because MultiResTexture::find() is non-const + Atmosphere* atmosphere = const_cast(obj.atmosphere); + + if (atmosphere != nullptr) { - Atmosphere* atmosphere = const_cast(obj.atmosphere); // Ugly cast required because MultiResTexture::find() is non-const if ((renderFlags & ShowCloudMaps) != 0) { if (atmosphere->cloudTexture.tex[textureResolution] != InvalidResource) @@ -4599,7 +4600,7 @@ void Renderer::renderObject(const Vector3f& pos, if (lit) { renderEllipsoid_GLSL(ri, ls, - const_cast(obj.atmosphere), cloudTexOffset, + atmosphere, cloudTexOffset, scaleFactors, textureResolution, renderFlags, @@ -4659,10 +4660,8 @@ void Renderer::renderObject(const Vector3f& pos, } } - if (obj.atmosphere != nullptr) + if (atmosphere != nullptr) { - Atmosphere* atmosphere = const_cast(obj.atmosphere); - // Compute the apparent thickness in pixels of the atmosphere. // If it's only one pixel thick, it can look quite unsightly // due to aliasing. To avoid popping, we gradually fade in the @@ -4779,8 +4778,7 @@ void Renderer::renderObject(const Vector3f& pos, if (obj.rings != nullptr && (renderFlags & ShowPlanetRings) != 0) { - if ((obj.surface->appearanceFlags & Surface::Emissive) == 0 && - (renderFlags & ShowRingShadows) != 0) + if (lit && (renderFlags & ShowRingShadows) != 0) { Texture* ringsTex = obj.rings->texture.find(textureResolution); if (ringsTex != nullptr)