summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp9
-rw-r--r--scene/resources/mesh.cpp1
-rw-r--r--servers/visual_server.cpp2
-rw-r--r--servers/visual_server.h2
4 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 64e04eec71..65543956fa 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -3787,12 +3787,14 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
Mesh *mesh = mesh_owner.get(p_mesh);
ERR_FAIL_COND_V(!mesh, AABB());
- if (mesh->custom_aabb != AABB())
+ if (mesh->custom_aabb != AABB()) {
return mesh->custom_aabb;
+ }
Skeleton *sk = NULL;
- if (p_skeleton.is_valid())
+ if (p_skeleton.is_valid()) {
sk = skeleton_owner.get(p_skeleton);
+ }
AABB aabb;
@@ -3831,6 +3833,7 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
mtx.origin.y = texture[base_ofs + 3];
AABB baabb = mtx.xform(skbones[j]);
+
if (first) {
laabb = baabb;
first = false;
@@ -3863,6 +3866,8 @@ AABB RasterizerStorageGLES3::mesh_get_aabb(RID p_mesh, RID p_skeleton) const {
mtx.basis[2].z = texture[base_ofs + 2];
mtx.origin.z = texture[base_ofs + 3];
+ print_line("surface " + itos(i) + " bone " + itos(j) + " aabb: " + skbones[j]);
+
AABB baabb = mtx.xform(skbones[j]);
if (first) {
laabb = baabb;
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 838d73edb3..80191367ce 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -706,6 +706,7 @@ bool ArrayMesh::_get(const StringName &p_name, Variant &r_ret) const {
Vector<AABB> skel_aabb = VS::get_singleton()->mesh_surface_get_skeleton_aabb(mesh, idx);
Array arr;
+ arr.resize(skel_aabb.size());
for (int i = 0; i < skel_aabb.size(); i++) {
arr[i] = skel_aabb[i];
}
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index ca5271190c..e1db123f58 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -343,7 +343,7 @@ RID VisualServer::get_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<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb) {
+Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb) {
PoolVector<uint8_t>::Write vw = r_vertex_array.write();
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 59eb43da97..743e010034 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -61,7 +61,7 @@ protected:
RID white_texture;
RID test_material;
- Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> r_bone_aabb);
+ Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, AABB &r_aabb, Vector<AABB> &r_bone_aabb);
static VisualServer *(*create_func)();
static void _bind_methods();