[Label3D] Calculate AABB from the full text rect instead of individual glyphs.
This commit is contained in:
parent
f2045ba822
commit
e866ab4a72
|
@ -422,12 +422,6 @@ void Label3D::_generate_glyph_surfaces(const Glyph &p_glyph, Vector2 &r_offset,
|
|||
s.mesh_tangents.write[(s.offset * 16) + (i * 4) + 3] = 1.0;
|
||||
s.mesh_colors.write[(s.offset * 4) + i] = p_modulate;
|
||||
s.mesh_uvs.write[(s.offset * 4) + i] = Vector2();
|
||||
|
||||
if (aabb == AABB()) {
|
||||
aabb.position = s.mesh_vertices[(s.offset * 4) + i];
|
||||
} else {
|
||||
aabb.expand_to(s.mesh_vertices[(s.offset * 4) + i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (tex.is_valid()) {
|
||||
|
@ -598,6 +592,13 @@ void Label3D::_shape() {
|
|||
} break;
|
||||
}
|
||||
offset.x += lbl_offset.x * pixel_size;
|
||||
if (aabb == AABB()) {
|
||||
aabb.position = Vector3(offset.x, offset.y, 0);
|
||||
aabb.expand_to(Vector3(offset.x + line_width, offset.y - (TS->shaped_text_get_size(lines_rid[i]).y + line_spacing) * pixel_size, 0));
|
||||
} else {
|
||||
aabb.expand_to(Vector3(offset.x, offset.y, 0));
|
||||
aabb.expand_to(Vector3(offset.x + line_width, offset.y - (TS->shaped_text_get_size(lines_rid[i]).y + line_spacing) * pixel_size, 0));
|
||||
}
|
||||
offset.y -= TS->shaped_text_get_ascent(lines_rid[i]) * pixel_size;
|
||||
|
||||
if (outline_modulate.a != 0.0 && outline_size > 0) {
|
||||
|
|
Loading…
Reference in New Issue