Sidebar.Geometry.TorusKnotGeometry.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. Sidebar.Geometry.TorusKnotGeometry = 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. // tube
  12. var tubeRow = new UI.Panel();
  13. var tube = new UI.Number( geometry.tube ).onChange( update );
  14. tubeRow.add( new UI.Text( 'Tube' ).setWidth( '90px' ).setColor( '#666' ) );
  15. tubeRow.add( tube );
  16. container.add( tubeRow );
  17. // radialSegments
  18. var radialSegmentsRow = new UI.Panel();
  19. var radialSegments = new UI.Integer( geometry.radialSegments ).setRange( 1, Infinity ).onChange( update );
  20. radialSegmentsRow.add( new UI.Text( 'Radial segments' ).setWidth( '90px' ).setColor( '#666' ) );
  21. radialSegmentsRow.add( radialSegments );
  22. container.add( radialSegmentsRow );
  23. // tubularSegments
  24. var tubularSegmentsRow = new UI.Panel();
  25. var tubularSegments = new UI.Integer( geometry.tubularSegments ).setRange( 1, Infinity ).onChange( update );
  26. tubularSegmentsRow.add( new UI.Text( 'Tubular segments' ).setWidth( '90px' ).setColor( '#666' ) );
  27. tubularSegmentsRow.add( tubularSegments );
  28. container.add( tubularSegmentsRow );
  29. // p
  30. var pRow = new UI.Panel();
  31. var p = new UI.Number( geometry.p ).onChange( update );
  32. pRow.add( new UI.Text( 'P' ).setWidth( '90px' ).setColor( '#666' ) );
  33. pRow.add( p );
  34. container.add( pRow );
  35. // q
  36. var qRow = new UI.Panel();
  37. var q = new UI.Number( geometry.q ).onChange( update );
  38. pRow.add( new UI.Text( 'Q' ).setWidth( '90px' ).setColor( '#666' ) );
  39. pRow.add( q );
  40. container.add( qRow );
  41. // heightScale
  42. var heightScaleRow = new UI.Panel();
  43. var heightScale = new UI.Number( geometry.heightScale ).onChange( update );
  44. pRow.add( new UI.Text( 'Height scale' ).setWidth( '90px' ).setColor( '#666' ) );
  45. pRow.add( heightScale );
  46. container.add( heightScaleRow );
  47. //
  48. function update() {
  49. editor.remakeGeometry( geometry,
  50. {
  51. radius: radius.getValue(),
  52. tube: tube.getValue(),
  53. radialSegments: radialSegments.getValue(),
  54. tubularSegments: tubularSegments.getValue(),
  55. p: p.getValue(),
  56. q: q.getValue(),
  57. heightScale: heightScale.getValue()
  58. }
  59. );
  60. }
  61. return container;
  62. }
粤ICP备19079148号