From 04f0b1281a4c032497e53dfce46d22fa4349e431 Mon Sep 17 00:00:00 2001 From: Malin E Date: Tue, 15 Nov 2022 16:06:05 +0100 Subject: [PATCH] Remove EnableOpacityBlending property for models (unused) --- modules/base/rendering/renderablemodel.cpp | 24 +++------------------- modules/base/rendering/renderablemodel.h | 3 +-- modules/base/shaders/modelOpacity_fs.glsl | 9 +------- 3 files changed, 5 insertions(+), 31 deletions(-) diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 67333f808f..84ea0c8271 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -84,8 +84,8 @@ namespace { "specularIntensity" }; - constexpr std::array UniformOpacityNames = { - "opacity", "opacityBlending", "colorTexture", "depthTexture", "positionTexture", + constexpr std::array UniformOpacityNames = { + "opacity", "colorTexture", "depthTexture", "positionTexture", "normalTexture" }; @@ -152,12 +152,6 @@ namespace { "respect to the opacity" }; - constexpr openspace::properties::Property::PropertyInfo EnableOpacityBlendingInfo = { - "EnableOpacityBlending", - "Enable Opacity Blending", - "Enable Opacity Blending" - }; - struct [[codegen::Dictionary(RenderableModel)]] Parameters { // The file or files that should be loaded in this RenderableModel. The file can // contain filesystem tokens. This specifies the model that is rendered by @@ -261,9 +255,6 @@ namespace { // [[codegen::verbatim(BlendingOptionInfo.description)]] std::optional blendingOption; - // [[codegen::verbatim(EnableOpacityBlendingInfo.description)]] - std::optional enableOpacityBlending; - // The path to the vertex shader program that is used instead of the default // shader. std::optional vertexShader; @@ -297,7 +288,6 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) ) , _rotationVec(RotationVecInfo, glm::dvec3(0.0), glm::dvec3(0.0), glm::dvec3(360.0)) , _disableDepthTest(DisableDepthTestInfo, false) - , _enableOpacityBlending(EnableOpacityBlendingInfo, false) , _blendingFuncOption( BlendingOptionInfo, properties::OptionProperty::DisplayType::Dropdown @@ -494,10 +484,6 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) _blendingFuncOption.set(BlendingMapping[blendingOpt]); } - _enableOpacityBlending = p.enableOpacityBlending.value_or(_enableOpacityBlending); - - addProperty(_enableOpacityBlending); - _originalRenderBin = renderBin(); } @@ -792,7 +778,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) { // Render Pass 1 // Render all parts of the model into the new framebuffer without opacity const float o = opacity(); - if ((o >= 0.f && o < 1.f) || _disableDepthTest || _enableOpacityBlending) { + if ((o >= 0.f && o < 1.f) || _disableDepthTest) { setRenderBin(Renderable::RenderBin::PostDeferredTransparent); } else { @@ -817,10 +803,6 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) { _quadProgram->activate(); _quadProgram->setUniform(_uniformOpacityCache.opacity, opacity()); - _quadProgram->setUniform( - _uniformOpacityCache.opacityBlending, - _enableOpacityBlending - ); // Bind textures ghoul::opengl::TextureUnit colorTextureUnit; diff --git a/modules/base/rendering/renderablemodel.h b/modules/base/rendering/renderablemodel.h index 9c193c05f8..ca84a6b61c 100644 --- a/modules/base/rendering/renderablemodel.h +++ b/modules/base/rendering/renderablemodel.h @@ -98,7 +98,6 @@ private: properties::Vec3Property _rotationVec; properties::BoolProperty _disableDepthTest; - properties::BoolProperty _enableOpacityBlending; properties::OptionProperty _blendingFuncOption; std::string _vertexShaderPath; @@ -124,7 +123,7 @@ private: // Opacity program ghoul::opengl::ProgramObject* _quadProgram = nullptr; - UniformCache(opacity, opacityBlending, colorTexture, depthTexture, positionTexture, + UniformCache(opacity, colorTexture, depthTexture, positionTexture, normalTexture) _uniformOpacityCache; // Store the original RenderBin diff --git a/modules/base/shaders/modelOpacity_fs.glsl b/modules/base/shaders/modelOpacity_fs.glsl index e5af586447..a9a0da3281 100644 --- a/modules/base/shaders/modelOpacity_fs.glsl +++ b/modules/base/shaders/modelOpacity_fs.glsl @@ -28,7 +28,6 @@ in vec2 vs_st; uniform float opacity = 1.0; -uniform bool opacityBlending = false; uniform sampler2D colorTexture; uniform sampler2D depthTexture; @@ -44,13 +43,7 @@ Fragment getFragment() { } frag.color.rgb = textureColor.rgb; - - if (opacityBlending) { - frag.color.a = opacity * max(max(frag.color.r, frag.color.g), frag.color.b); - } - else { - frag.color.a = opacity * textureColor.a; - } + frag.color.a = opacity * textureColor.a; frag.depth = denormalizeFloat(texture(depthTexture, vs_st).x); frag.gPosition = texture(positionTexture, vs_st);