diff --git a/src/MsdfAtlasLayerCombo.cpp b/src/MsdfAtlasLayerCombo.cpp index 3cfebd2..3326474 100644 --- a/src/MsdfAtlasLayerCombo.cpp +++ b/src/MsdfAtlasLayerCombo.cpp @@ -14,6 +14,7 @@ void MsdfAtlasLayerCombo::setup(const ComboIdentifier & layerIdentifier, atlasSettings.minimumScale = this->settings.minimumScale; atlasSettings.characters = ""; atlasSettings.maxInterpolationStepSize = this->settings.maxInterpolationStepSize; + scaleFactor = 64.0 / this->settings.scale; atlas = make_shared (); @@ -43,6 +44,7 @@ void MsdfAtlasLayerCombo::careForChild(shared_ptr layer){ msdfLayer->setDirtyDirty(true); msdfLayer->setAtlas(this->atlas); msdfLayer->setShader(msdfShader); + msdfLayer->scaleFactor = scaleFactor; auto & as = atlas->settings; for(const char c : layer->getProps().text){ if(as.characters.find(c) == std::string::npos){ diff --git a/src/MsdfAtlasLayerCombo.h b/src/MsdfAtlasLayerCombo.h index cf19eb0..4aac291 100644 --- a/src/MsdfAtlasLayerCombo.h +++ b/src/MsdfAtlasLayerCombo.h @@ -33,5 +33,6 @@ class MsdfAtlasLayerCombo : public AtlasLayerCombo { VFlipState vFlip; ComboIdentifier identifier; bool isDirty = false; + float scaleFactor = 1.0; }; } diff --git a/src/MsdfLayer.cpp b/src/MsdfLayer.cpp index 79d4e9b..b72fab6 100644 --- a/src/MsdfLayer.cpp +++ b/src/MsdfLayer.cpp @@ -168,6 +168,7 @@ void MsdfLayer::drawCharacter(const char character, const ofImage & atlasImage = atlas->getAtlasImage(); ofDisableAlphaBlending(); ofEnableDepthTest(); + scale *= scaleFactor; float pixelRange = 2; int atlas_w = atlasImage.getWidth(); int atlas_h = atlasImage.getHeight(); diff --git a/src/MsdfLayer.h b/src/MsdfLayer.h index 8b9d917..fd849bb 100644 --- a/src/MsdfLayer.h +++ b/src/MsdfLayer.h @@ -52,6 +52,7 @@ class MsdfLayer : public Layer { /// \brief hashed id, or just counting up string id = ""; VFlipState vFlip = V_FLIP_UNKNOWN; + float scaleFactor = 1.0; private: Props lastProps;