Exemple #1
0
        public NativeArray <byte> GetBufferBytes(UniGLTF.glTFBuffer buffer)
        {
            int index = Gltf.buffers.IndexOf(buffer);

            if (index != 0)
            {
                throw new NotImplementedException();
            }
            return(m_data.Bin);
        }
Exemple #2
0
        void BufferTest(int init, params int[] size)
        {
            var initBytes = init == 0 ? null : new byte[init];
            var storage   = new ArrayByteBuffer(initBytes);
            var buffer    = new glTFBuffer(storage);

            var values = new List <byte>();
            int offset = 0;

            foreach (var x in size)
            {
                var nums = Enumerable.Range(offset, x).Select(y => (Byte)y).ToArray();
                values.AddRange(nums);
                var bytes = new ArraySegment <Byte>(nums);
                offset += x;
                buffer.Append(bytes, glBufferTarget.NONE);
            }

            Assert.AreEqual(values.Count, buffer.byteLength);
            Assert.True(Enumerable.SequenceEqual(values, buffer.GetBytes().ToArray()));
        }
Exemple #3
0
        public static void Serialize_gltf_buffers_ITEM(JsonFormatter f, glTFBuffer value)
        {
            f.BeginMap();


            if (!string.IsNullOrEmpty(value.uri))
            {
                f.Key("uri");
                f.Value(value.uri);
            }

            if (value.byteLength >= 1)
            {
                f.Key("byteLength");
                f.Value(value.byteLength);
            }

            if (value.extensions != null)
            {
                f.Key("extensions");
                value.extensions.Serialize(f);
            }

            if (value.extras != null)
            {
                f.Key("extras");
                value.extras.Serialize(f);
            }

            if (!string.IsNullOrEmpty(value.name))
            {
                f.Key("name");
                f.Value(value.name);
            }

            f.EndMap();
        }
Exemple #4
0
        public ArraySegment <byte> GetBufferBytes(UniGLTF.glTFBuffer buffer)
        {
            int index = Gltf.buffers.IndexOf(buffer);

            return(Buffers[index].Bytes);
        }