allow scale when drawing character (and other minor stuff)
This commit is contained in:
parent
f4ad2679c9
commit
5d52383aaa
3 changed files with 7 additions and 2 deletions
|
@ -36,7 +36,7 @@ class Layer {
|
|||
bool mirror_y = false;
|
||||
float mirror_y_distance = 0;
|
||||
float letterDelay = 0;
|
||||
string text = "abcdefghijklmnoprstuvqxyzABUIWERJSD";
|
||||
string text = "abc";
|
||||
string fontPath;
|
||||
};
|
||||
|
||||
|
@ -47,6 +47,7 @@ class Layer {
|
|||
glm::vec3 position = glm::vec3(0, 0, 0),
|
||||
glm::vec4 color = glm::vec4(1, 1, 1, 1),
|
||||
float rotation = 0,
|
||||
float scale = 1,
|
||||
ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) = 0;
|
||||
virtual void setProps(const Props & props) = 0;
|
||||
virtual const Props & getProps() const = 0;
|
||||
|
|
|
@ -164,6 +164,7 @@ void MsdfLayer::drawCharacter(const char character,
|
|||
glm::vec3 position,
|
||||
glm::vec4 color,
|
||||
float rotation,
|
||||
float scale,
|
||||
ofxVariableLab::FontVariation fontVariation){
|
||||
const ofImage & atlasImage = atlas->getAtlasImage();
|
||||
ofDisableAlphaBlending();
|
||||
|
@ -250,7 +251,7 @@ void MsdfLayer::drawCharacter(const char character,
|
|||
shader->setUniform2f("scale_b", scale_b);
|
||||
shader->setUniform1f("msdf_mix", mix);
|
||||
//ofRotateDeg(rotation, 0, 0, 1);
|
||||
atlasImage.draw(0, 0, w, h);
|
||||
atlasImage.draw(0, 0, w * scale, h * scale);
|
||||
shader->end();
|
||||
ofPopMatrix();
|
||||
ofPopStyle();
|
||||
|
@ -275,6 +276,8 @@ const Layer::Type & MsdfLayer::getType() const {
|
|||
|
||||
void MsdfLayer::setAtlas(shared_ptr <ofxMsdfgen::Atlas> _atlas){
|
||||
atlas = _atlas;
|
||||
// TODO: this does not seem proper
|
||||
propsBuffer[0].fontSize_px = atlas->settings.scale;
|
||||
}
|
||||
shared_ptr <ofxMsdfgen::Atlas> MsdfLayer::getAtlas() const {
|
||||
return atlas;
|
||||
|
|
|
@ -17,6 +17,7 @@ class MsdfLayer : public Layer {
|
|||
glm::vec3 position = glm::vec3(0, 0, 0),
|
||||
glm::vec4 color = glm::vec4(1, 1, 1, 1),
|
||||
float rotation = 0,
|
||||
float scale = 1,
|
||||
ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) override;
|
||||
void setProps(const Props & props) override;
|
||||
const Props & getProps() const override;
|
||||
|
|
Loading…
Reference in a new issue