Add custom debug shape thickness and color options to RayCast

This backports the improved RayCast debug drawing functionality
from the `master` branch.

`ArrayMesh.clear_surfaces()` was also backported from the `master`
branch and exposed because the new debug drawing code requires it.
This commit is contained in:
Hugo Locurcio 2021-06-19 06:01:25 +02:00
parent 2827d6be19
commit a6a6ad5c08
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
8 changed files with 236 additions and 40 deletions

View file

@ -1040,6 +1040,15 @@ AABB ArrayMesh::get_aabb() const {
return aabb;
}
void ArrayMesh::clear_surfaces() {
if (!mesh.is_valid()) {
return;
}
VS::get_singleton()->mesh_clear(mesh);
surfaces.clear();
aabb = AABB();
}
void ArrayMesh::set_custom_aabb(const AABB &p_custom) {
custom_aabb = p_custom;
VS::get_singleton()->mesh_set_custom_aabb(mesh, custom_aabb);
@ -1408,6 +1417,7 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_blend_shape_mode"), &ArrayMesh::get_blend_shape_mode);
ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "compress_flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(ARRAY_COMPRESS_DEFAULT));
ClassDB::bind_method(D_METHOD("clear_surfaces"), &ArrayMesh::clear_surfaces);
ClassDB::bind_method(D_METHOD("surface_remove", "surf_idx"), &ArrayMesh::surface_remove);
ClassDB::bind_method(D_METHOD("surface_update_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_region);
ClassDB::bind_method(D_METHOD("surface_get_array_len", "surf_idx"), &ArrayMesh::surface_get_array_len);