From 01740f7635b1c3ff0df6433adbc75e8a83a8b6f1 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sun, 25 Jun 2023 15:34:45 +0200 Subject: [PATCH] fade via uniform --- src/MsdfAtlasLayerCombo.cpp | 3 ++- src/MsdfAtlasLayerCombo.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MsdfAtlasLayerCombo.cpp b/src/MsdfAtlasLayerCombo.cpp index 4c9da49..9be529c 100644 --- a/src/MsdfAtlasLayerCombo.cpp +++ b/src/MsdfAtlasLayerCombo.cpp @@ -139,7 +139,7 @@ bool MsdfAtlasLayerCombo::hasChildren(){ } // unique -void MsdfAtlasLayerCombo::draw(){ +void MsdfAtlasLayerCombo::draw(bool fade){ OFX_PROFILER_FUNCTION() int elements = 0; for(const auto & layer : layers){ @@ -188,6 +188,7 @@ void MsdfAtlasLayerCombo::draw(){ //ofPopStyle(); msdfShader->begin(); + msdfShader->setUniform1f("fade", fade ? 1.0f : 0.0f); msdfShader->setUniform2f("unitRange", unitRange); msdfShader->setUniform4f("bgColor", bgColor); msdfShader->setUniformTexture("msdf", getAtlasImage().getTexture(), 0); diff --git a/src/MsdfAtlasLayerCombo.h b/src/MsdfAtlasLayerCombo.h index a25c0c7..288e0dd 100644 --- a/src/MsdfAtlasLayerCombo.h +++ b/src/MsdfAtlasLayerCombo.h @@ -21,7 +21,7 @@ class MsdfAtlasLayerCombo : public AtlasLayerCombo { const ComboIdentifier & getIdentifier() const override; void setVFlip(VFlipState vFlipState) override; bool hasChildren() override; - void draw(); + void draw(bool fade = true); void exit(); const ofImage & getAtlasImage(); string getAtlasImagePath();