Sidebar.Geometry.IcosahedronGeometry.js 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Sidebar.Geometry.IcosahedronGeometry = function ( signals, object ) {
  2. var container = new UI.Panel();
  3. var parameters = object.geometry.parameters;
  4. // radius
  5. var radiusRow = new UI.Panel();
  6. var radius = new UI.Number( parameters.radius ).onChange( update );
  7. radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ) );
  8. radiusRow.add( radius );
  9. container.add( radiusRow );
  10. // detail
  11. var detailRow = new UI.Panel();
  12. var detail = new UI.Integer( parameters.detail ).setRange( 0, Infinity ).onChange( update );
  13. detailRow.add( new UI.Text( 'Detail' ).setWidth( '90px' ) );
  14. detailRow.add( detail );
  15. container.add( detailRow );
  16. //
  17. function update() {
  18. object.geometry.dispose();
  19. object.geometry = new THREE.IcosahedronGeometry(
  20. radius.getValue(),
  21. detail.getValue()
  22. );
  23. object.geometry.computeBoundingSphere();
  24. signals.objectChanged.dispatch( object );
  25. }
  26. return container;
  27. }