Last change
on this file since 28897 was 28897, checked in by davidb, 10 years ago |
GUI front-end to server base plus web page content
|
File size:
719 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * @author alteredq / http://alteredqualia.com/
|
---|
3 | */
|
---|
4 |
|
---|
5 | THREE.SceneUtils = {
|
---|
6 |
|
---|
7 | createMultiMaterialObject: function ( geometry, materials ) {
|
---|
8 |
|
---|
9 | var group = new THREE.Object3D();
|
---|
10 |
|
---|
11 | for ( var i = 0, l = materials.length; i < l; i ++ ) {
|
---|
12 |
|
---|
13 | group.add( new THREE.Mesh( geometry, materials[ i ] ) );
|
---|
14 |
|
---|
15 | }
|
---|
16 |
|
---|
17 | return group;
|
---|
18 |
|
---|
19 | },
|
---|
20 |
|
---|
21 | detach : function ( child, parent, scene ) {
|
---|
22 |
|
---|
23 | child.applyMatrix( parent.matrixWorld );
|
---|
24 | parent.remove( child );
|
---|
25 | scene.add( child );
|
---|
26 |
|
---|
27 | },
|
---|
28 |
|
---|
29 | attach: function ( child, scene, parent ) {
|
---|
30 |
|
---|
31 | var matrixWorldInverse = new THREE.Matrix4();
|
---|
32 | matrixWorldInverse.getInverse( parent.matrixWorld );
|
---|
33 | child.applyMatrix( matrixWorldInverse );
|
---|
34 |
|
---|
35 | scene.remove( child );
|
---|
36 | parent.add( child );
|
---|
37 |
|
---|
38 | }
|
---|
39 |
|
---|
40 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.