parse static method

List<int> parse(
  1. Scene scene, [
  2. PLYOptions? options
])

Implementation

static List<int> parse(Scene scene,[PLYOptions? options]) {
  options ??= PLYOptions();
  if(options.type == ExportTypes.ascii){
    String header = '';
    String polygon = '';
    int numFaces = 0;
    int numVerticies = 0;
    bool start = true;

    late _PLYPM pm;

    scene.traverse((mesh){
      if(mesh is Mesh) {
        pm = _parseMeshAscii(mesh,start,options!);
        header += pm.header;
        polygon += pm.polygon;
        numFaces += pm.numFaces;
        numVerticies += pm.numVerticies;
        start = false;
      }
    });

    return _PLYPM(header, null, polygon, numVerticies, numFaces).file;
  }
  else{
    String header = '';
    final List<int> data = [];
    final List<int> polygon = [];
    int numFaces = 0;
    int numVerticies = 0;
    bool start = true;

    scene.traverse((mesh){
      if(mesh is Mesh) {
        final pm = _parseMeshBinary(mesh,start,options!);
        header += pm.header;
        data.addAll(pm.file);
        polygon.addAll(pm.polygon);
        numFaces += pm.numFaces;
        numVerticies += pm.numVerticies;
        start = false;
      }
    });

    return _PLYPM(header, data, polygon, numVerticies, numFaces).file;
  }
}