diff options
author | Silc 'Tokage' Renew <tokage.it.lab@gmail.com> | 2021-11-28 09:12:10 +0900 |
---|---|---|
committer | Silc 'Tokage' Renew <tokage.it.lab@gmail.com> | 2021-12-02 08:33:33 +0900 |
commit | ca2b7a87a5af6c6086266c2db048a8c50d445b54 (patch) | |
tree | 1341e9f91c538c91e676999787ddfd34327a227e /scene/resources | |
parent | 52b7d5fa347fb88aa016e1e30414abd01e800381 (diff) |
Fixed minimum size of aabb in ImmediateMesh to draw only one vertex
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/immediate_mesh.cpp | 3 | ||||
-rw-r--r-- | scene/resources/immediate_mesh.h | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/scene/resources/immediate_mesh.cpp b/scene/resources/immediate_mesh.cpp index fe7124de9e..4f9a055bfb 100644 --- a/scene/resources/immediate_mesh.cpp +++ b/scene/resources/immediate_mesh.cpp @@ -144,6 +144,7 @@ void ImmediateMesh::surface_add_vertex_2d(const Vector2 &p_vertex) { active_surface_data.vertex_2d = true; } + void ImmediateMesh::surface_end() { ERR_FAIL_COND_MSG(!surface_active, "Not creating any surface. Use surface_begin() to do it."); ERR_FAIL_COND_MSG(!vertices.size(), "No vertices were added, surface can't be created."); @@ -185,7 +186,7 @@ void ImmediateMesh::surface_end() { vtx[2] = vertices[i].z; } if (i == 0) { - aabb.position = vertices[i]; + aabb = AABB(vertices[i], SMALL_VEC3); // Must have a bit of size. } else { aabb.expand_to(vertices[i]); } diff --git a/scene/resources/immediate_mesh.h b/scene/resources/immediate_mesh.h index 6673ee6f3d..92bf91441d 100644 --- a/scene/resources/immediate_mesh.h +++ b/scene/resources/immediate_mesh.h @@ -75,6 +75,8 @@ class ImmediateMesh : public Mesh { Vector<uint8_t> surface_vertex_create_cache; Vector<uint8_t> surface_attribute_create_cache; + const Vector3 SMALL_VEC3 = Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON); + protected: static void _bind_methods(); |