This commit is contained in:
jrkb 2023-06-17 21:11:18 +02:00
parent cde337580d
commit 6a61dc60f1

View file

@ -359,15 +359,15 @@ void MsdfLayer::collectCharacter(const char character,
float pl = glm::mix(float(pl_a), float(pl_b), mix); float pl = glm::mix(float(pl_a), float(pl_b), mix);
float pt = glm::mix(float(pt_a), float(pt_b), mix); float pt = glm::mix(float(pt_a), float(pt_b), mix);
float magic = atlas->settings.scale; //float magic = atlas->settings.scale;
getVFlip(settings.vFlipBehaviour, //getVFlip(settings.vFlipBehaviour,
ofGetCurrentOrientationMatrix(), //ofGetCurrentOrientationMatrix(),
vFlip); //vFlip);
if(vFlip == V_FLIP_OFF){ //if(vFlip == V_FLIP_OFF){
n.move(pl * magic, (pt * magic) + (-1 * h), 0.0f); //n.move(pl * magic, (pt * magic) + (-1 * h), 0.0f);
}else{ //}else{
n.move(pl * magic, -1 * pt * magic, 0); //n.move(pl * magic, -1 * pt * magic, 0);
} //}
glm::vec2 translation_a = glm::vec2(float(x_a) / float(atlas_w), glm::vec2 translation_a = glm::vec2(float(x_a) / float(atlas_w),
float(y_a) / float(atlas_h)); float(y_a) / float(atlas_h));
@ -379,22 +379,21 @@ void MsdfLayer::collectCharacter(const char character,
float(h_b) / float(atlas_h)); float(h_b) / float(atlas_h));
glm::vec4 p0 = n.getGlobalTransformMatrix() * glm::vec4(0, 0, 0, 1); 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 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) if(isInside(camera, p0)
|| isInside(camera, p1) || isInside(camera, p1)
|| isInside(camera, p2) || isInside(camera, p2)
|| isInside(camera, p3)){ || isInside(camera, p3)){
glm::vec3 screenPosition = camera.worldToScreen(p0);
glm::vec3 cameraPosition = camera.worldToCamera(p0);
glm::vec2 uv0_a = translation_a; glm::vec2 uv0_a = translation_a;
glm::vec2 uv0_b = translation_b; glm::vec2 uv0_b = translation_b;
glm::vec2 uv1_a = glm::vec2(0, scale_a.y) + translation_a; 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 uv1_b = glm::vec2(0, scale_b.y) + translation_b;
glm::vec2 uv2_a = scale_a + translation_a; 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_a = glm::vec2(scale_a.x, 0) + translation_a;
glm::vec2 uv3_b = glm::vec2(scale_b.x, 0) + translation_b; glm::vec2 uv3_b = glm::vec2(scale_b.x, 0) + translation_b;
int32_t base = static_cast <int32_t>(vertices.size()); int32_t base = static_cast <int32_t>(vertices.size());