From fe4bb00108eecf2f3a89543f6601e4a15fd9fbd2 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Fri, 18 Sep 2020 10:23:47 +0200 Subject: [PATCH] Even more cleanup --- modules/exoplanets/rendering/renderableorbitdisc.cpp | 9 +-------- modules/exoplanets/rendering/renderableorbitdisc.h | 12 ++++++------ modules/exoplanets/shaders/orbitdisc_fs.glsl | 12 ------------ modules/exoplanets/shaders/orbitdisc_vs.glsl | 2 +- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/modules/exoplanets/rendering/renderableorbitdisc.cpp b/modules/exoplanets/rendering/renderableorbitdisc.cpp index 9c18d32c36..590dbe74c8 100644 --- a/modules/exoplanets/rendering/renderableorbitdisc.cpp +++ b/modules/exoplanets/rendering/renderableorbitdisc.cpp @@ -115,13 +115,6 @@ RenderableOrbitDisc::RenderableOrbitDisc(const ghoul::Dictionary& dictionary) , _size(SizeInfo, 1.f, 0.f, 3.0e12f) , _eccentricity(EccentricityInfo, 0.f, 0.f, 1.f) , _offset(OffsetInfo, glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(1.f)) - , _shader(nullptr) - , _texture(nullptr) - , _textureFile(nullptr) - , _textureIsDirty(false) - , _quad(0) - , _vertexPositionBuffer(0) - , _planeIsDirty(false) { using ghoul::filesystem::File; @@ -145,7 +138,7 @@ RenderableOrbitDisc::RenderableOrbitDisc(const ghoul::Dictionary& dictionary) _texturePath = absPath(dictionary.value(TextureInfo.identifier)); _textureFile = std::make_unique(_texturePath); - _texturePath.onChange([&]() { loadTexture(); }); + _texturePath.onChange([&]() { _textureIsDirty = true; }); addProperty(_texturePath); _textureFile->setCallback([&](const File&) { _textureIsDirty = true; }); diff --git a/modules/exoplanets/rendering/renderableorbitdisc.h b/modules/exoplanets/rendering/renderableorbitdisc.h index 7d68d33d81..3cae6e64c4 100644 --- a/modules/exoplanets/rendering/renderableorbitdisc.h +++ b/modules/exoplanets/rendering/renderableorbitdisc.h @@ -65,16 +65,16 @@ private: properties::FloatProperty _eccentricity; properties::Vec2Property _offset; - std::unique_ptr _shader; + std::unique_ptr _shader = nullptr; UniformCache(modelViewProjection, textureOffset, opacity, texture, eccentricity, semiMajorAxis) _uniformCache; - std::unique_ptr _texture; + std::unique_ptr _texture = nullptr; std::unique_ptr _textureFile; - bool _textureIsDirty; - bool _planeIsDirty; - GLuint _quad; - GLuint _vertexPositionBuffer; + bool _textureIsDirty = false; + bool _planeIsDirty = false; + GLuint _quad = 0; + GLuint _vertexPositionBuffer = 0; }; } // namespace openspace diff --git a/modules/exoplanets/shaders/orbitdisc_fs.glsl b/modules/exoplanets/shaders/orbitdisc_fs.glsl index 2bba81566e..758aa7a569 100644 --- a/modules/exoplanets/shaders/orbitdisc_fs.glsl +++ b/modules/exoplanets/shaders/orbitdisc_fs.glsl @@ -107,18 +107,6 @@ Fragment getFragment() { vec4 diffuse = texture(discTexture, textureCoord); diffuse.a *= opacity; - // The normal for the one plane depends on whether we are dealing - // with a front facing or back facing fragment - vec3 normal; - // The plane is oriented on the xz plane - // WARNING: This might not be the case for Uranus - if (gl_FrontFacing) { - normal = vec3(-1.0, 0.0, 0.0); - } - else { - normal = vec3(1.0, 0.0, 0.0); - } - Fragment frag; frag.color = diffuse; frag.depth = vs_position.w; diff --git a/modules/exoplanets/shaders/orbitdisc_vs.glsl b/modules/exoplanets/shaders/orbitdisc_vs.glsl index 65ff4bdabe..e998350ce7 100644 --- a/modules/exoplanets/shaders/orbitdisc_vs.glsl +++ b/modules/exoplanets/shaders/orbitdisc_vs.glsl @@ -37,7 +37,7 @@ uniform mat4 modelViewProjectionTransform; void main() { vs_st = in_st; vs_position = z_normalization( - modelViewProjectionTransform * vec4(in_position.xy, 0.0, 1.0) + modelViewProjectionTransform * vec4(in_position, 0.0, 1.0) ); gl_Position = vs_position;