public GltfData(string targetPath, string json, glTF gltf, IReadOnlyList <GlbChunk> chunks, IStorage storage, MigrationFlags migrationFlags) { TargetPath = targetPath; Json = json; GLTF = gltf; Chunks = chunks; Storage = storage; MigrationFlags = migrationFlags; }
public GltfData(string targetPath, string json, glTF gltf, IReadOnlyList <GlbChunk> chunks, IStorage storage, MigrationFlags migrationFlags) { TargetPath = targetPath; Json = json; GLTF = gltf; Chunks = chunks; _storage = storage; MigrationFlags = migrationFlags; // init if (Chunks != null) { if (Chunks.Count >= 2) { Bin = NativeArrayManager.CreateNativeArray(Chunks[1].Bytes); } } }
public static GltfData ParseGltf(string path, string json, IReadOnlyList <GlbChunk> chunks, IStorage storage, MigrationFlags migrationFlags) { var GLTF = GltfDeserializer.Deserialize(json.ParseAsJson()); if (GLTF.asset.version != "2.0") { throw new UniGLTFException("unknown gltf version {0}", GLTF.asset.version); } // Version Compatibility RestoreOlderVersionValues(json, GLTF); FixMeshNameUnique(GLTF); foreach (var image in GLTF.images) { image.uri = PrepareUri(image.uri); } FixTextureNameUnique(GLTF); FixMaterialNameUnique(GLTF); FixNodeName(GLTF); FixAnimationNameUnique(GLTF); // parepare byte buffer //GLTF.baseDir = System.IO.Path.GetDirectoryName(Path); foreach (var buffer in GLTF.buffers) { buffer.OpenStorage(storage); } return(new GltfData(path, json, GLTF, chunks, storage, migrationFlags)); }