From 6a61dc60f18cbba976d5b80844e8d49d4cb36bff Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sat, 17 Jun 2023 21:11:18 +0200 Subject: [PATCH] fix node --- src/MsdfLayer.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/MsdfLayer.cpp b/src/MsdfLayer.cpp index 54b09e6..7a67dc5 100644 --- a/src/MsdfLayer.cpp +++ b/src/MsdfLayer.cpp @@ -359,15 +359,15 @@ void MsdfLayer::collectCharacter(const char character, float pl = glm::mix(float(pl_a), float(pl_b), mix); float pt = glm::mix(float(pt_a), float(pt_b), mix); - float magic = atlas->settings.scale; - getVFlip(settings.vFlipBehaviour, - ofGetCurrentOrientationMatrix(), - vFlip); - if(vFlip == V_FLIP_OFF){ - n.move(pl * magic, (pt * magic) + (-1 * h), 0.0f); - }else{ - n.move(pl * magic, -1 * pt * magic, 0); - } + //float magic = atlas->settings.scale; + //getVFlip(settings.vFlipBehaviour, + //ofGetCurrentOrientationMatrix(), + //vFlip); + //if(vFlip == V_FLIP_OFF){ + //n.move(pl * magic, (pt * magic) + (-1 * h), 0.0f); + //}else{ + //n.move(pl * magic, -1 * pt * magic, 0); + //} glm::vec2 translation_a = glm::vec2(float(x_a) / float(atlas_w), float(y_a) / float(atlas_h)); @@ -379,22 +379,21 @@ void MsdfLayer::collectCharacter(const char character, float(h_b) / float(atlas_h)); glm::vec4 p0 = n.getGlobalTransformMatrix() * glm::vec4(0, 0, 0, 1); - glm::vec4 p1 = n.getGlobalTransformMatrix() * glm::vec4(w, 0, 0, 1); + glm::vec4 p1 = n.getGlobalTransformMatrix() * glm::vec4(0, h, 0, 1); glm::vec4 p2 = n.getGlobalTransformMatrix() * glm::vec4(w, h, 0, 1); - glm::vec4 p3 = n.getGlobalTransformMatrix() * glm::vec4(0, h, 0, 1); + glm::vec4 p3 = n.getGlobalTransformMatrix() * glm::vec4(w, 0, 0, 1); + if(isInside(camera, p0) || isInside(camera, p1) || isInside(camera, p2) || isInside(camera, p3)){ - glm::vec3 screenPosition = camera.worldToScreen(p0); - glm::vec3 cameraPosition = camera.worldToCamera(p0); glm::vec2 uv0_a = translation_a; glm::vec2 uv0_b = translation_b; glm::vec2 uv1_a = glm::vec2(0, scale_a.y) + translation_a; glm::vec2 uv1_b = glm::vec2(0, scale_b.y) + translation_b; glm::vec2 uv2_a = scale_a + translation_a; - glm::vec2 uv2_b = scale_a + translation_a; + glm::vec2 uv2_b = scale_b + translation_b; glm::vec2 uv3_a = glm::vec2(scale_a.x, 0) + translation_a; glm::vec2 uv3_b = glm::vec2(scale_b.x, 0) + translation_b; int32_t base = static_cast (vertices.size());