simple mirroring
This commit is contained in:
parent
7d4786d418
commit
53ba177225
2 changed files with 54 additions and 1 deletions
|
@ -249,6 +249,58 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
});
|
});
|
||||||
outerBoundingBoxes.push_back(mesh);
|
outerBoundingBoxes.push_back(mesh);
|
||||||
|
|
||||||
|
if(layer->getProps().mirror_x){
|
||||||
|
auto bbs_mirror_x = bbs;
|
||||||
|
ofNode mirrorOuterNode = layer->getOuterNode();
|
||||||
|
ofNode mirrorInnerNode = layer->getInnerNode();
|
||||||
|
mirrorInnerNode.setParent(mirrorOuterNode);
|
||||||
|
mirrorOuterNode.setOrientation(glm::quat(1, 0, 0, 0));
|
||||||
|
mirrorOuterNode.rotateDeg(layer->getProps().rotation * -1, glm::vec3(0, 0, 1));
|
||||||
|
mirrorOuterNode.setPosition(transformOrigin);
|
||||||
|
mirrorOuterNode.move(layer->getProps().mirror_x_distance * -1, 0, 0);
|
||||||
|
mirrorOuterNode.setScale(-1, 1, 1);
|
||||||
|
font->collectVerticesAndIndices(mirrorInnerNode,
|
||||||
|
bbs_mirror_x,
|
||||||
|
vertices,
|
||||||
|
indices,
|
||||||
|
layer->getColor(),
|
||||||
|
layer->getProps().fontSize_px);
|
||||||
|
}
|
||||||
|
if(layer->getProps().mirror_y){
|
||||||
|
auto bbs_mirror_y = bbs;
|
||||||
|
ofNode mirrorOuterNode = layer->getOuterNode();
|
||||||
|
ofNode mirrorInnerNode = layer->getInnerNode();
|
||||||
|
mirrorInnerNode.setParent(mirrorOuterNode);
|
||||||
|
mirrorOuterNode.setOrientation(glm::quat(1, 0, 0, 0));
|
||||||
|
mirrorOuterNode.rotateDeg(layer->getProps().rotation * -1, glm::vec3(0, 0, 1));
|
||||||
|
mirrorOuterNode.setPosition(transformOrigin);
|
||||||
|
mirrorOuterNode.move(0, layer->getProps().mirror_y_distance * -1, 0);
|
||||||
|
mirrorOuterNode.setScale(1, -1, 1);
|
||||||
|
font->collectVerticesAndIndices(mirrorInnerNode,
|
||||||
|
bbs_mirror_y,
|
||||||
|
vertices,
|
||||||
|
indices,
|
||||||
|
layer->getColor(),
|
||||||
|
layer->getProps().fontSize_px);
|
||||||
|
}
|
||||||
|
if(layer->getProps().mirror_xy){
|
||||||
|
auto bbs_mirror_xy = bbs;
|
||||||
|
ofNode mirrorOuterNode = layer->getOuterNode();
|
||||||
|
ofNode mirrorInnerNode = layer->getInnerNode();
|
||||||
|
mirrorInnerNode.setParent(mirrorOuterNode);
|
||||||
|
mirrorOuterNode.setOrientation(glm::quat(1, 0, 0, 0));
|
||||||
|
mirrorOuterNode.rotateDeg(layer->getProps().rotation * 1, glm::vec3(0, 0, 1));
|
||||||
|
mirrorOuterNode.setPosition(transformOrigin);
|
||||||
|
mirrorOuterNode.move(layer->getProps().mirror_x_distance * -1,
|
||||||
|
layer->getProps().mirror_y_distance * -1, 0);
|
||||||
|
mirrorOuterNode.setScale(-1, -1, 1);
|
||||||
|
font->collectVerticesAndIndices(mirrorInnerNode,
|
||||||
|
bbs_mirror_xy,
|
||||||
|
vertices,
|
||||||
|
indices,
|
||||||
|
layer->getColor(),
|
||||||
|
layer->getProps().fontSize_px);
|
||||||
|
}
|
||||||
font->collectVerticesAndIndices(layer->getInnerNode(),
|
font->collectVerticesAndIndices(layer->getInnerNode(),
|
||||||
bbs,
|
bbs,
|
||||||
vertices,
|
vertices,
|
||||||
|
@ -267,7 +319,7 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(const auto & v : b.getVertices()){
|
for(const auto & v : b.getVertices()){
|
||||||
ofSetColor(b.getColors()[i]);
|
ofSetColor(b.getColors()[i]);
|
||||||
ofDrawCircle(v, 4);
|
ofDrawCircle(v, 2);
|
||||||
ofDrawBitmapString(ofToString(i), 0, 0);
|
ofDrawBitmapString(ofToString(i), 0, 0);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Layer {
|
||||||
float mirror_x_distance = 0;
|
float mirror_x_distance = 0;
|
||||||
bool mirror_y = false;
|
bool mirror_y = false;
|
||||||
float mirror_y_distance = 0;
|
float mirror_y_distance = 0;
|
||||||
|
bool mirror_xy = false;
|
||||||
float letterDelay = 0;
|
float letterDelay = 0;
|
||||||
int transformOrigin = TransformOrigin::TOP_LEFT;
|
int transformOrigin = TransformOrigin::TOP_LEFT;
|
||||||
std::vector <ofxVariableLab::FontVariation> fontVariations;
|
std::vector <ofxVariableLab::FontVariation> fontVariations;
|
||||||
|
|
Loading…
Reference in a new issue