allow setting width/height for layerComposition
This commit is contained in:
parent
6d24ca935f
commit
30c1d7f5a2
4 changed files with 5 additions and 7 deletions
|
@ -135,12 +135,10 @@ bool GPUFontAtlasLayerCombo::hasChildren(){
|
||||||
const vector <shared_ptr <GPUFontLayer> > & GPUFontAtlasLayerCombo::getLayers(){
|
const vector <shared_ptr <GPUFontLayer> > & GPUFontAtlasLayerCombo::getLayers(){
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
void GPUFontAtlasLayerCombo::draw(){
|
void GPUFontAtlasLayerCombo::draw(int width, int height){
|
||||||
OFX_PROFILER_FUNCTION();
|
OFX_PROFILER_FUNCTION();
|
||||||
GLuint location;
|
GLuint location;
|
||||||
|
|
||||||
int width = ofGetWidth();
|
|
||||||
int height = ofGetHeight();
|
|
||||||
glm::vec2 mouse = glm::vec2(ofGetMouseX(), ofGetMouseY());
|
glm::vec2 mouse = glm::vec2(ofGetMouseX(), ofGetMouseY());
|
||||||
|
|
||||||
//glm::mat4 projection = transform.getProjectionMatrix((float)width / height);
|
//glm::mat4 projection = transform.getProjectionMatrix((float)width / height);
|
||||||
|
|
|
@ -75,7 +75,7 @@ class GPUFontAtlasLayerCombo : public AtlasLayerCombo {
|
||||||
bool hasChildren() override;
|
bool hasChildren() override;
|
||||||
|
|
||||||
const vector <shared_ptr <GPUFontLayer> > & getLayers();
|
const vector <shared_ptr <GPUFontLayer> > & getLayers();
|
||||||
void draw();
|
void draw(int width, int height);
|
||||||
|
|
||||||
shared_ptr <ofxGPUFont::Font> font;
|
shared_ptr <ofxGPUFont::Font> font;
|
||||||
string mainText = "";
|
string mainText = "";
|
||||||
|
|
|
@ -174,7 +174,7 @@ shared_ptr <Layer> LayerComposition::getLayer(const LayerID & layerID){
|
||||||
return layers[layerID];
|
return layers[layerID];
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerComposition::draw() const {
|
void LayerComposition::draw(int width, int height) const {
|
||||||
for(const auto & layer_it : layers){
|
for(const auto & layer_it : layers){
|
||||||
if(layer_it.second->getType() == LayerType::MSDFGEN){
|
if(layer_it.second->getType() == LayerType::MSDFGEN){
|
||||||
layer_it.second->draw(glm::vec3(200, 200, 0));
|
layer_it.second->draw(glm::vec3(200, 200, 0));
|
||||||
|
@ -184,7 +184,7 @@ void LayerComposition::draw() const {
|
||||||
if(combo_it.first.type == LayerType::GPUFONT){
|
if(combo_it.first.type == LayerType::GPUFONT){
|
||||||
auto combo =
|
auto combo =
|
||||||
static_pointer_cast <GPUFontAtlasLayerCombo>(combo_it.second);
|
static_pointer_cast <GPUFontAtlasLayerCombo>(combo_it.second);
|
||||||
combo->draw();
|
combo->draw(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class LayerComposition {
|
||||||
public:
|
public:
|
||||||
void setup();
|
void setup();
|
||||||
void update();
|
void update();
|
||||||
void draw() const;
|
void draw(int width = 0, int height = 0) const;
|
||||||
LayerID addLayer(const Layer::Props & props,
|
LayerID addLayer(const Layer::Props & props,
|
||||||
LayerID layerID = "");
|
LayerID layerID = "");
|
||||||
LayerID addLayer(const ComboIdentifier & identifier,
|
LayerID addLayer(const ComboIdentifier & identifier,
|
||||||
|
|
Loading…
Reference in a new issue