Ejemplo n.º 1
0
        public static GLTFAccessorSparse Deserialize(GLTFRoot root, JsonReader reader)
        {
            var accessorSparse = new GLTFAccessorSparse();

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

                switch (curProp)
                {
                case "count":
                    accessorSparse.Count = reader.ReadAsInt32().Value;
                    break;

                case "indices":
                    accessorSparse.Indices = GLTFAccessorSparseIndices.Deserialize(root, reader);
                    break;

                case "values":
                    accessorSparse.Values = GLTFAccessorSparseValues.Deserialize(root, reader);
                    break;

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

            return(accessorSparse);
        }
Ejemplo n.º 2
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);
        }