Skip to content

Commit 99550a5

Browse files
authored
RenderObject: Properly compare interleaved buffer attributes. (mrdoob#33558)
1 parent 609e8a5 commit 99550a5

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

src/materials/nodes/manager/NodeMaterialObserver.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ class NodeMaterialObserver {
242242
const attribute = attributes[ name ];
243243

244244
attributesData[ name ] = {
245-
id: attribute.id,
246-
version: attribute.version,
245+
id: attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id,
246+
version: attribute.isInterleavedBufferAttribute ? attribute.data.version : attribute.version,
247247
};
248248

249249
}
@@ -501,10 +501,13 @@ class NodeMaterialObserver {
501501

502502
}
503503

504-
if ( storedAttributeData.id !== attribute.id || storedAttributeData.version !== attribute.version ) {
504+
const id = attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id;
505+
const version = attribute.isInterleavedBufferAttribute ? attribute.data.version : attribute.version;
505506

506-
storedAttributeData.id = attribute.id;
507-
storedAttributeData.version = attribute.version;
507+
if ( storedAttributeData.id !== id || storedAttributeData.version !== version ) {
508+
509+
storedAttributeData.id = id;
510+
storedAttributeData.version = version;
508511

509512
geometryData._equal = false;
510513
return false;

src/renderers/common/RenderObject.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,15 @@ class RenderObject {
514514

515515
if ( attribute !== undefined ) {
516516

517-
attributesId[ nodeAttribute.name ] = attribute.id;
517+
if ( attribute.isInterleavedBufferAttribute ) {
518+
519+
attributesId[ nodeAttribute.name ] = attribute.data.uuid;
520+
521+
} else {
522+
523+
attributesId[ nodeAttribute.name ] = attribute.id;
524+
525+
}
518526

519527
}
520528

@@ -819,7 +827,11 @@ class RenderObject {
819827

820828
const attribute = this.geometry.getAttribute( name );
821829

822-
if ( attribute === undefined || attributesId[ name ] !== attribute.id ) {
830+
if ( attribute === undefined ) return true;
831+
832+
const id = attribute.isInterleavedBufferAttribute ? attribute.data.uuid : attribute.id;
833+
834+
if ( attributesId[ name ] !== id ) {
823835

824836
return true;
825837

0 commit comments

Comments
 (0)