|
@@ -25,9 +25,9 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- updateBuffers = needsUpdate( geometry );
|
|
|
+ updateBuffers = needsUpdate( geometry, index );
|
|
|
|
|
|
- if ( updateBuffers ) saveCache( geometry );
|
|
|
+ if ( updateBuffers ) saveCache( geometry, index );
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -157,13 +157,14 @@
|
|
|
enabledAttributes: enabledAttributes,
|
|
|
attributeDivisors: attributeDivisors,
|
|
|
object: vao,
|
|
|
- attributes: {}
|
|
|
+ attributes: {},
|
|
|
+ index: null
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
- function needsUpdate( geometry ) {
|
|
|
+ function needsUpdate( geometry, index ) {
|
|
|
|
|
|
const cachedAttributes = currentState.attributes;
|
|
|
const geometryAttributes = geometry.attributes;
|
|
@@ -183,11 +184,13 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if ( currentState.index !== index ) return true;
|
|
|
+
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
- function saveCache( geometry ) {
|
|
|
+ function saveCache( geometry, index ) {
|
|
|
|
|
|
const cache = {};
|
|
|
const attributes = geometry.attributes;
|
|
@@ -211,6 +214,8 @@
|
|
|
|
|
|
currentState.attributes = cache;
|
|
|
|
|
|
+ currentState.index = index;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function initAttributes() {
|