Example #1
0
        public static Accessor Deserialize(GLTFRoot root, JsonReader reader)
        {
            var accessor = new Accessor();

            while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
            {
                var curProp = reader.Value.ToString();

                switch (curProp)
                {
                case "bufferView":
                    accessor.BufferView = BufferViewId.Deserialize(root, reader);
                    break;

                case "byteOffset":
                    accessor.ByteOffset = reader.ReadAsInt32().Value;
                    break;

                case "componentType":
                    accessor.ComponentType = (GLTFComponentType)reader.ReadAsInt32().Value;
                    break;

                case "normalized":
                    accessor.Normalized = reader.ReadAsBoolean().Value;
                    break;

                case "count":
                    accessor.Count = reader.ReadAsInt32().Value;
                    break;

                case "type":
                    accessor.Type = reader.ReadStringEnum <GLTFAccessorAttributeType>();
                    break;

                case "max":
                    accessor.Max = reader.ReadDoubleList();
                    break;

                case "min":
                    accessor.Min = reader.ReadDoubleList();
                    break;

                case "sparse":
                    accessor.Sparse = AccessorSparse.Deserialize(root, reader);
                    break;

                default:
                    accessor.DefaultPropertyDeserializer(root, reader);
                    break;
                }
            }

            return(accessor);
        }