From 588ffbc08aaf7d1fa30163f46702d56e032de04a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 19 Aug 2017 14:54:04 -0300 Subject: [PATCH] Fixed wrong usage of has_no_area function, closes #10434 --- servers/visual/visual_server_scene.cpp | 2 +- servers/visual_server.cpp | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 8e21ecc189b..ab32567d4fd 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -1048,7 +1048,7 @@ void VisualServerScene::_update_instance(Instance *p_instance) { VSG::storage->particles_set_emission_transform(p_instance->base, p_instance->transform); } - if (p_instance->aabb.has_no_area()) { + if (p_instance->aabb.has_no_surface()) { return; } diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index dacf04f8d6d..cb1f96c23fc 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -298,6 +298,9 @@ RID VisualServer::get_white_texture() { return white_texture; } +#define SMALL_VEC2 Vector2(0.00001, 0.00001) +#define SMALL_VEC3 Vector3(0.00001, 0.00001, 0.00001) + Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector &r_vertex_array, int p_vertex_array_len, PoolVector &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector r_bone_aabb) { PoolVector::Write vw = r_vertex_array.write(); @@ -339,7 +342,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (i == 0) { - aabb = Rect2(src[i], Vector2(0.00001, 0.00001)); //must have a bit of size + aabb = Rect2(src[i], SMALL_VEC2); //must have a bit of size } else { aabb.expand_to(src[i]); @@ -355,7 +358,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (i == 0) { - aabb = Rect2(src[i], Vector2(0.00001, 0.00001)); //must have a bit of size + aabb = Rect2(src[i], SMALL_VEC2); //must have a bit of size } else { aabb.expand_to(src[i]); @@ -385,7 +388,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (i == 0) { - aabb = Rect3(src[i], Vector3(0.00001, 0.00001, 0.00001)); + aabb = Rect3(src[i], SMALL_VEC3); } else { aabb.expand_to(src[i]); @@ -401,7 +404,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (i == 0) { - aabb = Rect3(src[i], Vector3(0.00001, 0.00001, 0.00001)); + aabb = Rect3(src[i], SMALL_VEC3); } else { aabb.expand_to(src[i]); @@ -733,9 +736,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (bptr->size.x < 0) { //first - bptr[idx] = Rect3(); - bptr[idx].position = v; - bptr[idx].size = Vector3(0.00001, 0.00001, 0.00001); //must have at least a bit of size + bptr[idx] = Rect3(v, SMALL_VEC3); any_valid = true; } else { bptr[idx].expand_to(v);