Kaynağa Gözat

+progress with docs, tests and API

Vicente Penades 6 yıl önce
ebeveyn
işleme
5669b91ce0

+ 1 - 0
SharpGLTF.ruleset

@@ -29,6 +29,7 @@
     <Rule Id="SA1512" Action="None" />
     <Rule Id="SA1512" Action="None" />
     <Rule Id="SA1516" Action="None" />	
     <Rule Id="SA1516" Action="None" />	
     <Rule Id="SA1515" Action="None" />
     <Rule Id="SA1515" Action="None" />
+    <Rule Id="SA1601" Action="None" />
     <Rule Id="SA1625" Action="None" />
     <Rule Id="SA1625" Action="None" />
     <Rule Id="SA1629" Action="None" />
     <Rule Id="SA1629" Action="None" />
     <Rule Id="SA1633" Action="None" />
     <Rule Id="SA1633" Action="None" />

+ 4 - 0
build/SharpGLTF.CodeGen/CodeGen/EmitCSharp.cs

@@ -365,6 +365,8 @@ namespace SharpGLTF.CodeGen
         {
         {
             var sb = new StringBuilder();
             var sb = new StringBuilder();
 
 
+            foreach (var l in type.Description.EmitSummary(0)) sb.EmitLine(1, l);
+
             sb.EmitLine(1, $"public enum {_GetRuntimeName(type)}");
             sb.EmitLine(1, $"public enum {_GetRuntimeName(type)}");
             sb.EmitLine(1, "{");
             sb.EmitLine(1, "{");
 
 
@@ -592,6 +594,7 @@ namespace SharpGLTF.CodeGen
 
 
             yield return string.Empty;
             yield return string.Empty;
 
 
+            yield return "/// <inheritdoc />".Indent(1);
             yield return "protected override void SerializeProperties(JsonWriter writer)".Indent(1);
             yield return "protected override void SerializeProperties(JsonWriter writer)".Indent(1);
             yield return "{".Indent(1);
             yield return "{".Indent(1);
             if (HasBaseClass) yield return "base.SerializeProperties(writer);".Indent(2);
             if (HasBaseClass) yield return "base.SerializeProperties(writer);".Indent(2);
@@ -600,6 +603,7 @@ namespace SharpGLTF.CodeGen
 
 
             yield return string.Empty;
             yield return string.Empty;
 
 
+            yield return "/// <inheritdoc />".Indent(1);
             yield return "protected override void DeserializeProperty(JsonReader reader, string property)".Indent(1);
             yield return "protected override void DeserializeProperty(JsonReader reader, string property)".Indent(1);
             yield return "{".Indent(1);
             yield return "{".Indent(1);
             yield return "switch (property)".Indent(2);
             yield return "switch (property)".Indent(2);

+ 3 - 6
build/SharpGLTF.CodeGen/SchemaReflection/SchemaTypesReader.cs

@@ -38,9 +38,7 @@ namespace SharpGLTF.SchemaReflection
         private static SchemaType _UseType(this SchemaType.Context ctx, NJsonSchema.JsonSchema4 schema, bool isRequired = true)
         private static SchemaType _UseType(this SchemaType.Context ctx, NJsonSchema.JsonSchema4 schema, bool isRequired = true)
         {
         {
             if (ctx == null) throw new ArgumentNullException(nameof(ctx));
             if (ctx == null) throw new ArgumentNullException(nameof(ctx));
-            if (schema == null) throw new ArgumentNullException(nameof(schema));
-
-            
+            if (schema == null) throw new ArgumentNullException(nameof(schema));            
 
 
             if (schema is NJsonSchema.JsonProperty prop)
             if (schema is NJsonSchema.JsonProperty prop)
             {
             {
@@ -49,7 +47,6 @@ namespace SharpGLTF.SchemaReflection
                 isRequired &= prop.IsRequired;                
                 isRequired &= prop.IsRequired;                
             }
             }
 
 
-
             if (_IsStringType(schema))
             if (_IsStringType(schema))
             {
             {
                 return ctx.UseString();
                 return ctx.UseString();
@@ -74,8 +71,6 @@ namespace SharpGLTF.SchemaReflection
 
 
             if (_IsEnumeration(schema))
             if (_IsEnumeration(schema))
             {
             {
-                
-
                 if (schema is NJsonSchema.JsonProperty property)
                 if (schema is NJsonSchema.JsonProperty property)
                 {
                 {
                     bool isNullable = !isRequired;
                     bool isNullable = !isRequired;
@@ -101,6 +96,8 @@ namespace SharpGLTF.SchemaReflection
 
 
                     var etype = ctx.UseEnum(name, isNullable);
                     var etype = ctx.UseEnum(name, isNullable);
 
 
+                    etype.Description = schema.Description;
+
                     foreach (var kvp in dict) etype.SetValue(kvp.Key, (int)kvp.Value);
                     foreach (var kvp in dict) etype.SetValue(kvp.Key, (int)kvp.Value);
 
 
                     if (dict.Values.Distinct().Count() > 1) etype.UseIntegers = true;                    
                     if (dict.Values.Distinct().Count() > 1) etype.UseIntegers = true;                    

+ 2 - 0
src/SharpGLTF.DOM/Schema2/Generated/ext.Unlit.g.cs

@@ -32,11 +32,13 @@ namespace SharpGLTF.Schema2
 	{
 	{
 	
 	
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)

+ 2 - 0
src/SharpGLTF.DOM/Schema2/Generated/ext.pbrSpecularGlossiness.g.cs

@@ -47,6 +47,7 @@ namespace SharpGLTF.Schema2
 		private TextureInfo _specularGlossinessTexture;
 		private TextureInfo _specularGlossinessTexture;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -57,6 +58,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyObject(writer, "specularGlossinessTexture", _specularGlossinessTexture);
 			SerializePropertyObject(writer, "specularGlossinessTexture", _specularGlossinessTexture);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)

+ 94 - 0
src/SharpGLTF.DOM/Schema2/Generated/gltf.g.cs

@@ -25,6 +25,9 @@ namespace SharpGLTF.Schema2
 {
 {
 	using Collections;
 	using Collections;
 
 
+	/// <summary>
+	/// The indices data type.
+	/// </summary>
 	public enum IndexType
 	public enum IndexType
 	{
 	{
 		UNSIGNED_BYTE = 5121,
 		UNSIGNED_BYTE = 5121,
@@ -33,6 +36,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// The datatype of components in the attribute.
+	/// </summary>
 	public enum ComponentType
 	public enum ComponentType
 	{
 	{
 		BYTE = 5120,
 		BYTE = 5120,
@@ -44,6 +50,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// Specifies if the attribute is a scalar, vector, or matrix.
+	/// </summary>
 	public enum ElementType
 	public enum ElementType
 	{
 	{
 		SCALAR,
 		SCALAR,
@@ -56,6 +65,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// The name of the node's TRS property to modify, or the "weights" of the Morph Targets it instantiates. For the "translation" property, the values that are provided by the sampler are the translation along the x, y, and z axes. For the "rotation" property, the values are a quaternion in the order (x, y, z, w), where w is the scalar. For the "scale" property, the values are the scaling factors along the x, y, and z axes.
+	/// </summary>
 	public enum PathType
 	public enum PathType
 	{
 	{
 		translation,
 		translation,
@@ -65,6 +77,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// Interpolation algorithm.
+	/// </summary>
 	public enum AnimationInterpolationMode
 	public enum AnimationInterpolationMode
 	{
 	{
 		LINEAR,
 		LINEAR,
@@ -73,6 +88,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// The target that the GPU buffer should be bound to.
+	/// </summary>
 	public enum BufferMode
 	public enum BufferMode
 	{
 	{
 		ARRAY_BUFFER = 34962,
 		ARRAY_BUFFER = 34962,
@@ -80,6 +98,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// Specifies if the camera uses a perspective or orthographic projection.
+	/// </summary>
 	public enum CameraType
 	public enum CameraType
 	{
 	{
 		perspective,
 		perspective,
@@ -87,6 +108,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// The alpha rendering mode of the material.
+	/// </summary>
 	public enum AlphaMode
 	public enum AlphaMode
 	{
 	{
 		OPAQUE,
 		OPAQUE,
@@ -95,6 +119,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// The type of primitives to render.
+	/// </summary>
 	public enum PrimitiveType
 	public enum PrimitiveType
 	{
 	{
 		POINTS = 0,
 		POINTS = 0,
@@ -107,6 +134,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// Magnification filter.
+	/// </summary>
 	public enum TextureInterpolationMode
 	public enum TextureInterpolationMode
 	{
 	{
 		NEAREST = 9728,
 		NEAREST = 9728,
@@ -114,6 +144,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// Minification filter.
+	/// </summary>
 	public enum TextureMipMapMode
 	public enum TextureMipMapMode
 	{
 	{
 		NEAREST = 9728,
 		NEAREST = 9728,
@@ -125,6 +158,9 @@ namespace SharpGLTF.Schema2
 	}
 	}
 
 
 
 
+	/// <summary>
+	/// t wrapping mode.
+	/// </summary>
 	public enum TextureWrapMode
 	public enum TextureWrapMode
 	{
 	{
 		CLAMP_TO_EDGE = 33071,
 		CLAMP_TO_EDGE = 33071,
@@ -139,12 +175,14 @@ namespace SharpGLTF.Schema2
 		private String _name;
 		private String _name;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
 			SerializeProperty(writer, "name", _name);
 			SerializeProperty(writer, "name", _name);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -171,6 +209,7 @@ namespace SharpGLTF.Schema2
 		private IndexType _componentType;
 		private IndexType _componentType;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -179,6 +218,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyEnumValue<IndexType>(writer, "componentType", _componentType);
 			SerializePropertyEnumValue<IndexType>(writer, "componentType", _componentType);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -205,6 +245,7 @@ namespace SharpGLTF.Schema2
 		private Int32? _byteOffset = _byteOffsetDefault;
 		private Int32? _byteOffset = _byteOffsetDefault;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -212,6 +253,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "byteOffset", _byteOffset, _byteOffsetDefault);
 			SerializeProperty(writer, "byteOffset", _byteOffset, _byteOffsetDefault);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -238,6 +280,7 @@ namespace SharpGLTF.Schema2
 		private AccessorSparseValues _values;
 		private AccessorSparseValues _values;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -246,6 +289,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyObject(writer, "values", _values);
 			SerializePropertyObject(writer, "values", _values);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -294,6 +338,7 @@ namespace SharpGLTF.Schema2
 		private AccessorSparse _sparse;
 		private AccessorSparse _sparse;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -308,6 +353,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyObject(writer, "sparse", _sparse);
 			SerializePropertyObject(writer, "sparse", _sparse);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -338,6 +384,7 @@ namespace SharpGLTF.Schema2
 		private PathType _path;
 		private PathType _path;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -345,6 +392,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyEnumSymbol<PathType>(writer, "path", _path);
 			SerializePropertyEnumSymbol<PathType>(writer, "path", _path);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -368,6 +416,7 @@ namespace SharpGLTF.Schema2
 		private AnimationChannelTarget _target;
 		private AnimationChannelTarget _target;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -375,6 +424,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyObject(writer, "target", _target);
 			SerializePropertyObject(writer, "target", _target);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -401,6 +451,7 @@ namespace SharpGLTF.Schema2
 		private Int32 _output;
 		private Int32 _output;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -409,6 +460,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "output", _output);
 			SerializeProperty(writer, "output", _output);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -435,6 +487,7 @@ namespace SharpGLTF.Schema2
 		private ChildrenCollection<AnimationSampler,Animation> _samplers;
 		private ChildrenCollection<AnimationSampler,Animation> _samplers;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -442,6 +495,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "samplers", _samplers, _samplersMinItems);
 			SerializeProperty(writer, "samplers", _samplers, _samplersMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -469,6 +523,7 @@ namespace SharpGLTF.Schema2
 		private String _minVersion;
 		private String _minVersion;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -478,6 +533,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "minVersion", _minVersion);
 			SerializeProperty(writer, "minVersion", _minVersion);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -504,6 +560,7 @@ namespace SharpGLTF.Schema2
 		private Int32 _byteLength;
 		private Int32 _byteLength;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -511,6 +568,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "byteLength", _byteLength);
 			SerializeProperty(writer, "byteLength", _byteLength);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -545,6 +603,7 @@ namespace SharpGLTF.Schema2
 		private BufferMode? _target;
 		private BufferMode? _target;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -555,6 +614,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyEnumValue<BufferMode>(writer, "target", _target);
 			SerializePropertyEnumValue<BufferMode>(writer, "target", _target);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -587,6 +647,7 @@ namespace SharpGLTF.Schema2
 		private Double _znear;
 		private Double _znear;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -596,6 +657,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "znear", _znear);
 			SerializeProperty(writer, "znear", _znear);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -629,6 +691,7 @@ namespace SharpGLTF.Schema2
 		private Double _znear;
 		private Double _znear;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -638,6 +701,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "znear", _znear);
 			SerializeProperty(writer, "znear", _znear);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -666,6 +730,7 @@ namespace SharpGLTF.Schema2
 		private CameraType _type;
 		private CameraType _type;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -674,6 +739,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyEnumSymbol<CameraType>(writer, "type", _type);
 			SerializePropertyEnumSymbol<CameraType>(writer, "type", _type);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -700,6 +766,7 @@ namespace SharpGLTF.Schema2
 		private Int32? _texCoord = _texCoordDefault;
 		private Int32? _texCoord = _texCoordDefault;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -707,6 +774,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "texCoord", _texCoord, _texCoordDefault);
 			SerializeProperty(writer, "texCoord", _texCoord, _texCoordDefault);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -743,6 +811,7 @@ namespace SharpGLTF.Schema2
 		private TextureInfo _metallicRoughnessTexture;
 		private TextureInfo _metallicRoughnessTexture;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -753,6 +822,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyObject(writer, "metallicRoughnessTexture", _metallicRoughnessTexture);
 			SerializePropertyObject(writer, "metallicRoughnessTexture", _metallicRoughnessTexture);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -775,12 +845,14 @@ namespace SharpGLTF.Schema2
 		private Double? _scale = _scaleDefault;
 		private Double? _scale = _scaleDefault;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
 			SerializeProperty(writer, "scale", _scale, _scaleDefault);
 			SerializeProperty(writer, "scale", _scale, _scaleDefault);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -801,12 +873,14 @@ namespace SharpGLTF.Schema2
 		private Double? _strength = _strengthDefault;
 		private Double? _strength = _strengthDefault;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
 			SerializeProperty(writer, "strength", _strength, _strengthDefault);
 			SerializeProperty(writer, "strength", _strength, _strengthDefault);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -846,6 +920,7 @@ namespace SharpGLTF.Schema2
 		private Boolean? _doubleSided = _doubleSidedDefault;
 		private Boolean? _doubleSided = _doubleSidedDefault;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -859,6 +934,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "doubleSided", _doubleSided, _doubleSidedDefault);
 			SerializeProperty(writer, "doubleSided", _doubleSided, _doubleSidedDefault);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -896,6 +972,7 @@ namespace SharpGLTF.Schema2
 		private List<Dictionary<String,Int32>> _targets;
 		private List<Dictionary<String,Int32>> _targets;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -906,6 +983,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "targets", _targets, _targetsMinItems);
 			SerializeProperty(writer, "targets", _targets, _targetsMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -936,6 +1014,7 @@ namespace SharpGLTF.Schema2
 		private List<Double> _weights;
 		private List<Double> _weights;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -943,6 +1022,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "weights", _weights, _weightsMinItems);
 			SerializeProperty(writer, "weights", _weights, _weightsMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -984,6 +1064,7 @@ namespace SharpGLTF.Schema2
 		private List<Double> _weights;
 		private List<Double> _weights;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -998,6 +1079,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "weights", _weights, _weightsMinItems);
 			SerializeProperty(writer, "weights", _weights, _weightsMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -1034,6 +1116,7 @@ namespace SharpGLTF.Schema2
 		private TextureWrapMode? _wrapT = _wrapTDefault;
 		private TextureWrapMode? _wrapT = _wrapTDefault;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -1043,6 +1126,7 @@ namespace SharpGLTF.Schema2
 			SerializePropertyEnumValue<TextureWrapMode>(writer, "wrapT", _wrapT, _wrapTDefault);
 			SerializePropertyEnumValue<TextureWrapMode>(writer, "wrapT", _wrapT, _wrapTDefault);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -1067,12 +1151,14 @@ namespace SharpGLTF.Schema2
 		private List<Int32> _nodes;
 		private List<Int32> _nodes;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
 			SerializeProperty(writer, "nodes", _nodes, _nodesMinItems);
 			SerializeProperty(writer, "nodes", _nodes, _nodesMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -1098,6 +1184,7 @@ namespace SharpGLTF.Schema2
 		private List<Int32> _joints;
 		private List<Int32> _joints;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -1106,6 +1193,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "joints", _joints, _jointsMinItems);
 			SerializeProperty(writer, "joints", _joints, _jointsMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -1130,6 +1218,7 @@ namespace SharpGLTF.Schema2
 		private Int32? _source;
 		private Int32? _source;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -1137,6 +1226,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "source", _source);
 			SerializeProperty(writer, "source", _source);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -1205,6 +1295,7 @@ namespace SharpGLTF.Schema2
 		private ChildrenCollection<Texture,ModelRoot> _textures;
 		private ChildrenCollection<Texture,ModelRoot> _textures;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -1227,6 +1318,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "textures", _textures, _texturesMinItems);
 			SerializeProperty(writer, "textures", _textures, _texturesMinItems);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)
@@ -1267,6 +1359,7 @@ namespace SharpGLTF.Schema2
 		private Int32? _bufferView;
 		private Int32? _bufferView;
 		
 		
 	
 	
+		/// <inheritdoc />
 		protected override void SerializeProperties(JsonWriter writer)
 		protected override void SerializeProperties(JsonWriter writer)
 		{
 		{
 			base.SerializeProperties(writer);
 			base.SerializeProperties(writer);
@@ -1275,6 +1368,7 @@ namespace SharpGLTF.Schema2
 			SerializeProperty(writer, "bufferView", _bufferView);
 			SerializeProperty(writer, "bufferView", _bufferView);
 		}
 		}
 	
 	
+		/// <inheritdoc />
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		protected override void DeserializeProperty(JsonReader reader, string property)
 		{
 		{
 			switch (property)
 			switch (property)

+ 14 - 6
src/SharpGLTF.DOM/Schema2/glb.Images.cs

@@ -27,7 +27,16 @@ namespace SharpGLTF.Schema2
 
 
         #region data
         #region data
 
 
-        // this is the actual compressed image in PNG or JPEG, -NOT- the pixels data.
+        /// <summary>
+        /// this is the not a raw bitmap, but tha actual compressed image in PNG or JPEG.
+        /// </summary>
+        /// <remarks>
+        /// When a model is loaded, the image file is loaded into memory and assigned to this
+        /// field, and the <see cref="Image._uri"/> is nullified.
+        /// When writing a gltf file with external images, the <see cref="Image._uri"/> is
+        /// briefly reassigned so the JSON can be serialized correctly.
+        /// After serialization <see cref="Image._uri"/> is set back to null.
+        /// </remarks>
         private Byte[] _ExternalImageContent;
         private Byte[] _ExternalImageContent;
 
 
         #endregion
         #endregion
@@ -100,13 +109,12 @@ namespace SharpGLTF.Schema2
         {
         {
             if (this._ExternalImageContent == null) return;
             if (this._ExternalImageContent == null) return;
 
 
-            var data = new ArraySegment<Byte>(this._ExternalImageContent);
-
-            var bv = this.LogicalParent.UseBufferView(data);
+            // transfer the external image content to a buffer.
+            this._bufferView = this.LogicalParent
+                .UseBufferView(this._ExternalImageContent)
+                .LogicalIndex;
 
 
             this._uri = null;
             this._uri = null;
-            this._bufferView = bv.LogicalIndex;
-
             this._ExternalImageContent = null;
             this._ExternalImageContent = null;
         }
         }
 
 

+ 4 - 5
src/SharpGLTF.DOM/Schema2/glb.cs

@@ -124,11 +124,10 @@ namespace SharpGLTF.Schema2
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Writes a <code>Schema.Gltf</code> model to a writable binary writer
+        /// Writes a <see cref="ROOT"/> instance into a <see cref="BinaryWriter"/>.
         /// </summary>
         /// </summary>
-        /// <param name="model"><code>Schema.Gltf</code> model</param>
-        /// <param name="buffer">Binary buffer to embed in the file, or null</param>
-        /// <param name="binaryWriter">Binary Writer</param>
+        /// <param name="binaryWriter">The destination <see cref="BinaryWriter"/> stream.</param>
+        /// <param name="model">The source <see cref="ROOT"/> instance.</param>
         public static void WriteBinaryModel(this BinaryWriter binaryWriter, ROOT model)
         public static void WriteBinaryModel(this BinaryWriter binaryWriter, ROOT model)
         {
         {
             var ex = IsBinaryCompatible(model); if (ex != null) throw ex;
             var ex = IsBinaryCompatible(model); if (ex != null) throw ex;
@@ -137,7 +136,7 @@ namespace SharpGLTF.Schema2
             var jsonChunk = Encoding.UTF8.GetBytes(jsonText);
             var jsonChunk = Encoding.UTF8.GetBytes(jsonText);
             var jsonPadding = jsonChunk.Length & 3; if (jsonPadding != 0) jsonPadding = 4 - jsonPadding;
             var jsonPadding = jsonChunk.Length & 3; if (jsonPadding != 0) jsonPadding = 4 - jsonPadding;
 
 
-            var buffer = model.LogicalBuffers.Count > 0 ? model.LogicalBuffers[0]._Content : null;
+            var buffer = model.LogicalBuffers.Count > 0 ? model.LogicalBuffers[0].Content : null;
             if (buffer != null && buffer.Length == 0) buffer = null;
             if (buffer != null && buffer.Length == 0) buffer = null;
 
 
             var binPadding = buffer == null ? 0 : buffer.Length & 3; if (binPadding != 0) binPadding = 4 - binPadding;
             var binPadding = buffer == null ? 0 : buffer.Length & 3; if (binPadding != 0) binPadding = 4 - binPadding;

+ 11 - 1
src/SharpGLTF.DOM/Schema2/gltf.Animations.cs

@@ -180,13 +180,23 @@ namespace SharpGLTF.Schema2
 
 
         #region properties
         #region properties
 
 
+        /// <summary>
+        /// Gets the <see cref="Animation"/> instance that owns this <see cref="AnimationSampler"/> instance.
+        /// </summary>
         public Animation LogicalParent { get; private set; }
         public Animation LogicalParent { get; private set; }
 
 
+        /// <summary>
+        /// Gets the zero-based index of this <see cref="AnimationSampler"/> at <see cref="Animation._samplers"/>.
+        /// </summary>
         public int LogicalIndex => LogicalParent._Samplers.IndexOfReference(this);
         public int LogicalIndex => LogicalParent._Samplers.IndexOfReference(this);
 
 
         void IChildOf<Animation>._SetLogicalParent(Animation parent) { LogicalParent = parent; }
         void IChildOf<Animation>._SetLogicalParent(Animation parent) { LogicalParent = parent; }
 
 
-        public AnimationInterpolationMode Mode => _interpolation ?? _interpolationDefault;
+        public AnimationInterpolationMode Mode
+        {
+            get => _interpolation.AsValue(_interpolationDefault);
+            set => _interpolation = value.AsNullable(_interpolationDefault);
+        }
 
 
         public Accessor Input => this.LogicalParent.LogicalParent.LogicalAccessors[this._input];
         public Accessor Input => this.LogicalParent.LogicalParent.LogicalAccessors[this._input];
 
 

+ 10 - 10
src/SharpGLTF.DOM/Schema2/gltf.Buffer.cs

@@ -14,6 +14,11 @@ namespace SharpGLTF.Schema2
 
 
         internal Buffer() { }
         internal Buffer() { }
 
 
+        internal Buffer(Byte[] content)
+        {
+            _Content = content;
+        }
+
         #endregion
         #endregion
 
 
         #region non serializable data
         #region non serializable data
@@ -21,7 +26,7 @@ namespace SharpGLTF.Schema2
         /// <summary>
         /// <summary>
         /// Immediately after deserialization, binary buffer is loaded/parsed and stored here
         /// Immediately after deserialization, binary buffer is loaded/parsed and stored here
         /// </summary>
         /// </summary>
-        internal Byte[] _Content;
+        private Byte[] _Content;
 
 
         #endregion
         #endregion
 
 
@@ -92,8 +97,7 @@ namespace SharpGLTF.Schema2
         /// <returns>A <see cref="Buffer"/> instance.</returns>
         /// <returns>A <see cref="Buffer"/> instance.</returns>
         public Buffer CreateBuffer(int byteCount)
         public Buffer CreateBuffer(int byteCount)
         {
         {
-            var buffer = new Buffer();
-            buffer._Content = new byte[byteCount];
+            var buffer = new Buffer(new byte[byteCount]);
 
 
             _buffers.Add(buffer);
             _buffers.Add(buffer);
 
 
@@ -112,11 +116,10 @@ namespace SharpGLTF.Schema2
 
 
             foreach (var b in this.LogicalBuffers)
             foreach (var b in this.LogicalBuffers)
             {
             {
-                if (b._Content == content) return b;
+                if (b.Content == content) return b;
             }
             }
 
 
-            var buffer = new Buffer();
-            buffer._Content = content;
+            var buffer = new Buffer(content);
 
 
             _buffers.Add(buffer);
             _buffers.Add(buffer);
 
 
@@ -145,10 +148,7 @@ namespace SharpGLTF.Schema2
 
 
             this._buffers.Clear();
             this._buffers.Clear();
 
 
-            var b = new Buffer
-            {
-                _Content = sbbuilder.ToArray()
-            };
+            var b = new Buffer(sbbuilder.ToArray());
 
 
             this._buffers.Add(b);
             this._buffers.Add(b);
         }
         }

+ 5 - 5
src/SharpGLTF.DOM/Schema2/gltf.BufferView.cs

@@ -20,10 +20,10 @@ namespace SharpGLTF.Schema2
         internal BufferView(Buffer buffer, int byteOffset, int? byteLength, int byteStride, BufferMode? target)
         internal BufferView(Buffer buffer, int byteOffset, int? byteLength, int byteStride, BufferMode? target)
         {
         {
             Guard.NotNull(buffer, nameof(buffer));
             Guard.NotNull(buffer, nameof(buffer));
-            Guard.NotNull(buffer._Content, nameof(buffer));
+            Guard.NotNull(buffer.Content, nameof(buffer));
             Guard.NotNull(buffer.LogicalParent, nameof(buffer));
             Guard.NotNull(buffer.LogicalParent, nameof(buffer));
 
 
-            byteLength = byteLength.AsValue(buffer._Content.Length - byteOffset);
+            byteLength = byteLength.AsValue(buffer.Content.Length - byteOffset);
 
 
             Guard.MustBeGreaterThanOrEqualTo(byteLength.AsValue(0), _byteLengthMinimum, nameof(byteLength));
             Guard.MustBeGreaterThanOrEqualTo(byteLength.AsValue(0), _byteLengthMinimum, nameof(byteLength));
             Guard.MustBeGreaterThanOrEqualTo(byteOffset, _byteOffsetMinimum, nameof(byteOffset));
             Guard.MustBeGreaterThanOrEqualTo(byteOffset, _byteOffsetMinimum, nameof(byteOffset));
@@ -42,7 +42,7 @@ namespace SharpGLTF.Schema2
 
 
             this._buffer = buffer.LogicalIndex;
             this._buffer = buffer.LogicalIndex;
 
 
-            this._byteLength = byteLength.AsValue(buffer._Content.Length);
+            this._byteLength = byteLength.AsValue(buffer.Content.Length);
 
 
             this._byteOffset = byteOffset.AsNullable(_byteOffsetDefault, _byteOffsetMinimum, int.MaxValue);
             this._byteOffset = byteOffset.AsNullable(_byteOffsetDefault, _byteOffsetMinimum, int.MaxValue);
             this._byteStride = byteStride.AsNullable(0, _byteStrideMinimum, _byteStrideMaximum);
             this._byteStride = byteStride.AsNullable(0, _byteStrideMinimum, _byteStrideMaximum);
@@ -68,7 +68,7 @@ namespace SharpGLTF.Schema2
             get
             get
             {
             {
                 var buffer = this.LogicalParent.LogicalBuffers[this._buffer];
                 var buffer = this.LogicalParent.LogicalBuffers[this._buffer];
-                return new BYTES(buffer._Content, this._byteOffset.AsValue(0), this._byteLength);
+                return new BYTES(buffer.Content, this._byteOffset.AsValue(0), this._byteLength);
             }
             }
         }
         }
 
 
@@ -92,7 +92,7 @@ namespace SharpGLTF.Schema2
         internal void _ConvertToStaticBuffer(_StaticBufferBuilder targetBuffer)
         internal void _ConvertToStaticBuffer(_StaticBufferBuilder targetBuffer)
         {
         {
             // retrieve old buffer
             // retrieve old buffer
-            var srcBuf = this.LogicalParent.LogicalBuffers[this._buffer]._Content;
+            var srcBuf = this.LogicalParent.LogicalBuffers[this._buffer].Content;
             var data = new Byte[this._byteLength];
             var data = new Byte[this._byteLength];
             Array.Copy(srcBuf, this._byteOffset ?? 0, data, 0, this._byteLength);
             Array.Copy(srcBuf, this._byteOffset ?? 0, data, 0, this._byteLength);
 
 

+ 9 - 0
src/SharpGLTF.DOM/Schema2/gltf.Property.cs

@@ -60,6 +60,10 @@ namespace SharpGLTF.Schema2
 
 
         #region serialization API
         #region serialization API
 
 
+        /// <summary>
+        /// Writes the properties of the current instance to a <see cref="JsonWriter"/>.
+        /// </summary>
+        /// <param name="writer">The target writer.</param>
         protected override void SerializeProperties(JsonWriter writer)
         protected override void SerializeProperties(JsonWriter writer)
         {
         {
             SerializeProperty(writer, "extensions", _extensions);
             SerializeProperty(writer, "extensions", _extensions);
@@ -67,6 +71,11 @@ namespace SharpGLTF.Schema2
             // SerializeProperty(writer, "extras", _extras);
             // SerializeProperty(writer, "extras", _extras);
         }
         }
 
 
+        /// <summary>
+        /// Reads the properties of the current instance from a <see cref="JsonReader"/>.
+        /// </summary>
+        /// <param name="reader">The source reader.</param>
+        /// <param name="property">The name of the property.</param>
         protected override void DeserializeProperty(JsonReader reader, string property)
         protected override void DeserializeProperty(JsonReader reader, string property)
         {
         {
             switch (property)
             switch (property)

+ 1 - 1
src/SharpGLTF.DOM/SharpGLTF.csproj

@@ -8,7 +8,7 @@
     <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>
     <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>
     <RepositoryType>git</RepositoryType>
     <RepositoryType>git</RepositoryType>
     <Authors>Vicente Penades</Authors>
     <Authors>Vicente Penades</Authors>
-    <Description>SharpGLTF is a c# library for reading and writing glTF2 3D models</Description>
+    <Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>
     <Copyright>Copyright (c) 2019 Vicente Penades</Copyright>
     <Copyright>Copyright (c) 2019 Vicente Penades</Copyright>
     <PackageTags>C# glTF 3D</PackageTags>
     <PackageTags>C# glTF 3D</PackageTags>
     <Version>1.0.0-alpha0004</Version>
     <Version>1.0.0-alpha0004</Version>

+ 2 - 2
src/SharpGLTF.DOM/_Extensions.cs

@@ -219,9 +219,9 @@ namespace SharpGLTF
             return string.IsNullOrWhiteSpace(name) ? null : name;
             return string.IsNullOrWhiteSpace(name) ? null : name;
         }
         }
 
 
-        internal static void AddRange<Tin,Tout>(this IList<Tout> dst, IEnumerable<Tin> src, Func<Tin,Tout> cvt)
+        internal static void AddRange<Tin, Tout>(this IList<Tout> dst, IEnumerable<Tin> src, Func<Tin, Tout> cvt)
         {
         {
-            foreach(var item in src)
+            foreach (var item in src)
             {
             {
                 dst.Add(cvt(item));
                 dst.Add(cvt(item));
             }
             }

+ 3 - 1
tests/SharpGLTF.Tests/Schema2/Authoring/CreateModelTests.cs

@@ -65,7 +65,9 @@ namespace SharpGLTF.Schema2.Authoring
             primitive.DrawPrimitiveType = PrimitiveType.TRIANGLES;
             primitive.DrawPrimitiveType = PrimitiveType.TRIANGLES;
             primitive.SetVertexAccessor("POSITION", positionsAccessor);
             primitive.SetVertexAccessor("POSITION", positionsAccessor);
             primitive.IndexAccessor = indicesAccessor;
             primitive.IndexAccessor = indicesAccessor;
-            
+            primitive.Material = model.CreateMaterial("Default").WithDefault(new Vector4(0, 1, 0, 1));
+            primitive.Material.DoubleSided = true;
+
             model.AttachToCurrentTest("result.glb");
             model.AttachToCurrentTest("result.glb");
             model.AttachToCurrentTest("result.gltf");
             model.AttachToCurrentTest("result.gltf");
         }
         }

+ 13 - 3
tests/SharpGLTF.Tests/Schema2/LoadAndSave/LoadModelTests.cs

@@ -22,13 +22,17 @@ namespace SharpGLTF.Schema2.LoadAndSave
         #region testing models of https://github.com/bghgary/glTF-Asset-Generator.git
         #region testing models of https://github.com/bghgary/glTF-Asset-Generator.git
 
 
         [Test]
         [Test]
-        public void TestLoadGeneratedModels()
+        public void TestLoadReferenceModels()
         {
         {
+            TestContext.CurrentContext.AttachShowDirLink();
+
             foreach (var f in TestFiles.GetGeneratedFilePaths())
             foreach (var f in TestFiles.GetGeneratedFilePaths())
             {
             {
                 var model = GltfUtils.LoadModel(f);
                 var model = GltfUtils.LoadModel(f);
 
 
                 Assert.NotNull(model);
                 Assert.NotNull(model);
+
+                model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".obj"));
             }
             }
         }
         }
         
         
@@ -68,13 +72,19 @@ namespace SharpGLTF.Schema2.LoadAndSave
 
 
         #region testing models of https://github.com/KhronosGroup/glTF-Sample-Models.git
         #region testing models of https://github.com/KhronosGroup/glTF-Sample-Models.git
 
 
-        [Test]
-        public void TestLoadSampleModels()
+        [TestCase("\\glTF\\")]
+        // [TestCase("\\glTF-Draco\\")] // Not supported
+        [TestCase("\\glTF-Binary\\")]
+        [TestCase("\\glTF-Embedded\\")]
+        [TestCase("\\glTF-pbrSpecularGlossiness\\")]
+        public void TestLoadSampleModels(string section)
         {
         {
             TestContext.CurrentContext.AttachShowDirLink();
             TestContext.CurrentContext.AttachShowDirLink();
 
 
             foreach (var f in TestFiles.GetSampleFilePaths())
             foreach (var f in TestFiles.GetSampleFilePaths())
             {
             {
+                if (!f.Contains(section)) continue;
+
                 var model = GltfUtils.LoadModel(f);
                 var model = GltfUtils.LoadModel(f);
                 Assert.NotNull(model);
                 Assert.NotNull(model);
 
 

+ 1 - 1
tests/SharpGLTF.Tests/SharpGLTF.Tests.csproj

@@ -12,7 +12,7 @@
     <PackageReference Include="LibGit2Sharp" Version="0.26.0" />
     <PackageReference Include="LibGit2Sharp" Version="0.26.0" />
     <PackageReference Include="nunit" Version="3.11.0" />
     <PackageReference Include="nunit" Version="3.11.0" />
     <PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
     <PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />    
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0" />    
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>