use text from layer for atlas
This commit is contained in:
parent
9728c288b5
commit
94f0da2768
1 changed files with 7 additions and 3 deletions
|
@ -8,6 +8,7 @@ void LayerComposition::setup(){
|
||||||
ofxMsdfgen::AtlasSettings settings;
|
ofxMsdfgen::AtlasSettings settings;
|
||||||
//settings.characters = "ABCDEFGHIJKL";
|
//settings.characters = "ABCDEFGHIJKL";
|
||||||
settings.scale = 64;
|
settings.scale = 64;
|
||||||
|
settings.characters = "";
|
||||||
//string fontName = "RobotoFlex.ttf";
|
//string fontName = "RobotoFlex.ttf";
|
||||||
//string fontPath = "data/fonts/" + fontName;
|
//string fontPath = "data/fonts/" + fontName;
|
||||||
//string fontPath = "data/celines-fonts/testing2VF.ttf";
|
//string fontPath = "data/celines-fonts/testing2VF.ttf";
|
||||||
|
@ -15,10 +16,7 @@ void LayerComposition::setup(){
|
||||||
//string fontPath = "data/celines-fonts/Alfarn2.otf";
|
//string fontPath = "data/celines-fonts/Alfarn2.otf";
|
||||||
//string fontPath = "data/celines-fonts/Cottagecore.ttf";
|
//string fontPath = "data/celines-fonts/Cottagecore.ttf";
|
||||||
atlas = make_shared <ofxMsdfgen::Atlas>();
|
atlas = make_shared <ofxMsdfgen::Atlas>();
|
||||||
atlas->setup(fontPath, settings);
|
|
||||||
|
|
||||||
atlasImage = make_shared <ofImage>(atlas->getAtlasImage());
|
|
||||||
glyphGeometries = atlas->getGlyphGeometries();
|
|
||||||
msdfShader = make_shared <ofShader>();
|
msdfShader = make_shared <ofShader>();
|
||||||
#ifdef TARGET_EMSCRIPTEN
|
#ifdef TARGET_EMSCRIPTEN
|
||||||
msdfShader->load("ofxMsdfgen/shaders/unitRange/ES3/shader");
|
msdfShader->load("ofxMsdfgen/shaders/unitRange/ES3/shader");
|
||||||
|
@ -32,8 +30,14 @@ void LayerComposition::setup(){
|
||||||
|
|
||||||
layer->setProps(Layer::Props());
|
layer->setProps(Layer::Props());
|
||||||
|
|
||||||
|
settings.characters += layer->getProps().text;
|
||||||
layers.push_back(std::move(layer));
|
layers.push_back(std::move(layer));
|
||||||
|
|
||||||
|
atlas->setup(fontPath, settings);
|
||||||
|
atlas->generate();
|
||||||
|
atlasImage = make_shared <ofImage>(atlas->getAtlasImage());
|
||||||
|
glyphGeometries = atlas->getGlyphGeometries();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerComposition::update(){
|
void LayerComposition::update(){
|
||||||
|
|
Loading…
Reference in a new issue