source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/editor/js/Sidebar.Geometry.SphereGeometry.js@ 28897

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: 2.5 KB
Line 
1Sidebar.Geometry.SphereGeometry = function ( signals, object ) {
2
3 var container = new UI.Panel();
4
5 var geometry = object.geometry;
6
7 // radius
8
9 var radiusRow = new UI.Panel();
10 var radius = new UI.Number( geometry.radius ).onChange( update );
11
12 radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
13 radiusRow.add( radius );
14
15 container.add( radiusRow );
16
17 // widthSegments
18
19 var widthSegmentsRow = new UI.Panel();
20 var widthSegments = new UI.Integer( geometry.widthSegments ).setRange( 1, Infinity ).onChange( update );
21
22 widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ) );
23 widthSegmentsRow.add( widthSegments );
24
25 container.add( widthSegmentsRow );
26
27 // heightSegments
28
29 var heightSegmentsRow = new UI.Panel();
30 var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
31
32 heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
33 heightSegmentsRow.add( heightSegments );
34
35 container.add( heightSegmentsRow );
36
37 // phiStart
38
39 var phiStartRow = new UI.Panel();
40 var phiStart = new UI.Number( geometry.phiStart ).onChange( update );
41
42 phiStartRow.add( new UI.Text( 'Phi start' ).setWidth( '90px' ) );
43 phiStartRow.add( phiStart );
44
45 container.add( phiStartRow );
46
47 // phiLength
48
49 var phiLengthRow = new UI.Panel();
50 var phiLength = new UI.Number( geometry.phiLength ).onChange( update );
51
52 phiLengthRow.add( new UI.Text( 'Phi length' ).setWidth( '90px' ) );
53 phiLengthRow.add( phiLength );
54
55 container.add( phiLengthRow );
56
57 // thetaStart
58
59 var thetaStartRow = new UI.Panel();
60 var thetaStart = new UI.Number( geometry.thetaStart ).onChange( update );
61
62 thetaStartRow.add( new UI.Text( 'Theta start' ).setWidth( '90px' ) );
63 thetaStartRow.add( thetaStart );
64
65 container.add( thetaStartRow );
66
67 // thetaLength
68
69 var thetaLengthRow = new UI.Panel();
70 var thetaLength = new UI.Number( geometry.thetaLength ).onChange( update );
71
72 thetaLengthRow.add( new UI.Text( 'Theta length' ).setWidth( '90px' ) );
73 thetaLengthRow.add( thetaLength );
74
75 container.add( thetaLengthRow );
76
77
78 //
79
80 function update() {
81
82 delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
83
84 object.geometry.dispose();
85
86 object.geometry = new THREE.SphereGeometry(
87 radius.getValue(),
88 widthSegments.getValue(),
89 heightSegments.getValue(),
90 phiStart.getValue(),
91 phiLength.getValue(),
92 thetaStart.getValue(),
93 thetaLength.getValue()
94 );
95
96 object.geometry.computeBoundingSphere();
97
98 signals.objectChanged.dispatch( object );
99
100 }
101
102 return container;
103
104}
Note: See TracBrowser for help on using the repository browser.