mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-16 19:17:57 +01:00
52 lines
966 B
JavaScript
52 lines
966 B
JavaScript
|
/**
|
||
|
* @author mrdoob / http://mrdoob.com/
|
||
|
*/
|
||
|
|
||
|
Sidebar.Geometry.IcosahedronGeometry = function ( signals, object ) {
|
||
|
|
||
|
var container = new UI.Panel();
|
||
|
|
||
|
var parameters = object.geometry.parameters;
|
||
|
|
||
|
// radius
|
||
|
|
||
|
var radiusRow = new UI.Panel();
|
||
|
var radius = new UI.Number( parameters.radius ).onChange( update );
|
||
|
|
||
|
radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
|
||
|
radiusRow.add( radius );
|
||
|
|
||
|
container.add( radiusRow );
|
||
|
|
||
|
// detail
|
||
|
|
||
|
var detailRow = new UI.Panel();
|
||
|
var detail = new UI.Integer( parameters.detail ).setRange( 0, Infinity ).onChange( update );
|
||
|
|
||
|
detailRow.add( new UI.Text( 'Detail' ).setWidth( '90px' ) );
|
||
|
detailRow.add( detail );
|
||
|
|
||
|
container.add( detailRow );
|
||
|
|
||
|
|
||
|
//
|
||
|
|
||
|
function update() {
|
||
|
|
||
|
object.geometry.dispose();
|
||
|
|
||
|
object.geometry = new THREE.IcosahedronGeometry(
|
||
|
radius.getValue(),
|
||
|
detail.getValue()
|
||
|
);
|
||
|
|
||
|
object.geometry.computeBoundingSphere();
|
||
|
|
||
|
signals.objectChanged.dispatch( object );
|
||
|
|
||
|
}
|
||
|
|
||
|
return container;
|
||
|
|
||
|
}
|