summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlugFiller <5435495+SlugFiller@users.noreply.github.com>2023-03-05 08:21:08 +0200
committerYuri Sizov <yuris@humnom.net>2023-03-14 13:59:03 +0100
commit18bf2663f92e2dee528d23a18e336214c8581879 (patch)
treed1a841f7e59efba171b81732b080830121a2be44
parentd229ca2f27334856695e7e9230894b408284dfdd (diff)
Fix AABB calculation for meshes using Skeleton2D
(cherry picked from commit 06a1fe03644c57256b90b2840db1ef902187145a)
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp17
-rw-r--r--servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp17
2 files changed, 18 insertions, 16 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp
index 1adba019ba..44c9dc714c 100644
--- a/drivers/gles3/storage/mesh_storage.cpp
+++ b/drivers/gles3/storage/mesh_storage.cpp
@@ -327,6 +327,7 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
} else {
mesh->aabb.merge_with(p_surface.aabb);
}
+ mesh->skeleton_aabb_version = 0;
s->material = p_surface.material;
@@ -541,12 +542,12 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
Transform3D mtx;
- mtx.basis.rows[0].x = dataptr[0];
- mtx.basis.rows[1].x = dataptr[1];
+ mtx.basis.rows[0][0] = dataptr[0];
+ mtx.basis.rows[0][1] = dataptr[1];
mtx.origin.x = dataptr[3];
- mtx.basis.rows[0].y = dataptr[4];
- mtx.basis.rows[1].y = dataptr[5];
+ mtx.basis.rows[1][0] = dataptr[4];
+ mtx.basis.rows[1][1] = dataptr[5];
mtx.origin.y = dataptr[7];
AABB baabb = mtx.xform(skbones[j]);
@@ -1438,12 +1439,12 @@ void MeshStorage::_multimesh_re_create_aabb(MultiMesh *multimesh, const float *p
t.origin.z = data[11];
} else {
- t.basis.rows[0].x = data[0];
- t.basis.rows[1].x = data[1];
+ t.basis.rows[0][0] = data[0];
+ t.basis.rows[0][1] = data[1];
t.origin.x = data[3];
- t.basis.rows[0].y = data[4];
- t.basis.rows[1].y = data[5];
+ t.basis.rows[1][0] = data[4];
+ t.basis.rows[1][1] = data[5];
t.origin.y = data[7];
}
diff --git a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
index 96618c3352..b91e73c885 100644
--- a/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
@@ -438,6 +438,7 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
} else {
mesh->aabb.merge_with(p_surface.aabb);
}
+ mesh->skeleton_aabb_version = 0;
s->material = p_surface.material;
@@ -634,12 +635,12 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
Transform3D mtx;
- mtx.basis.rows[0].x = dataptr[0];
- mtx.basis.rows[1].x = dataptr[1];
+ mtx.basis.rows[0][0] = dataptr[0];
+ mtx.basis.rows[0][1] = dataptr[1];
mtx.origin.x = dataptr[3];
- mtx.basis.rows[0].y = dataptr[4];
- mtx.basis.rows[1].y = dataptr[5];
+ mtx.basis.rows[1][0] = dataptr[4];
+ mtx.basis.rows[1][1] = dataptr[5];
mtx.origin.y = dataptr[7];
AABB baabb = mtx.xform(skbones[j]);
@@ -1501,12 +1502,12 @@ void MeshStorage::_multimesh_re_create_aabb(MultiMesh *multimesh, const float *p
t.origin.z = data[11];
} else {
- t.basis.rows[0].x = data[0];
- t.basis.rows[1].x = data[1];
+ t.basis.rows[0][0] = data[0];
+ t.basis.rows[0][1] = data[1];
t.origin.x = data[3];
- t.basis.rows[0].y = data[4];
- t.basis.rows[1].y = data[5];
+ t.basis.rows[1][0] = data[4];
+ t.basis.rows[1][1] = data[5];
t.origin.y = data[7];
}