2023-04-06 11:17:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ofMain.h"
|
|
|
|
#include "ofxMsdfgen.h"
|
|
|
|
#include "Atlas.h"
|
|
|
|
#include "Layer.h"
|
2023-04-07 09:48:37 +02:00
|
|
|
#include "Utils.h"
|
2023-04-06 11:17:22 +02:00
|
|
|
|
|
|
|
namespace ofxVariableLab {
|
|
|
|
|
|
|
|
class MsdfLayer : public Layer {
|
|
|
|
public:
|
|
|
|
void setup(const Settings & settings);
|
|
|
|
void update() override;
|
2023-04-07 09:48:37 +02:00
|
|
|
void draw(glm::vec3 position = glm::vec3(0, 0, 0)) override;
|
2023-04-06 11:17:22 +02:00
|
|
|
void drawCharacter(const char character,
|
|
|
|
glm::vec3 position = glm::vec3(0, 0, 0),
|
2023-04-07 09:48:37 +02:00
|
|
|
ofxMsdfgen::FontVariation fontVariation = ofxMsdfgen::FontVariation()) override;
|
2023-04-06 11:17:22 +02:00
|
|
|
void setProps(const Props & props) override;
|
|
|
|
const Props & getProps() const override;
|
|
|
|
void clearPropsBuffer() override;
|
|
|
|
void setId(const string & id) override;
|
|
|
|
const string & getId() override;
|
|
|
|
void setShader(shared_ptr <ofShader> _shader) override;
|
|
|
|
shared_ptr <ofShader> getShader() const override;
|
|
|
|
const Type & getType() const override;
|
|
|
|
|
|
|
|
void setAtlas(shared_ptr <ofxMsdfgen::Atlas> _atlas);
|
|
|
|
shared_ptr <ofxMsdfgen::Atlas> getAtlas() const;
|
|
|
|
|
|
|
|
shared_ptr <ofxMsdfgen::Atlas> atlas;
|
|
|
|
|
|
|
|
Settings settings;
|
|
|
|
std::deque <Props> propsBuffer;
|
|
|
|
shared_ptr <ofShader> shader;
|
|
|
|
/// \brief are props updated but not drawn yet
|
|
|
|
bool isDirty = true;
|
|
|
|
/// \brief hashed id
|
|
|
|
string id;
|
2023-04-07 09:48:37 +02:00
|
|
|
VFlipState vFlip = V_FLIP_UNKNOWN;
|
2023-04-06 11:17:22 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Layer::Type type = MSDFGEN;
|
|
|
|
};
|
|
|
|
}
|