Sidebar.Geometry.BufferGeometry.js 807 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Geometry.BufferGeometry = function ( signals ) {
  5. var container = new UI.Panel();
  6. function update( object ) {
  7. if ( object === null ) return;
  8. var geometry = object.geometry;
  9. if ( geometry instanceof THREE.BufferGeometry ) {
  10. container.clear();
  11. container.setDisplay( 'block' );
  12. var attributes = geometry.attributes;
  13. for ( var name in attributes ) {
  14. var panel = new UI.Panel();
  15. panel.add( new UI.Text( name ).setWidth( '90px' ) );
  16. panel.add( new UI.Text( ( attributes[ name ].count ).format() ).setFontSize( '12px' ) );
  17. container.add( panel );
  18. }
  19. } else {
  20. container.setDisplay( 'none' );
  21. }
  22. };
  23. signals.objectSelected.add( update );
  24. signals.geometryChanged.add( update );
  25. return container;
  26. }