webvr js meetup initial commit
This commit is contained in:
47
node_modules/three/src/extras/SceneUtils.js
generated
vendored
Normal file
47
node_modules/three/src/extras/SceneUtils.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Matrix4 } from '../math/Matrix4';
|
||||
import { Mesh } from '../objects/Mesh';
|
||||
import { Group } from '../objects/Group';
|
||||
|
||||
/**
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
*/
|
||||
|
||||
var SceneUtils = {
|
||||
|
||||
createMultiMaterialObject: function ( geometry, materials ) {
|
||||
|
||||
var group = new Group();
|
||||
|
||||
for ( var i = 0, l = materials.length; i < l; i ++ ) {
|
||||
|
||||
group.add( new Mesh( geometry, materials[ i ] ) );
|
||||
|
||||
}
|
||||
|
||||
return group;
|
||||
|
||||
},
|
||||
|
||||
detach: function ( child, parent, scene ) {
|
||||
|
||||
child.applyMatrix( parent.matrixWorld );
|
||||
parent.remove( child );
|
||||
scene.add( child );
|
||||
|
||||
},
|
||||
|
||||
attach: function ( child, scene, parent ) {
|
||||
|
||||
var matrixWorldInverse = new Matrix4();
|
||||
matrixWorldInverse.getInverse( parent.matrixWorld );
|
||||
child.applyMatrix( matrixWorldInverse );
|
||||
|
||||
scene.remove( child );
|
||||
parent.add( child );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
export { SceneUtils };
|
||||
Reference in New Issue
Block a user