You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Fix EditorNode3DGizmo::add_solid_box() GPU stalling
Fixes EditorNode3DGizmo::add_solid_box() stalling the GPU because it used a function that queries the mesh arrays from the GPU.
This commit is contained in:
@@ -486,10 +486,10 @@ void EditorNode3DGizmo::add_handles(const Vector<Vector3> &p_handles, const Ref<
|
|||||||
void EditorNode3DGizmo::add_solid_box(const Ref<Material> &p_material, Vector3 p_size, Vector3 p_position, const Transform3D &p_xform) {
|
void EditorNode3DGizmo::add_solid_box(const Ref<Material> &p_material, Vector3 p_size, Vector3 p_position, const Transform3D &p_xform) {
|
||||||
ERR_FAIL_NULL(spatial_node);
|
ERR_FAIL_NULL(spatial_node);
|
||||||
|
|
||||||
BoxMesh box_mesh;
|
Array arrays;
|
||||||
box_mesh.set_size(p_size);
|
arrays.resize(RS::ARRAY_MAX);
|
||||||
|
BoxMesh::create_mesh_array(arrays, p_size);
|
||||||
|
|
||||||
Array arrays = box_mesh.surface_get_arrays(0);
|
|
||||||
PackedVector3Array vertex = arrays[RS::ARRAY_VERTEX];
|
PackedVector3Array vertex = arrays[RS::ARRAY_VERTEX];
|
||||||
Vector3 *w = vertex.ptrw();
|
Vector3 *w = vertex.ptrw();
|
||||||
|
|
||||||
@@ -499,8 +499,9 @@ void EditorNode3DGizmo::add_solid_box(const Ref<Material> &p_material, Vector3 p
|
|||||||
|
|
||||||
arrays[RS::ARRAY_VERTEX] = vertex;
|
arrays[RS::ARRAY_VERTEX] = vertex;
|
||||||
|
|
||||||
Ref<ArrayMesh> m = memnew(ArrayMesh);
|
Ref<ArrayMesh> m;
|
||||||
m->add_surface_from_arrays(box_mesh.surface_get_primitive_type(0), arrays);
|
m.instantiate();
|
||||||
|
m->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arrays);
|
||||||
add_mesh(m, p_material, p_xform);
|
add_mesh(m, p_material, p_xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user