1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- Sidebar.Geometry.CylinderGeometry = function ( signals, object ) {
- var container = new UI.Panel();
- var geometry = object.geometry;
- // radiusTop
- var radiusTopRow = new UI.Panel();
- var radiusTop = new UI.Number( geometry.radiusTop ).onChange( update );
- radiusTopRow.add( new UI.Text( 'Radius top' ).setWidth( '90px' ) );
- radiusTopRow.add( radiusTop );
- container.add( radiusTopRow );
- // radiusBottom
- var radiusBottomRow = new UI.Panel();
- var radiusBottom = new UI.Number( geometry.radiusBottom ).onChange( update );
- radiusBottomRow.add( new UI.Text( 'Radius bottom' ).setWidth( '90px' ) );
- radiusBottomRow.add( radiusBottom );
- container.add( radiusBottomRow );
- // height
- var heightRow = new UI.Panel();
- var height = new UI.Number( geometry.height ).onChange( update );
- heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
- heightRow.add( height );
- container.add( heightRow );
- // radialSegments
- var radialSegmentsRow = new UI.Panel();
- var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
- radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ) );
- radialSegmentsRow.add( radialSegments );
- container.add( radialSegmentsRow );
- // heightSegments
- var heightSegmentsRow = new UI.Panel();
- var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
- heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
- heightSegmentsRow.add( heightSegments );
- container.add( heightSegmentsRow );
- // openEnded
- var openEndedRow = new UI.Panel();
- var openEnded = new UI.Checkbox( geometry.openEnded ).onChange( update );
- openEndedRow.add( new UI.Text( 'Open ended' ).setWidth( '90px' ) );
- openEndedRow.add( openEnded );
- container.add( openEndedRow );
- //
- function update() {
- delete object.__webglInit; // TODO: Remove hack (WebGLRenderer refactoring)
- object.geometry.dispose();
- object.geometry = new THREE.CylinderGeometry(
- radiusTop.getValue(),
- radiusBottom.getValue(),
- height.getValue(),
- radialSegments.getValue(),
- heightSegments.getValue(),
- openEnded.getValue()
- );
- object.geometry.computeBoundingSphere();
- signals.objectChanged.dispatch( object );
- }
- return container;
- }
|