Ejemplo n.º 1
0
        public void LoadGLBFromStream()
        {
            Assert.IsTrue(File.Exists(GLB_PATH));
            FileStream gltfStream = File.OpenRead(GLB_PATH);
            GLTFRoot   gltfRoot   = GLTFParser.ParseJson(gltfStream);

            GLTFJsonLoadTestHelper.TestGLB(gltfRoot);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }