Sidebar.Geometry.Modifiers.js 725 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. import { UIRow, UIButton } from './libs/ui.js';
  5. var SidebarGeometryModifiers = function ( editor, object ) {
  6. var signals = editor.signals;
  7. var container = new UIRow().setPaddingLeft( '90px' );
  8. var geometry = object.geometry;
  9. // Compute Vertex Normals
  10. var button = new UIButton( 'Compute Vertex Normals' );
  11. button.onClick( function () {
  12. geometry.computeVertexNormals();
  13. if ( geometry.isBufferGeometry ) {
  14. geometry.attributes.normal.needsUpdate = true;
  15. } else {
  16. geometry.normalsNeedUpdate = true;
  17. }
  18. signals.geometryChanged.dispatch( object );
  19. } );
  20. container.add( button );
  21. //
  22. return container;
  23. };
  24. export { SidebarGeometryModifiers };