Sidebar.Geometry.SphereGeometry.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. Sidebar.Geometry.SphereGeometry = function ( signals, geometry ) {
  2. var container = new UI.Panel();
  3. container.setBorderTop( '1px solid #ccc' );
  4. container.setPaddingTop( '10px' );
  5. // radius
  6. var radiusRow = new UI.Panel();
  7. var radius = new UI.Number( geometry.radius ).onChange( update );
  8. radiusRow.add( new UI.Text( 'Radius' ).setWidth( '90px' ).setColor( '#666' ) );
  9. radiusRow.add( radius );
  10. container.add( radiusRow );
  11. // widthSegments
  12. var widthSegmentsRow = new UI.Panel();
  13. var widthSegments = new UI.Integer( geometry.widthSegments ).setRange( 1, Infinity ).onChange( update );
  14. widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ).setColor( '#666' ) );
  15. widthSegmentsRow.add( widthSegments );
  16. container.add( widthSegmentsRow );
  17. // heightSegments
  18. var heightSegmentsRow = new UI.Panel();
  19. var heightSegments = new UI.Integer( geometry.heightSegments ).setRange( 1, Infinity ).onChange( update );
  20. heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ).setColor( '#666' ) );
  21. heightSegmentsRow.add( heightSegments );
  22. container.add( heightSegmentsRow );
  23. // phiStart
  24. var phiStartRow = new UI.Panel();
  25. var phiStart = new UI.Number( geometry.phiStart ).onChange( update );
  26. phiStartRow.add( new UI.Text( 'Phi start' ).setWidth( '90px' ).setColor( '#666' ) );
  27. phiStartRow.add( phiStart );
  28. container.add( phiStartRow );
  29. // phiLength
  30. var phiLengthRow = new UI.Panel();
  31. var phiLength = new UI.Number( geometry.phiLength ).onChange( update );
  32. phiLengthRow.add( new UI.Text( 'Phi length' ).setWidth( '90px' ).setColor( '#666' ) );
  33. phiLengthRow.add( phiLength );
  34. container.add( phiLengthRow );
  35. // thetaStart
  36. var thetaStartRow = new UI.Panel();
  37. var thetaStart = new UI.Number( geometry.thetaStart ).onChange( update );
  38. thetaStartRow.add( new UI.Text( 'Theta start' ).setWidth( '90px' ).setColor( '#666' ) );
  39. thetaStartRow.add( thetaStart );
  40. container.add( thetaStartRow );
  41. // thetaLength
  42. var thetaLengthRow = new UI.Panel();
  43. var thetaLength = new UI.Number( geometry.thetaLength ).onChange( update );
  44. thetaLengthRow.add( new UI.Text( 'Theta length' ).setWidth( '90px' ).setColor( '#666' ) );
  45. thetaLengthRow.add( thetaLength );
  46. container.add( thetaLengthRow );
  47. //
  48. function update() {
  49. editor.remakeGeometry( geometry,
  50. {
  51. radius: radius.getValue(),
  52. widthSegments: widthSegments.getValue(),
  53. heightSegments: heightSegments.getValue(),
  54. phiStart: phiStart.getValue(),
  55. phiLength: phiLength.getValue(),
  56. thetaStart: thetaStart.getValue(),
  57. thetaLength: thetaLength.getValue()
  58. }
  59. );
  60. }
  61. return container;
  62. }