-
-
Save drcmda/07534f5fb431d8649f14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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