2023-04-06 11:17:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-04-16 17:20:54 +02:00
|
|
|
#include "AtlasLayerCombo.h"
|
2023-04-06 11:17:22 +02:00
|
|
|
#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:
|
2023-04-07 16:17:07 +02:00
|
|
|
void setup(const LayerSettings & settings = LayerSettings()) override;
|
2023-04-06 11:17:22 +02:00
|
|
|
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 16:17:07 +02:00
|
|
|
glm::vec4 color = glm::vec4(1, 1, 1, 1),
|
|
|
|
float rotation = 0,
|
2023-04-08 13:40:17 +02:00
|
|
|
float scale = 1,
|
2023-04-07 16:17:07 +02:00
|
|
|
ofxVariableLab::FontVariation fontVariation = ofxVariableLab::FontVariation()) override;
|
2023-04-06 11:17:22 +02:00
|
|
|
void setProps(const Props & props) override;
|
2023-04-18 18:05:33 +02:00
|
|
|
const Props & getProps(float delay = 0) const override;
|
2023-04-06 11:17:22 +02:00
|
|
|
void clearPropsBuffer() override;
|
2023-04-07 16:17:07 +02:00
|
|
|
void setId(const LayerID & id) override;
|
|
|
|
const LayerID & getId() override;
|
2023-04-06 11:17:22 +02:00
|
|
|
void setShader(shared_ptr <ofShader> _shader) override;
|
|
|
|
shared_ptr <ofShader> getShader() const override;
|
2023-04-16 17:20:54 +02:00
|
|
|
const LayerType & getType() const override;
|
2023-04-11 13:17:30 +02:00
|
|
|
void setVFlip(const VFlipState vFlip) override;
|
2023-04-14 16:55:15 +02:00
|
|
|
bool isDirtyDirty() const override;
|
|
|
|
void setDirtyDirty(bool dirtyDirty) override;
|
2023-04-16 17:20:54 +02:00
|
|
|
bool wantsNewMom() override;
|
|
|
|
void isWithNewMom() override;
|
|
|
|
const ComboIdentifier & getMomsComboIdentifier() const override;
|
|
|
|
void setMomsComboIdentifier(const ComboIdentifier & identifier) override;
|
2023-04-18 14:58:09 +02:00
|
|
|
ofNode & getOuterNode() override;
|
|
|
|
ofNode & getInnerNode() override;
|
2023-05-05 15:03:16 +02:00
|
|
|
const Layer::BoundingBox & getBoundingBox() override;
|
|
|
|
void setBoundingBox(const Layer::BoundingBox & boundingBox) override;
|
2023-04-06 11:17:22 +02:00
|
|
|
|
|
|
|
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;
|
2023-04-06 11:17:22 +02:00
|
|
|
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 = "";
|
2023-04-07 09:48:37 +02:00
|
|
|
VFlipState vFlip = V_FLIP_UNKNOWN;
|
2023-04-06 11:17:22 +02:00
|
|
|
|
|
|
|
private:
|
2023-04-22 11:59:21 +02:00
|
|
|
Props lastProps;
|
|
|
|
std::deque <Props> propsBuffer;
|
2023-04-16 17:20:54 +02:00
|
|
|
bool notHappyWithMom = false;
|
|
|
|
ComboIdentifier momsComboIdentifier;
|
|
|
|
LayerType type = MSDFGEN;
|
2023-04-18 14:58:09 +02:00
|
|
|
ofNode outerNode;
|
|
|
|
ofNode innerNode;
|
2023-05-05 15:03:16 +02:00
|
|
|
Layer::BoundingBox boundingBox;
|
2023-04-06 11:17:22 +02:00
|
|
|
};
|
|
|
|
}
|