ofxVariableLab/src/MsdfLayer.h

49 lines
1.7 KiB
C
Raw Normal View History

#pragma once
#include "ofMain.h"
#include "ofxMsdfgen.h"
#include "Atlas.h"
#include "Layer.h"
#include "Utils.h"
namespace ofxVariableLab {
class MsdfLayer : public Layer {
public:
2023-04-07 16:17:07 +02:00
void setup(const LayerSettings & settings = LayerSettings()) override;
void update() override;
void draw(glm::vec3 position = glm::vec3(0, 0, 0)) override;
void drawCharacter(const char character,
glm::vec3 position = glm::vec3(0, 0, 0),
2023-04-07 16:17:07 +02:00
glm::vec4 color = glm::vec4(1, 1, 1, 1),
float rotation = 0,
float scale = 1,
2023-04-07 16:17:07 +02:00
ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) override;
void setProps(const Props & props) override;
const Props & getProps() const override;
void clearPropsBuffer() override;
2023-04-07 16:17:07 +02:00
void setId(const LayerID & id) override;
const LayerID & 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;
2023-04-07 16:17:07 +02:00
LayerSettings settings;
std::deque <Props> propsBuffer;
shared_ptr <ofShader> shader;
/// \brief are props updated but not drawn yet
bool isDirty = true;
2023-04-07 16:17:07 +02:00
/// \brief hashed id, or just counting up
string id = "";
VFlipState vFlip = V_FLIP_UNKNOWN;
private:
Layer::Type type = MSDFGEN;
};
}