You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
646 B
39 lines
646 B
/**
|
|
* @author alteredq / http://alteredqualia.com/
|
|
*/
|
|
|
|
THREE.SceneUtils = {
|
|
|
|
createMultiMaterialObject: function ( geometry, materials ) {
|
|
|
|
var group = new THREE.Group();
|
|
|
|
for ( var i = 0, l = materials.length; i < l; i ++ ) {
|
|
|
|
group.add( new THREE.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 ) {
|
|
|
|
child.applyMatrix( new THREE.Matrix4().getInverse( parent.matrixWorld ) );
|
|
|
|
scene.remove( child );
|
|
parent.add( child );
|
|
|
|
}
|
|
|
|
};
|