|
|
@@ -188,6 +188,7 @@ class NodeMaterialObserver {
|
|
|
|
|
|
data = {
|
|
|
geometryId: geometry.id,
|
|
|
+ geometryVersion: this.getGeometryData( geometry )._version,
|
|
|
materialVersion: this.getMaterialData( renderObject.material )._version,
|
|
|
worldMatrix: object.matrixWorld.clone()
|
|
|
};
|
|
|
@@ -300,7 +301,7 @@ class NodeMaterialObserver {
|
|
|
|
|
|
data = {
|
|
|
_renderId: - 1,
|
|
|
- _equal: false,
|
|
|
+ _version: 0,
|
|
|
|
|
|
attributes: this.getAttributesData( geometry.attributes ),
|
|
|
indexId: geometry.index ? geometry.index.id : null,
|
|
|
@@ -480,12 +481,14 @@ class NodeMaterialObserver {
|
|
|
|
|
|
const geometryData = this.getGeometryData( renderObject.geometry );
|
|
|
|
|
|
- // check the geoemtry for the "equal" state just once per render for all render objects
|
|
|
+ // check the geometry properties just once per render for all render objects
|
|
|
|
|
|
if ( geometryData._renderId !== renderId ) {
|
|
|
|
|
|
geometryData._renderId = renderId;
|
|
|
|
|
|
+ let changed = false;
|
|
|
+
|
|
|
// attributes
|
|
|
|
|
|
const attributes = geometry.attributes;
|
|
|
@@ -508,8 +511,8 @@ class NodeMaterialObserver {
|
|
|
// attribute was removed
|
|
|
delete storedAttributes[ name ];
|
|
|
|
|
|
- geometryData._equal = false;
|
|
|
- return false;
|
|
|
+ changed = true;
|
|
|
+ continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -521,8 +524,7 @@ class NodeMaterialObserver {
|
|
|
storedAttributeData.id = id;
|
|
|
storedAttributeData.version = version;
|
|
|
|
|
|
- geometryData._equal = false;
|
|
|
- return false;
|
|
|
+ changed = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -532,26 +534,22 @@ class NodeMaterialObserver {
|
|
|
|
|
|
geometryData.attributes = this.getAttributesData( attributes );
|
|
|
|
|
|
- geometryData._equal = false;
|
|
|
- return false;
|
|
|
+ changed = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
// check index
|
|
|
|
|
|
const index = geometry.index;
|
|
|
- const storedIndexId = geometryData.indexId;
|
|
|
- const storedIndexVersion = geometryData.indexVersion;
|
|
|
const currentIndexId = index ? index.id : null;
|
|
|
const currentIndexVersion = index ? index.version : null;
|
|
|
|
|
|
- if ( storedIndexId !== currentIndexId || storedIndexVersion !== currentIndexVersion ) {
|
|
|
+ if ( geometryData.indexId !== currentIndexId || geometryData.indexVersion !== currentIndexVersion ) {
|
|
|
|
|
|
geometryData.indexId = currentIndexId;
|
|
|
geometryData.indexVersion = currentIndexVersion;
|
|
|
|
|
|
- geometryData._equal = false;
|
|
|
- return false;
|
|
|
+ changed = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -562,16 +560,21 @@ class NodeMaterialObserver {
|
|
|
geometryData.drawRange.start = geometry.drawRange.start;
|
|
|
geometryData.drawRange.count = geometry.drawRange.count;
|
|
|
|
|
|
- geometryData._equal = false;
|
|
|
- return false;
|
|
|
+ changed = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
- geometryData._equal = true;
|
|
|
+ if ( changed === true ) geometryData._version ++;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
+ // a version mismatch means the geometry has changed since this render object was last refreshed
|
|
|
|
|
|
- if ( geometryData._equal === false ) return false;
|
|
|
+ if ( renderObjectData.geometryVersion !== geometryData._version ) {
|
|
|
+
|
|
|
+ renderObjectData.geometryVersion = geometryData._version;
|
|
|
+
|
|
|
+ return false;
|
|
|
|
|
|
}
|
|
|
|