instance check instead of type check

This commit is contained in:
casperlamboo 2016-07-19 14:26:06 +02:00
parent 782c61ecdb
commit b6350871be

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';