1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

Merge pull request #101350 from Calinou/path-draw-fewer-fish-bones

Draw fewer fishbones to improve Path gizmo readability and performance
This commit is contained in:
Rémi Verschelde
2025-01-09 20:51:37 +01:00
3 changed files with 25 additions and 18 deletions

View File

@@ -340,7 +340,9 @@ void Path3DGizmo::redraw() {
// Path3D as a ribbon.
ribbon_ptr[i] = p1;
// Fish Bone.
if (i % 4 == 0) {
// Draw fish bone every 4 points to reduce visual noise and performance impact
// (compared to drawing it for every point).
const Vector3 p_left = p1 + (side + forward - up * 0.3) * 0.06;
const Vector3 p_right = p1 + (-side + forward - up * 0.3) * 0.06;
@@ -351,6 +353,7 @@ void Path3DGizmo::redraw() {
bones_ptr[bone_idx + 2] = p1;
bones_ptr[bone_idx + 3] = p_right;
}
}
add_collision_segments(_collision_segments);
add_lines(bones, path_material);

View File

@@ -138,13 +138,14 @@ void Path2D::_notification(int p_what) {
draw_polyline(v2p, get_tree()->get_debug_paths_color(), line_width, false);
}
// Draw fish bones
// Draw fish bone every 4 points to reduce visual noise and performance impact
// (compared to drawing it for every point).
{
PackedVector2Array v2p;
v2p.resize(3);
Vector2 *w = v2p.ptrw();
for (int i = 0; i < sample_count; i++) {
for (int i = 0; i < sample_count; i += 4) {
const Vector2 p = r[i].get_origin();
const Vector2 side = r[i].columns[1];
const Vector2 forward = r[i].columns[0];

View File

@@ -131,7 +131,9 @@ void Path3D::_update_debug_mesh() {
// Path3D as a ribbon.
ribbon_ptr[i] = p1;
// Fish Bone.
if (i % 4 == 0) {
// Draw fish bone every 4 points to reduce visual noise and performance impact
// (compared to drawing it for every point).
const Vector3 p_left = p1 + (side + forward - up * 0.3) * 0.06;
const Vector3 p_right = p1 + (-side + forward - up * 0.3) * 0.06;
@@ -142,6 +144,7 @@ void Path3D::_update_debug_mesh() {
bones_ptr[bone_idx + 2] = p1;
bones_ptr[bone_idx + 3] = p_right;
}
}
Array ribbon_array;
ribbon_array.resize(Mesh::ARRAY_MAX);