allow setting width/height for layerComposition

This commit is contained in:
jrkb 2023-04-30 17:40:45 +02:00
parent 6d24ca935f
commit 30c1d7f5a2
4 changed files with 5 additions and 7 deletions

View file

@ -135,12 +135,10 @@ bool GPUFontAtlasLayerCombo::hasChildren(){
const vector <shared_ptr <GPUFontLayer> > & GPUFontAtlasLayerCombo::getLayers(){
return layers;
}
void GPUFontAtlasLayerCombo::draw(){
void GPUFontAtlasLayerCombo::draw(int width, int height){
OFX_PROFILER_FUNCTION();
GLuint location;
int width = ofGetWidth();
int height = ofGetHeight();
glm::vec2 mouse = glm::vec2(ofGetMouseX(), ofGetMouseY());
//glm::mat4 projection = transform.getProjectionMatrix((float)width / height);

View file

@ -75,7 +75,7 @@ class GPUFontAtlasLayerCombo : public AtlasLayerCombo {
bool hasChildren() override;
const vector <shared_ptr <GPUFontLayer> > & getLayers();
void draw();
void draw(int width, int height);
shared_ptr <ofxGPUFont::Font> font;
string mainText = "";

View file

@ -174,7 +174,7 @@ shared_ptr <Layer> LayerComposition::getLayer(const LayerID & layerID){
return layers[layerID];
}
void LayerComposition::draw() const {
void LayerComposition::draw(int width, int height) const {
for(const auto & layer_it : layers){
if(layer_it.second->getType() == LayerType::MSDFGEN){
layer_it.second->draw(glm::vec3(200, 200, 0));
@ -184,7 +184,7 @@ void LayerComposition::draw() const {
if(combo_it.first.type == LayerType::GPUFONT){
auto combo =
static_pointer_cast <GPUFontAtlasLayerCombo>(combo_it.second);
combo->draw();
combo->draw(width, height);
}
}
}

View file

@ -14,7 +14,7 @@ class LayerComposition {
public:
void setup();
void update();
void draw() const;
void draw(int width = 0, int height = 0) const;
LayerID addLayer(const Layer::Props & props,
LayerID layerID = "");
LayerID addLayer(const ComboIdentifier & identifier,