mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Check skeleton RID when using cached AABB
This commit is contained in:
parent
2d0ee20ff3
commit
d874ead58d
@ -657,7 +657,8 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
||||
|
||||
Skeleton *skeleton = skeleton_owner.get_or_null(p_skeleton);
|
||||
|
||||
if (!skeleton || skeleton->size == 0 || mesh->skeleton_aabb_version == skeleton->version) {
|
||||
// A mesh can be shared by multiple skeletons and we need to avoid using the AABB from a different skeleton.
|
||||
if (!skeleton || skeleton->size == 0 || (mesh->skeleton_aabb_version == skeleton->version && mesh->skeleton_aabb_rid == p_skeleton)) {
|
||||
return mesh->aabb;
|
||||
}
|
||||
|
||||
@ -763,6 +764,7 @@ AABB MeshStorage::mesh_get_aabb(RID p_mesh, RID p_skeleton) {
|
||||
mesh->aabb = aabb;
|
||||
|
||||
mesh->skeleton_aabb_version = skeleton->version;
|
||||
mesh->skeleton_aabb_rid = p_skeleton;
|
||||
return aabb;
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,7 @@ private:
|
||||
AABB aabb;
|
||||
AABB custom_aabb;
|
||||
uint64_t skeleton_aabb_version = 0;
|
||||
RID skeleton_aabb_rid;
|
||||
|
||||
Vector<RID> material_cache;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user