1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Fix performance regression when rendering collision shapes

This commit is contained in:
Mikael Hermansson
2025-07-11 19:41:17 +02:00
parent c6d130abd9
commit 8634a8e234
4 changed files with 31 additions and 51 deletions

View File

@@ -805,12 +805,20 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
#ifndef PHYSICS_3D_DISABLED
if (col_debug.size()) {
SceneTree *st = SceneTree::get_singleton();
Vector<Color> colors;
colors.resize(col_debug.size());
if (st) {
colors.fill(st->get_debug_collisions_color());
}
Array arr;
arr.resize(RS::ARRAY_MAX);
arr[RS::ARRAY_VERTEX] = col_debug;
arr[RS::ARRAY_COLOR] = colors;
RS::get_singleton()->mesh_add_surface_from_arrays(g.collision_debug, RS::PRIMITIVE_LINES, arr);
SceneTree *st = SceneTree::get_singleton();
if (st) {
RS::get_singleton()->mesh_surface_set_material(g.collision_debug, 0, st->get_debug_collision_material()->get_rid());
}