Make it possible to fade in/out RenderableFieldLinesSequences (e.g. magnetosphere)

This commit is contained in:
Emma Broman
2023-08-07 09:46:24 +02:00
parent 8b923f3a4b
commit 15dbe32341
2 changed files with 6 additions and 1 deletions
@@ -354,6 +354,8 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence(
{
const Parameters p = codegen::bake<Parameters>(dictionary);
addProperty(Fadeable::_opacity);
// Extracts the general information (from the asset file) that
// is mandatory for the class to function;
std::string fileTypeString;
@@ -1031,6 +1033,8 @@ void RenderableFieldlinesSequence::render(const RenderData& data, RendererTasks&
global::windowDelegate->applicationTime() * (_flowReversed ? -1 : 1)
);
_shaderProgram->setUniform("opacity", opacity());
bool additiveBlending = false;
if (_colorABlendEnabled) {
additiveBlending = true;
@@ -28,7 +28,7 @@ in vec4 vs_color;
in float vs_depth;
uniform bool usingAdditiveBlending;
uniform float opacity;
Fragment getFragment() {
if (vs_color.a == 0) {
@@ -40,6 +40,7 @@ Fragment getFragment() {
Fragment frag;
frag.depth = vs_depth;
frag.color = fragColor;
frag.color.a *= opacity;
// G-Buffer
frag.gPosition = vec4(0.0);//vs_gPosition;