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.TorusGeometry.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: 1.8 KB
Line 
1Sidebar.Geometry.TorusGeometry = 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 // tube
18
19 var tubeRow = new UI.Panel();
20 var tube = new UI.Number( geometry.tube ).onChange( update );
21
22 tubeRow.add( new UI.Text( 'Tube' ).setWidth( '90px' ) );
23 tubeRow.add( tube );
24
25 container.add( tubeRow );
26
27 // radialSegments
28
29 var radialSegmentsRow = new UI.Panel();
30 var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
31
32 radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
33 radialSegmentsRow.add( radialSegments );
34
35 container.add( radialSegmentsRow );
36
37 // tubularSegments
38
39 var tubularSegmentsRow = new UI.Panel();
40 var tubularSegments = new UI.Integer( geometry.tubularSegments ).setRange( 1, Infinity ).onChange( update );
41
42 tubularSegmentsRow.add( new UI.Text( 'Tubular segments' ).setWidth( '90px' ) );
43 tubularSegmentsRow.add( tubularSegments );
44
45 container.add( tubularSegmentsRow );
46
47 // arc
48
49 var arcRow = new UI.Panel();
50 var arc = new UI.Number( geometry.arc ).onChange( update );
51
52 arcRow.add( new UI.Text( 'Arc' ).setWidth( '90px' ) );
53 arcRow.add( arc );
54
55 container.add( arcRow );
56
57
58 //
59
60 function update() {
61
62 delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
63
64 object.geometry.dispose();
65
66 object.geometry = new THREE.TorusGeometry(
67 radius.getValue(),
68 tube.getValue(),
69 radialSegments.getValue(),
70 tubularSegments.getValue(),
71 arc.getValue()
72 );
73
74 object.geometry.computeBoundingSphere();
75
76 signals.objectChanged.dispatch( object );
77
78 }
79
80 return container;
81
82}
Note: See TracBrowser for help on using the repository browser.