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.CylinderGeometry.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.2 KB
Line 
1Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
2
3 var container = new UI.Panel();
4
5 var geometry = object.geometry;
6
7 // radiusTop
8
9 var radiusTopRow = new UI.Panel();
10 var radiusTop = new UI.Number( geometry.radiusTop ).onChange( update );
11
12 radiusTopRow.add( new UI.Text( 'Radius top' ).setWidth( '90px' ) );
13 radiusTopRow.add( radiusTop );
14
15 container.add( radiusTopRow );
16
17 // radiusBottom
18
19 var radiusBottomRow = new UI.Panel();
20 var radiusBottom = new UI.Number( geometry.radiusBottom ).onChange( update );
21
22 radiusBottomRow.add( new UI.Text( 'Radius bottom' ).setWidth( '90px' ) );
23 radiusBottomRow.add( radiusBottom );
24
25 container.add( radiusBottomRow );
26
27 // height
28
29 var heightRow = new UI.Panel();
30 var height = new UI.Number( geometry.height ).onChange( update );
31
32 heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
33 heightRow.add( height );
34
35 container.add( heightRow );
36
37 // radialSegments
38
39 var radialSegmentsRow = new UI.Panel();
40 var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
41
42 radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
43 radialSegmentsRow.add( radialSegments );
44
45 container.add( radialSegmentsRow );
46
47 // heightSegments
48
49 var heightSegmentsRow = new UI.Panel();
50 var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
51
52 heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
53 heightSegmentsRow.add( heightSegments );
54
55 container.add( heightSegmentsRow );
56
57 // openEnded
58
59 var openEndedRow = new UI.Panel();
60 var openEnded = new UI.Checkbox( geometry.openEnded ).onChange( update );
61
62 openEndedRow.add( new UI.Text( 'Open ended' ).setWidth( '90px' ) );
63 openEndedRow.add( openEnded );
64
65 container.add( openEndedRow );
66
67 //
68
69 function update() {
70
71 delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
72
73 object.geometry.dispose();
74
75 object.geometry = new THREE.CylinderGeometry(
76 radiusTop.getValue(),
77 radiusBottom.getValue(),
78 height.getValue(),
79 radialSegments.getValue(),
80 heightSegments.getValue(),
81 openEnded.getValue()
82 );
83
84 object.geometry.computeBoundingSphere();
85
86 signals.objectChanged.dispatch( object );
87
88 }
89
90 return container;
91
92}
Note: See TracBrowser for help on using the repository browser.