66 lines
2.5 KiB
C++
66 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "AtlasLayerCombo.h"
|
|
#include "ofMain.h"
|
|
#include "ofxMsdfgen.h"
|
|
#include "Atlas.h"
|
|
#include "Layer.h"
|
|
#include "Utils.h"
|
|
|
|
namespace ofxVariableLab {
|
|
|
|
class MsdfLayer : public Layer {
|
|
public:
|
|
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),
|
|
glm::vec4 color = glm::vec4(1, 1, 1, 1),
|
|
float rotation = 0,
|
|
float scale = 1,
|
|
ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) override;
|
|
void setProps(const Props & props) override;
|
|
const Props & getProps(float delay = 0) const override;
|
|
void clearPropsBuffer() override;
|
|
void setId(const LayerID & id) override;
|
|
const LayerID & getId() override;
|
|
void setShader(shared_ptr <ofShader> _shader) override;
|
|
shared_ptr <ofShader> getShader() const override;
|
|
const LayerType & getType() const override;
|
|
void setVFlip(const VFlipState vFlip) override;
|
|
bool isDirtyDirty() const override;
|
|
void setDirtyDirty(bool dirtyDirty) override;
|
|
bool wantsNewMom() override;
|
|
void isWithNewMom() override;
|
|
const ComboIdentifier & getMomsComboIdentifier() const override;
|
|
void setMomsComboIdentifier(const ComboIdentifier & identifier) override;
|
|
ofNode & getOuterNode() override;
|
|
ofNode & getInnerNode() override;
|
|
const Layer::BoundingBox & getBoundingBox() override;
|
|
void setBoundingBox(const Layer::BoundingBox & boundingBox) override;
|
|
|
|
void setAtlas(shared_ptr <ofxMsdfgen::Atlas> _atlas);
|
|
shared_ptr <ofxMsdfgen::Atlas> getAtlas() const;
|
|
|
|
shared_ptr <ofxMsdfgen::Atlas> atlas;
|
|
|
|
LayerSettings settings;
|
|
shared_ptr <ofShader> shader;
|
|
/// \brief are props updated but not drawn yet
|
|
bool isDirty = true;
|
|
/// \brief hashed id, or just counting up
|
|
string id = "";
|
|
VFlipState vFlip = V_FLIP_UNKNOWN;
|
|
|
|
private:
|
|
Props lastProps;
|
|
std::deque <Props> propsBuffer;
|
|
bool notHappyWithMom = false;
|
|
ComboIdentifier momsComboIdentifier;
|
|
LayerType type = MSDFGEN;
|
|
ofNode outerNode;
|
|
ofNode innerNode;
|
|
Layer::BoundingBox boundingBox;
|
|
};
|
|
}
|