1 | Sidebar.Geometry.PlaneGeometry = function ( signals, object ) {
|
---|
2 |
|
---|
3 | var container = new UI.Panel();
|
---|
4 |
|
---|
5 | var geometry = object.geometry;
|
---|
6 |
|
---|
7 | // width
|
---|
8 |
|
---|
9 | var widthRow = new UI.Panel();
|
---|
10 | var width = new UI.Number( geometry.width ).onChange( update );
|
---|
11 |
|
---|
12 | widthRow.add( new UI.Text( 'Width' ).setWidth( '90px' ) );
|
---|
13 | widthRow.add( width );
|
---|
14 |
|
---|
15 | container.add( widthRow );
|
---|
16 |
|
---|
17 | // height
|
---|
18 |
|
---|
19 | var heightRow = new UI.Panel();
|
---|
20 | var height = new UI.Number( geometry.height ).onChange( update );
|
---|
21 |
|
---|
22 | heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
|
---|
23 | heightRow.add( height );
|
---|
24 |
|
---|
25 | container.add( heightRow );
|
---|
26 |
|
---|
27 | // widthSegments
|
---|
28 |
|
---|
29 | var widthSegmentsRow = new UI.Panel();
|
---|
30 | var widthSegments = new UI.Integer( geometry.widthSegments ).setRange( 1, Infinity ).onChange( update );
|
---|
31 |
|
---|
32 | widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ) );
|
---|
33 | widthSegmentsRow.add( widthSegments );
|
---|
34 |
|
---|
35 | container.add( widthSegmentsRow );
|
---|
36 |
|
---|
37 | // heightSegments
|
---|
38 |
|
---|
39 | var heightSegmentsRow = new UI.Panel();
|
---|
40 | var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
|
---|
41 |
|
---|
42 | heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
|
---|
43 | heightSegmentsRow.add( heightSegments );
|
---|
44 |
|
---|
45 | container.add( heightSegmentsRow );
|
---|
46 |
|
---|
47 |
|
---|
48 | //
|
---|
49 |
|
---|
50 | function update() {
|
---|
51 |
|
---|
52 | delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
|
---|
53 |
|
---|
54 | object.geometry.dispose();
|
---|
55 |
|
---|
56 | object.geometry = new THREE.PlaneGeometry(
|
---|
57 | width.getValue(),
|
---|
58 | height.getValue(),
|
---|
59 | widthSegments.getValue(),
|
---|
60 | heightSegments.getValue()
|
---|
61 | );
|
---|
62 |
|
---|
63 | object.geometry.computeBoundingSphere();
|
---|
64 |
|
---|
65 | signals.objectChanged.dispatch( object );
|
---|
66 |
|
---|
67 | }
|
---|
68 |
|
---|
69 | return container;
|
---|
70 |
|
---|
71 | }
|
---|