2023-03-25 18:59:58 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ofMain.h"
|
2023-04-12 10:58:53 +02:00
|
|
|
#include "AtlasLayerCombo.h"
|
|
|
|
#include "MsdfAtlasLayerCombo.h"
|
2023-04-06 11:17:22 +02:00
|
|
|
#include "MsdfLayer.h"
|
2023-04-12 10:58:53 +02:00
|
|
|
#include "GPUFontAtlasLayerCombo.h"
|
2023-04-12 09:28:47 +02:00
|
|
|
#include "GPUFontLayer.h"
|
2023-04-13 17:15:35 +02:00
|
|
|
#include "Utils.h"
|
2023-03-25 18:59:58 +01:00
|
|
|
|
|
|
|
namespace ofxVariableLab {
|
|
|
|
|
|
|
|
class LayerComposition {
|
|
|
|
public:
|
|
|
|
void setup();
|
|
|
|
void update();
|
|
|
|
void draw() const;
|
2023-04-14 16:55:15 +02:00
|
|
|
LayerID addLayer(const Layer::Props & props,
|
|
|
|
LayerID layerID = "");
|
2023-04-07 16:17:07 +02:00
|
|
|
LayerID addLayer(const ComboIdentifier & identifier,
|
|
|
|
const string & text,
|
2023-04-14 16:55:15 +02:00
|
|
|
const std::vector <FontVariation> & variations,
|
|
|
|
LayerID layerID = "");
|
2023-04-11 12:23:14 +02:00
|
|
|
LayerID addLayer(const ComboIdentifier & identifier,
|
|
|
|
const Layer::Props & props,
|
2023-04-14 16:55:15 +02:00
|
|
|
const std::vector <FontVariation> & variations,
|
|
|
|
LayerID layerID = "");
|
2023-04-16 17:20:54 +02:00
|
|
|
void findOrCreateNewMomForLayer(shared_ptr <Layer> layer,
|
|
|
|
ComboIdentifier idealMom);
|
2023-04-13 17:15:35 +02:00
|
|
|
void removeLayer(const LayerID & id); // TODO: make bool, to catch nonexisting
|
|
|
|
shared_ptr <Layer> getLayer(const LayerID & layerID);
|
2023-04-11 12:23:14 +02:00
|
|
|
const unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > & getAtlasLayerCombos() const;
|
2023-04-11 13:17:30 +02:00
|
|
|
void setVFlip(bool vFlip);
|
2023-03-25 18:59:58 +01:00
|
|
|
|
|
|
|
private:
|
2023-04-11 13:17:30 +02:00
|
|
|
VFlipState vFlipState = V_FLIP_UNKNOWN;
|
2023-04-13 17:15:35 +02:00
|
|
|
unordered_map <LayerID, shared_ptr <Layer> > layers;
|
2023-04-06 11:17:22 +02:00
|
|
|
unordered_map <ComboIdentifier, shared_ptr <AtlasLayerCombo> > atlasLayerCombos;
|
2023-04-13 17:15:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief lastGpuTextureOffset GL_TEXTURE0 + offset
|
|
|
|
* we want to different textures for different fonts
|
|
|
|
* this value is incremented/decremented when adding/removing GPUFont layers
|
|
|
|
*/
|
|
|
|
int nextGpuTextureOffset = 0;
|
2023-04-06 11:17:22 +02:00
|
|
|
//unordered_map <LayerIdentifier, shared_ptr <ofxVariableLab::Layer> > layers;
|
2023-03-25 18:59:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|