mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-19 10:26:54 +01:00
Add wrong surface warnings to NavigationMesh.create_from_mesh()
Adds warnings when at least one of the input mesh surfaces is of wrong primitive type or has an empty vertex / index array as those broken input meshes would fail as both navmesh as well as later when creating debug meshes. (cherry picked from commit 4185fce0eff4c0fc40f077120d0ed26220e6c995)
This commit is contained in:
parent
9f1607fcd8
commit
ced2f890b6
@ -36,12 +36,14 @@ void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) {
|
|||||||
|
|
||||||
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
|
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
|
||||||
if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
|
if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES) {
|
||||||
|
WARN_PRINT("A mesh surface was skipped when creating a NavigationMesh due to wrong primitive type in the source mesh. Mesh surface must be made out of triangles.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Array arr = p_mesh->surface_get_arrays(i);
|
Array arr = p_mesh->surface_get_arrays(i);
|
||||||
PoolVector<Vector3> varr = arr[Mesh::ARRAY_VERTEX];
|
PoolVector<Vector3> varr = arr[Mesh::ARRAY_VERTEX];
|
||||||
PoolVector<int> iarr = arr[Mesh::ARRAY_INDEX];
|
PoolVector<int> iarr = arr[Mesh::ARRAY_INDEX];
|
||||||
if (varr.size() == 0 || iarr.size() == 0) {
|
if (varr.size() == 0 || iarr.size() == 0) {
|
||||||
|
WARN_PRINT("A mesh surface was skipped when creating a NavigationMesh due to an empty vertex or index array.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user