Esempio n. 1
0
        public static GLTFImage Deserialize(GLTFRoot root, JsonReader reader)
        {
            var image = new GLTFImage();

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

                switch (curProp)
                {
                case "uri":
                    image.Uri = reader.ReadAsString();
                    break;

                case "mimeType":
                    image.MimeType = reader.ReadAsString();
                    break;

                case "bufferView":
                    image.BufferView = GLTFBufferViewId.Deserialize(root, reader);
                    break;

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

            return(image);
        }
        public static GLTFAccessorSparseIndices Deserialize(GLTFRoot root, JsonReader reader)
        {
            var indices = new GLTFAccessorSparseIndices();

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

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

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

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

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

            return(indices);
        }
Esempio n. 3
0
        public static GLTFAccessor Deserialize(GLTFRoot root, JsonReader reader)
        {
            var accessor = new GLTFAccessor();

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

                switch (curProp)
                {
                case "bufferView":
                    accessor.BufferView = GLTFBufferViewId.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 = GLTFAccessorSparse.Deserialize(root, reader);
                    break;

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

            return(accessor);
        }