Skip to content

Instantly share code, notes, and snippets.

@drcmda
Created March 21, 2016 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drcmda/07534f5fb431d8649f14 to your computer and use it in GitHub Desktop.
Save drcmda/07534f5fb431d8649f14 to your computer and use it in GitHub Desktop.
import Parser from 'parser';
export default class {
constructor(pool) {
this.pool = pool;
return attribs => {
switch (attribs.type) {
case Parser.Factory.Link:
let { ref, matrix } = attribs.data;
let item = this.pool.find(obj => obj.userData.id === ref);
if (item) {
// Add reference to the current model, transform it
let clone = item.clone();
clone.applyMatrix(new THREE.Matrix4().set(...matrix));
attribs.model.add(clone);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment