instance check instead of type check

This commit is contained in:
casperlamboo 2016-07-19 14:26:06 +02:00 committed by Simon Voordouw
parent 0553076c57
commit 35a50f222e

View File

@ -22,9 +22,9 @@ export default class extends EventDispatcher {
return this;
}
setGeometry (geometry, matrix) {
if (geometry.type === 'BufferGeometry') {
if (geometry instanceof THREE.BufferGeometry) {
geometry = new THREE.Geometry().fromBufferGeometry(geometry);
} else if (geometry.type.endsWith('Geometry')) {
} else if (geometry instanceof THREE.Geometry) {
geometry = geometry.clone();
} else {
throw 'Geometry is not an instance of BufferGeometry or Geometry';