don't regenerate hole mesh when not needed

This commit is contained in:
casperlamboo 2017-12-12 22:15:03 +01:00
parent da3e109cdd
commit 2b9eac38c7

7
src/d3/ShapeMesh.js vendored
View File

@ -61,10 +61,12 @@ class ShapeMesh extends THREE.Object3D {
if (!this._solid) return false; if (!this._solid) return false;
if (holes === this._holes && !this._changedGeometry) return false; if (holes === this._holes && !this._changedGeometry) return false;
this._holeMesh.geometry.dispose();
if (holes === null || !this._fill || this._type === 'EXPORT_SHAPE') { if (holes === null || !this._fill || this._type === 'EXPORT_SHAPE') {
if (this._holeMeshIsOriginal) return false;
this._holeMesh.geometry.dispose();
this._holeMesh.geometry = new THREE.Geometry().fromBufferGeometry(this._mesh.geometry); this._holeMesh.geometry = new THREE.Geometry().fromBufferGeometry(this._mesh.geometry);
this._holeMeshIsOriginal = true;
return true; return true;
} }
@ -77,6 +79,7 @@ class ShapeMesh extends THREE.Object3D {
this._holes = holes; this._holes = holes;
this._changedGeometry = false; this._changedGeometry = false;
this._holeMeshIsOriginal = false;
return true; return true;
} }