parseGeometry method

void parseGeometry(
  1. XmlElement xml
)

Implementation

void parseGeometry(XmlElement xml ) {
  final Map<String,dynamic> data = {
    'name': xml.getAttribute( 'name' ),
    'sources': {},
    'vertices': {},
    'primitives': []
  };

  final mesh = xml.getElement('mesh' );

  // the following tags inside geometry are not supported yet (see https://github.com/mrdoob/three.js/pull/12606): convex_mesh, spline, brep
  if ( mesh == null ) return;

  for (final child in mesh.descendantElements) {
    final id = child.getAttribute( 'id' );

    switch ( child.name.local ) {
      case 'source':
        data['sources'][ id ] = parseSource( child );
        break;
      case 'vertices':
        //data['sources'][ id ] = data['sources'][ parseId( child.getElement('input' )!.getAttribute( 'source' )! ) ];
        data['vertices'] = parseGeometryVertices( child );
        break;
      case 'polygons':
        console.warning( 'ColladaLoader: Unsupported primitive type: ${child.name.local}');
        break;
      case 'lines':
      case 'linestrips':
      case 'polylist':
      case 'triangles':
        data['primitives'].add(parseGeometryPrimitive(child));
        break;
      default:
        console.info( child.name.local );
    }
  }
  library['geometries']![ xml.getAttribute( 'id' )! ] = data;
}