Update disc rendering to not conflict with atmosphere

This commit is contained in:
Emma Broman
2021-01-20 13:16:36 +01:00
parent 968d0eea64
commit 10d615cdc8
3 changed files with 14 additions and 11 deletions

View File

@@ -124,6 +124,8 @@ RenderableDisc::RenderableDisc(const ghoul::Dictionary& dictionary)
addProperty(_width);
addProperty(_opacity);
setRenderBin(Renderable::RenderBin::PostDeferredTransparent);
}
bool RenderableDisc::isReady() const {
@@ -185,7 +187,7 @@ void RenderableDisc::render(const RenderData& data, RendererTasks&) {
_shader->setUniform(_uniformCache.texture, unit);
glEnablei(GL_BLEND, 0);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
glDisable(GL_CULL_FACE);

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* Copyright (c) 2014-2021 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -25,7 +25,7 @@
#include "fragment.glsl"
in vec2 vs_st;
in vec4 vs_position;
in float vs_screenSpaceDepth;
uniform sampler1D colorTexture;
uniform float width;
@@ -55,6 +55,6 @@ Fragment getFragment() {
Fragment frag;
frag.color = diffuse;
frag.depth = vs_position.w;
frag.depth = vs_screenSpaceDepth;
return frag;
}

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* Copyright (c) 2014-2021 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -30,15 +30,16 @@ layout(location = 0) in vec2 in_position;
layout(location = 1) in vec2 in_st;
out vec2 vs_st;
out vec4 vs_position;
out float vs_screenSpaceDepth;
uniform mat4 modelViewProjectionTransform;
void main() {
vs_st = in_st;
vec4 position = vec4(in_position.xy, 0.0, 1.0);
vec4 positionScreenSpace = z_normalization(modelViewProjectionTransform * position);
vs_position = z_normalization(
modelViewProjectionTransform * vec4(in_position.xy, 0.0, 1.0)
);
gl_Position = vs_position;
vs_st = in_st;
vs_screenSpaceDepth = positionScreenSpace.w;
gl_Position = positionScreenSpace;
}