mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
text: Fix glyphs with flipped UVs not being processed correctly
This caused the cheesy-accent code to not flip the caron correctly.
This commit is contained in:
parent
064e0383be
commit
9be2f307c5
@ -171,66 +171,63 @@ check_quad_geom() {
|
||||
|
||||
// Check that the vertices are arranged in a square.
|
||||
GeomVertexReader vertex(vdata, InternalName::get_vertex());
|
||||
GeomVertexReader texcoord(vdata, InternalName::get_texcoord());
|
||||
LVecBase3 v = vertex.get_data3();
|
||||
if (!IS_NEARLY_ZERO(v[1])) {
|
||||
return;
|
||||
}
|
||||
LTexCoord uv(0);
|
||||
if (texcoord.has_column()) {
|
||||
uv = texcoord.get_data2();
|
||||
}
|
||||
PN_stdfloat minx = v[0];
|
||||
PN_stdfloat maxx = v[0];
|
||||
PN_stdfloat miny = v[2];
|
||||
PN_stdfloat maxy = v[2];
|
||||
PN_stdfloat minu = uv[0];
|
||||
PN_stdfloat maxu = uv[0];
|
||||
PN_stdfloat minv = uv[1];
|
||||
PN_stdfloat maxv = uv[1];
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 1; i < 4; ++i) {
|
||||
v = vertex.get_data3();
|
||||
if (!IS_NEARLY_ZERO(v[1])) {
|
||||
return;
|
||||
}
|
||||
if (texcoord.has_column()) {
|
||||
uv = texcoord.get_data2();
|
||||
}
|
||||
if (!IS_NEARLY_EQUAL(v[0], minx) && !IS_NEARLY_EQUAL(v[0], maxx)) {
|
||||
if (!IS_NEARLY_EQUAL(minx, maxx)) {
|
||||
return;
|
||||
}
|
||||
minx = min(v[0], minx);
|
||||
maxx = max(v[0], maxx);
|
||||
if (v[0] < minx) {
|
||||
minx = v[0];
|
||||
minu = uv[0];
|
||||
}
|
||||
if (v[0] > maxx) {
|
||||
maxx = v[0];
|
||||
maxu = uv[0];
|
||||
}
|
||||
}
|
||||
if (!IS_NEARLY_EQUAL(v[2], miny) && !IS_NEARLY_EQUAL(v[2], maxy)) {
|
||||
if (!IS_NEARLY_EQUAL(miny, maxy)) {
|
||||
return;
|
||||
}
|
||||
miny = min(v[2], miny);
|
||||
maxy = max(v[2], maxy);
|
||||
if (v[2] < miny) {
|
||||
miny = v[2];
|
||||
minv = uv[1];
|
||||
}
|
||||
if (v[2] > maxy) {
|
||||
maxy = v[2];
|
||||
maxv = uv[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PN_stdfloat minu = 0;
|
||||
PN_stdfloat maxu = 0;
|
||||
PN_stdfloat minv = 0;
|
||||
PN_stdfloat maxv = 0;
|
||||
|
||||
// Same for the texcoord data.
|
||||
if (format->has_column(InternalName::get_texcoord())) {
|
||||
GeomVertexReader texcoord(vdata, InternalName::get_texcoord());
|
||||
LVecBase2 tc = texcoord.get_data2();
|
||||
minu = tc[0];
|
||||
maxu = tc[0];
|
||||
minv = tc[1];
|
||||
maxv = tc[1];
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
tc = texcoord.get_data2();
|
||||
if (!IS_NEARLY_EQUAL(tc[0], minu) && !IS_NEARLY_EQUAL(tc[0], maxu)) {
|
||||
if (!IS_NEARLY_EQUAL(minu, maxu)) {
|
||||
return;
|
||||
}
|
||||
minu = min(tc[0], minu);
|
||||
maxu = max(tc[0], maxu);
|
||||
}
|
||||
if (!IS_NEARLY_EQUAL(tc[1], minv) && !IS_NEARLY_EQUAL(tc[1], maxv)) {
|
||||
if (!IS_NEARLY_EQUAL(minv, maxv)) {
|
||||
return;
|
||||
}
|
||||
minv = min(tc[1], minv);
|
||||
maxv = max(tc[1], maxv);
|
||||
}
|
||||
if (!IS_NEARLY_EQUAL(uv[0], minu) && !IS_NEARLY_EQUAL(uv[0], maxu)) {
|
||||
return;
|
||||
}
|
||||
if (!IS_NEARLY_EQUAL(uv[1], minv) && !IS_NEARLY_EQUAL(uv[1], maxv)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user