fade via uniform

This commit is contained in:
jrkb 2023-06-25 15:34:45 +02:00
parent 8b3604ec9a
commit 01740f7635
2 changed files with 3 additions and 2 deletions

View file

@ -139,7 +139,7 @@ bool MsdfAtlasLayerCombo::hasChildren(){
} }
// unique // unique
void MsdfAtlasLayerCombo::draw(){ void MsdfAtlasLayerCombo::draw(bool fade){
OFX_PROFILER_FUNCTION() OFX_PROFILER_FUNCTION()
int elements = 0; int elements = 0;
for(const auto & layer : layers){ for(const auto & layer : layers){
@ -188,6 +188,7 @@ void MsdfAtlasLayerCombo::draw(){
//ofPopStyle(); //ofPopStyle();
msdfShader->begin(); msdfShader->begin();
msdfShader->setUniform1f("fade", fade ? 1.0f : 0.0f);
msdfShader->setUniform2f("unitRange", unitRange); msdfShader->setUniform2f("unitRange", unitRange);
msdfShader->setUniform4f("bgColor", bgColor); msdfShader->setUniform4f("bgColor", bgColor);
msdfShader->setUniformTexture("msdf", getAtlasImage().getTexture(), 0); msdfShader->setUniformTexture("msdf", getAtlasImage().getTexture(), 0);

View file

@ -21,7 +21,7 @@ class MsdfAtlasLayerCombo : public AtlasLayerCombo {
const ComboIdentifier & getIdentifier() const override; const ComboIdentifier & getIdentifier() const override;
void setVFlip(VFlipState vFlipState) override; void setVFlip(VFlipState vFlipState) override;
bool hasChildren() override; bool hasChildren() override;
void draw(); void draw(bool fade = true);
void exit(); void exit();
const ofImage & getAtlasImage(); const ofImage & getAtlasImage();
string getAtlasImagePath(); string getAtlasImagePath();