public void LoadGLTFFromStream() { Assert.IsTrue(File.Exists(GLTF_PATH)); FileStream gltfStream = File.OpenRead(GLTF_PATH); GLTFRoot.RegisterExtension(new TestExtensionFactory()); GLTFRoot gltfRoot = GLTFParser.ParseJson(gltfStream); GLTFJsonLoadTestHelper.TestGLTF(gltfRoot); }
public void LoadGLBFromStream() { Assert.IsTrue(File.Exists(GLB_PATH)); FileStream gltfStream = File.OpenRead(GLB_PATH); // todo: this code does not work if file is greater than 4 gb int streamLength = (int)gltfStream.Length; byte[] gltfData = new byte[streamLength]; gltfStream.Read(gltfData, 0, streamLength); GLTFRoot gltfRoot = GLTFParser.ParseJson(gltfData); GLTFJsonLoadTestHelper.TestGLB(gltfRoot); }
public void CreateGLBFromStream() { Assert.IsTrue(File.Exists(TestAssetPaths.GLB_BOOMBOX_PATH)); FileStream glbStream = File.OpenRead(TestAssetPaths.GLB_BOOMBOX_PATH); FileStream glbOutStream = File.Create(TestAssetPaths.GLB_BOOMBOX_OUT_PATH); GLBObject glbObject = GLBBuilder.ConstructFromStream(glbStream, glbOutStream); Assert.IsNotNull(glbObject.Root); Assert.IsNotNull(glbObject.Stream); Assert.AreEqual(0, glbObject.StreamStartPosition); Assert.AreEqual(GLTFParser.HEADER_SIZE, glbObject.JsonChunkInfo.StartPosition); Assert.AreEqual(glbStream.Length, glbObject.Header.FileLength); glbOutStream.Position = 0; GLTFRoot glbOutRoot; GLTFParser.ParseJson(glbOutStream, out glbOutRoot); GLTFJsonLoadTestHelper.TestGLB(glbOutRoot); }