Browse Source

Moved Agi extensions outside code library.

vpenades 2 years ago
parent
commit
366ee1aee9

+ 8 - 1
SharpGLTF.sln

@@ -58,7 +58,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Runtime.Tests", "
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Cesium", "src\SharpGLTF.Cesium\SharpGLTF.Cesium.csproj", "{9FA2AFB3-B150-428D-9D6C-48F60010FFF3}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpGLTF.Cesium.Tests", "tests\SharpGLTF.Cesium.Tests\SharpGLTF.Cesium.Tests.csproj", "{94011062-791E-4D34-ACA8-09AAAD49B299}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Cesium.Tests", "tests\SharpGLTF.Cesium.Tests\SharpGLTF.Cesium.Tests.csproj", "{94011062-791E-4D34-ACA8-09AAAD49B299}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpGLTF.Agi", "src\SharpGLTF.Agi\SharpGLTF.Agi.csproj", "{6BEBBB6A-932F-4AF2-B1D9-3B533BE2C8F3}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -138,6 +140,10 @@ Global
 		{94011062-791E-4D34-ACA8-09AAAD49B299}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{94011062-791E-4D34-ACA8-09AAAD49B299}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{94011062-791E-4D34-ACA8-09AAAD49B299}.Release|Any CPU.Build.0 = Release|Any CPU
+		{6BEBBB6A-932F-4AF2-B1D9-3B533BE2C8F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6BEBBB6A-932F-4AF2-B1D9-3B533BE2C8F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6BEBBB6A-932F-4AF2-B1D9-3B533BE2C8F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6BEBBB6A-932F-4AF2-B1D9-3B533BE2C8F3}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -161,6 +167,7 @@ Global
 		{3925E45C-E7AA-4396-9567-4D8B1D1EF1C6} = {0CBF510D-D836-40BA-95EC-E93FDBB90632}
 		{9FA2AFB3-B150-428D-9D6C-48F60010FFF3} = {072B725F-773F-4751-9616-E9778897C1D2}
 		{94011062-791E-4D34-ACA8-09AAAD49B299} = {0CBF510D-D836-40BA-95EC-E93FDBB90632}
+		{6BEBBB6A-932F-4AF2-B1D9-3B533BE2C8F3} = {072B725F-773F-4751-9616-E9778897C1D2}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {1D7BBAD9-834C-4981-AC96-0AA5226FC43F}

+ 3 - 0
build/SharpGLTF.CodeGen/Constants.cs

@@ -62,6 +62,9 @@ namespace SharpGLTF
 
         public static string CesiumProjectDirectory => "src\\SharpGLTF.Cesium\\Schema2\\Generated";
 
+        public static string AgiProjectDirectory => "src\\SharpGLTF.Agi\\Schema2\\Generated";
+
+
         /// <summary>
         /// namespace of the emitted generated code
         /// </summary>

+ 1 - 0
build/SharpGLTF.CodeGen/Ext.AGI_Articulations.cs

@@ -8,6 +8,7 @@ namespace SharpGLTF
 {
     class AgiArticulationsExtension : SchemaProcessor
     {
+        public override string GetTargetProject() { return Constants.AgiProjectDirectory; }
         private static string RootSchemaUri => Constants.VendorExtensionPath("AGI_articulations", "glTF.AGI_articulations.schema.json");
         private static string NodeSchemaUri => Constants.VendorExtensionPath("AGI_articulations", "node.AGI_articulations.schema.json");
 

+ 1 - 0
build/SharpGLTF.CodeGen/Ext.AGI_RootStkMetadata.cs

@@ -8,6 +8,7 @@ namespace SharpGLTF
 {
     class AgiStkMetadataExtension : SchemaProcessor
     {
+        public override string GetTargetProject() { return Constants.AgiProjectDirectory; }
         private static string RootSchemaUri => Constants.VendorExtensionPath("AGI_stk_metadata", "glTF.AGI_stk_metadata.schema.json");
         private static string NodeSchemaUri => Constants.VendorExtensionPath("AGI_stk_metadata", "node.AGI_stk_metadata.schema.json");
 

+ 28 - 0
src/SharpGLTF.Agi/SharpGLTF.Agi.csproj

@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
+    <AssemblyName>SharpGLTF.Agi</AssemblyName>
+    <RootNamespace>SharpGLTF</RootNamespace>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <Description>
+      Provides additional extensions support for SharpGLTF:
+      - AGI_articulations
+      - AGI_stk_metadata
+    </Description>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Include="..\Shared\Guard.cs" Link="Diagnostics\Guard.cs" />
+    <Compile Include="..\Shared\_Extensions.cs" Link="_Extensions.cs" />
+    <Compile Include="..\SharpGLTF.Core\Schema2\_Extensions.cs" Link="Schema2\_Extensions.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\SharpGLTF.Core\SharpGLTF.Core.csproj" />
+  </ItemGroup>  
+
+</Project>

+ 29 - 0
src/SharpGLTF.Agi/schema2/AgiExtensions.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace SharpGLTF.Schema2
+{
+    /// <summary>
+    /// Extension methods for AGI glTF Extensions
+    /// </summary>
+    public static partial class AGIExtensions
+    {
+        private static bool _AgiRegistered;
+
+        /// <summary>
+        /// This method most be called once at application's startup to register the extensions.
+        /// </summary>
+        public static void RegisterExtensions()
+        {
+            if (_AgiRegistered) return;
+
+            _AgiRegistered = true;
+
+            ExtensionsFactory.RegisterExtension<ModelRoot, AgiRootArticulations>("AGI_articulations");
+            ExtensionsFactory.RegisterExtension<ModelRoot, AgiRootStkMetadata>("AGI_stk_metadata");
+            ExtensionsFactory.RegisterExtension<Node, AgiNodeArticulations>("AGI_articulations");
+            ExtensionsFactory.RegisterExtension<Node, AgiNodeStkMetadata>("AGI_stk_metadata");
+        }
+    }
+}

+ 1 - 1
src/SharpGLTF.Core/Schema2/agi.Articulations.cs → src/SharpGLTF.Agi/schema2/agi.Articulations.cs

@@ -6,7 +6,7 @@ using System.Linq;
 using SharpGLTF.Collections;
 
 namespace SharpGLTF.Schema2
-{
+{    
     public sealed partial class AgiRootArticulations
     {
         internal AgiRootArticulations(ModelRoot root)

+ 0 - 0
src/SharpGLTF.Core/Schema2/agi.StkMetadata.cs → src/SharpGLTF.Agi/schema2/agi.StkMetadata.cs


+ 64 - 64
src/SharpGLTF.Core/Schema2/Generated/ext.AgiNodeArticulations.g.cs → src/SharpGLTF.Agi/schema2/generated/ext.AgiNodeArticulations.g.cs

@@ -1,64 +1,64 @@
-// <auto-generated/>
-
-//------------------------------------------------------------------------------------------------
-//      This file has been programatically generated; DON´T EDIT!
-//------------------------------------------------------------------------------------------------
-
-#pragma warning disable SA1001
-#pragma warning disable SA1027
-#pragma warning disable SA1028
-#pragma warning disable SA1121
-#pragma warning disable SA1205
-#pragma warning disable SA1309
-#pragma warning disable SA1402
-#pragma warning disable SA1505
-#pragma warning disable SA1507
-#pragma warning disable SA1508
-#pragma warning disable SA1652
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Numerics;
-using System.Text.Json;
-
-namespace SharpGLTF.Schema2
-{
-	using Collections;
-
-	/// <summary>
-	/// glTF Extension for an individual node in a glTF model, to associate it with the model's root AGI_articulations object.
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiNodeArticulations : ExtraProperties
-	{
-	
-		private String _articulationName;
-		
-		private Boolean? _isAttachPoint;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "articulationName", _articulationName);
-			SerializeProperty(writer, "isAttachPoint", _isAttachPoint);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "articulationName": _articulationName = DeserializePropertyValue<String>(ref reader); break;
-				case "isAttachPoint": _isAttachPoint = DeserializePropertyValue<Boolean?>(ref reader); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-}
+// <auto-generated/>
+
+//------------------------------------------------------------------------------------------------
+//      This file has been programatically generated; DON´T EDIT!
+//------------------------------------------------------------------------------------------------
+
+#pragma warning disable SA1001
+#pragma warning disable SA1027
+#pragma warning disable SA1028
+#pragma warning disable SA1121
+#pragma warning disable SA1205
+#pragma warning disable SA1309
+#pragma warning disable SA1402
+#pragma warning disable SA1505
+#pragma warning disable SA1507
+#pragma warning disable SA1508
+#pragma warning disable SA1652
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Numerics;
+using System.Text.Json;
+
+namespace SharpGLTF.Schema2
+{
+	using Collections;
+
+	/// <summary>
+	/// glTF Extension for an individual node in a glTF model, to associate it with the model's root AGI_articulations object.
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiNodeArticulations : ExtraProperties
+	{
+	
+		private String _articulationName;
+		
+		private Boolean? _isAttachPoint;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "articulationName", _articulationName);
+			SerializeProperty(writer, "isAttachPoint", _isAttachPoint);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "articulationName": _articulationName = DeserializePropertyValue<String>(ref reader); break;
+				case "isAttachPoint": _isAttachPoint = DeserializePropertyValue<Boolean?>(ref reader); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+}

+ 64 - 64
src/SharpGLTF.Core/Schema2/Generated/ext.AgiNodeStkMetadata.g.cs → src/SharpGLTF.Agi/schema2/generated/ext.AgiNodeStkMetadata.g.cs

@@ -1,64 +1,64 @@
-// <auto-generated/>
-
-//------------------------------------------------------------------------------------------------
-//      This file has been programatically generated; DON´T EDIT!
-//------------------------------------------------------------------------------------------------
-
-#pragma warning disable SA1001
-#pragma warning disable SA1027
-#pragma warning disable SA1028
-#pragma warning disable SA1121
-#pragma warning disable SA1205
-#pragma warning disable SA1309
-#pragma warning disable SA1402
-#pragma warning disable SA1505
-#pragma warning disable SA1507
-#pragma warning disable SA1508
-#pragma warning disable SA1652
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Numerics;
-using System.Text.Json;
-
-namespace SharpGLTF.Schema2
-{
-	using Collections;
-
-	/// <summary>
-	/// glTF Extension for an individual node in a glTF model, to associate it with the model's root AGI_stk_metadata object.
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiNodeStkMetadata : ExtraProperties
-	{
-	
-		private Boolean? _noObscuration;
-		
-		private String _solarPanelGroupName;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "noObscuration", _noObscuration);
-			SerializeProperty(writer, "solarPanelGroupName", _solarPanelGroupName);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "noObscuration": _noObscuration = DeserializePropertyValue<Boolean?>(ref reader); break;
-				case "solarPanelGroupName": _solarPanelGroupName = DeserializePropertyValue<String>(ref reader); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-}
+// <auto-generated/>
+
+//------------------------------------------------------------------------------------------------
+//      This file has been programatically generated; DON´T EDIT!
+//------------------------------------------------------------------------------------------------
+
+#pragma warning disable SA1001
+#pragma warning disable SA1027
+#pragma warning disable SA1028
+#pragma warning disable SA1121
+#pragma warning disable SA1205
+#pragma warning disable SA1309
+#pragma warning disable SA1402
+#pragma warning disable SA1505
+#pragma warning disable SA1507
+#pragma warning disable SA1508
+#pragma warning disable SA1652
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Numerics;
+using System.Text.Json;
+
+namespace SharpGLTF.Schema2
+{
+	using Collections;
+
+	/// <summary>
+	/// glTF Extension for an individual node in a glTF model, to associate it with the model's root AGI_stk_metadata object.
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiNodeStkMetadata : ExtraProperties
+	{
+	
+		private Boolean? _noObscuration;
+		
+		private String _solarPanelGroupName;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "noObscuration", _noObscuration);
+			SerializeProperty(writer, "solarPanelGroupName", _solarPanelGroupName);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "noObscuration": _noObscuration = DeserializePropertyValue<Boolean?>(ref reader); break;
+				case "solarPanelGroupName": _solarPanelGroupName = DeserializePropertyValue<String>(ref reader); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+}

+ 164 - 164
src/SharpGLTF.Core/Schema2/Generated/ext.AgiRootArticulations.g.cs → src/SharpGLTF.Agi/schema2/generated/ext.AgiRootArticulations.g.cs

@@ -1,164 +1,164 @@
-// <auto-generated/>
-
-//------------------------------------------------------------------------------------------------
-//      This file has been programatically generated; DON´T EDIT!
-//------------------------------------------------------------------------------------------------
-
-#pragma warning disable SA1001
-#pragma warning disable SA1027
-#pragma warning disable SA1028
-#pragma warning disable SA1121
-#pragma warning disable SA1205
-#pragma warning disable SA1309
-#pragma warning disable SA1402
-#pragma warning disable SA1505
-#pragma warning disable SA1507
-#pragma warning disable SA1508
-#pragma warning disable SA1652
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Numerics;
-using System.Text.Json;
-
-namespace SharpGLTF.Schema2
-{
-	using Collections;
-
-	/// <summary>
-	/// The type of motion applied by this articulation stage.
-	/// </summary>
-	public enum AgiArticulationTransformType
-	{
-		xTranslate,
-		yTranslate,
-		zTranslate,
-		xRotate,
-		yRotate,
-		zRotate,
-		xScale,
-		yScale,
-		zScale,
-		uniformScale,
-	}
-
-
-	/// <summary>
-	/// One stage of a model articulation definition.
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiArticulationStage : ExtraProperties
-	{
-	
-		private Double _initialValue;
-		
-		private Double _maximumValue;
-		
-		private Double _minimumValue;
-		
-		private String _name;
-		
-		private AgiArticulationTransformType _type;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "initialValue", _initialValue);
-			SerializeProperty(writer, "maximumValue", _maximumValue);
-			SerializeProperty(writer, "minimumValue", _minimumValue);
-			SerializeProperty(writer, "name", _name);
-			SerializePropertyEnumSymbol<AgiArticulationTransformType>(writer, "type", _type);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "initialValue": _initialValue = DeserializePropertyValue<Double>(ref reader); break;
-				case "maximumValue": _maximumValue = DeserializePropertyValue<Double>(ref reader); break;
-				case "minimumValue": _minimumValue = DeserializePropertyValue<Double>(ref reader); break;
-				case "name": _name = DeserializePropertyValue<String>(ref reader); break;
-				case "type": _type = DeserializePropertyValue<AgiArticulationTransformType>(ref reader); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-	/// <summary>
-	/// A model articulation definition.
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiArticulation : ExtraProperties
-	{
-	
-		private String _name;
-		
-		private Vector3? _pointingVector;
-		
-		private const int _stagesMinItems = 1;
-		private ChildrenList<AgiArticulationStage,AgiArticulation> _stages;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "name", _name);
-			SerializeProperty(writer, "pointingVector", _pointingVector);
-			SerializeProperty(writer, "stages", _stages, _stagesMinItems);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "name": _name = DeserializePropertyValue<String>(ref reader); break;
-				case "pointingVector": _pointingVector = DeserializePropertyValue<Vector3?>(ref reader); break;
-				case "stages": DeserializePropertyList<AgiArticulationStage>(ref reader, _stages); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-	/// <summary>
-	/// glTF Extension that defines metadata for applying external analysis or effects to a model.
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiRootArticulations : ExtraProperties
-	{
-	
-		private const int _articulationsMinItems = 1;
-		private ChildrenList<AgiArticulation,AgiRootArticulations> _articulations;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "articulations", _articulations, _articulationsMinItems);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "articulations": DeserializePropertyList<AgiArticulation>(ref reader, _articulations); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-}
+// <auto-generated/>
+
+//------------------------------------------------------------------------------------------------
+//      This file has been programatically generated; DON´T EDIT!
+//------------------------------------------------------------------------------------------------
+
+#pragma warning disable SA1001
+#pragma warning disable SA1027
+#pragma warning disable SA1028
+#pragma warning disable SA1121
+#pragma warning disable SA1205
+#pragma warning disable SA1309
+#pragma warning disable SA1402
+#pragma warning disable SA1505
+#pragma warning disable SA1507
+#pragma warning disable SA1508
+#pragma warning disable SA1652
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Numerics;
+using System.Text.Json;
+
+namespace SharpGLTF.Schema2
+{
+	using Collections;
+
+	/// <summary>
+	/// The type of motion applied by this articulation stage.
+	/// </summary>
+	public enum AgiArticulationTransformType
+	{
+		xTranslate,
+		yTranslate,
+		zTranslate,
+		xRotate,
+		yRotate,
+		zRotate,
+		xScale,
+		yScale,
+		zScale,
+		uniformScale,
+	}
+
+
+	/// <summary>
+	/// One stage of a model articulation definition.
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiArticulationStage : ExtraProperties
+	{
+	
+		private Double _initialValue;
+		
+		private Double _maximumValue;
+		
+		private Double _minimumValue;
+		
+		private String _name;
+		
+		private AgiArticulationTransformType _type;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "initialValue", _initialValue);
+			SerializeProperty(writer, "maximumValue", _maximumValue);
+			SerializeProperty(writer, "minimumValue", _minimumValue);
+			SerializeProperty(writer, "name", _name);
+			SerializePropertyEnumSymbol<AgiArticulationTransformType>(writer, "type", _type);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "initialValue": _initialValue = DeserializePropertyValue<Double>(ref reader); break;
+				case "maximumValue": _maximumValue = DeserializePropertyValue<Double>(ref reader); break;
+				case "minimumValue": _minimumValue = DeserializePropertyValue<Double>(ref reader); break;
+				case "name": _name = DeserializePropertyValue<String>(ref reader); break;
+				case "type": _type = DeserializePropertyValue<AgiArticulationTransformType>(ref reader); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+	/// <summary>
+	/// A model articulation definition.
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiArticulation : ExtraProperties
+	{
+	
+		private String _name;
+		
+		private Vector3? _pointingVector;
+		
+		private const int _stagesMinItems = 1;
+		private ChildrenList<AgiArticulationStage,AgiArticulation> _stages;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "name", _name);
+			SerializeProperty(writer, "pointingVector", _pointingVector);
+			SerializeProperty(writer, "stages", _stages, _stagesMinItems);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "name": _name = DeserializePropertyValue<String>(ref reader); break;
+				case "pointingVector": _pointingVector = DeserializePropertyValue<Vector3?>(ref reader); break;
+				case "stages": DeserializePropertyList<AgiArticulationStage>(ref reader, _stages); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+	/// <summary>
+	/// glTF Extension that defines metadata for applying external analysis or effects to a model.
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiRootArticulations : ExtraProperties
+	{
+	
+		private const int _articulationsMinItems = 1;
+		private ChildrenList<AgiArticulation,AgiRootArticulations> _articulations;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "articulations", _articulations, _articulationsMinItems);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "articulations": DeserializePropertyList<AgiArticulation>(ref reader, _articulations); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+}

+ 97 - 97
src/SharpGLTF.Core/Schema2/Generated/ext.AgiRootStkMetadata.g.cs → src/SharpGLTF.Agi/schema2/generated/ext.AgiRootStkMetadata.g.cs

@@ -1,97 +1,97 @@
-// <auto-generated/>
-
-//------------------------------------------------------------------------------------------------
-//      This file has been programatically generated; DON´T EDIT!
-//------------------------------------------------------------------------------------------------
-
-#pragma warning disable SA1001
-#pragma warning disable SA1027
-#pragma warning disable SA1028
-#pragma warning disable SA1121
-#pragma warning disable SA1205
-#pragma warning disable SA1309
-#pragma warning disable SA1402
-#pragma warning disable SA1505
-#pragma warning disable SA1507
-#pragma warning disable SA1508
-#pragma warning disable SA1652
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Numerics;
-using System.Text.Json;
-
-namespace SharpGLTF.Schema2
-{
-	using Collections;
-
-	/// <summary>
-	/// A solar panel group definition.
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiStkSolarPanelGroup : ExtraProperties
-	{
-	
-		private const Double _efficiencyMinimum = 0;
-		private const Double _efficiencyMaximum = 100;
-		private Double _efficiency;
-		
-		private String _name;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "efficiency", _efficiency);
-			SerializeProperty(writer, "name", _name);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "efficiency": _efficiency = DeserializePropertyValue<Double>(ref reader); break;
-				case "name": _name = DeserializePropertyValue<String>(ref reader); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-	/// <summary>
-	/// glTF Extension that defines metadata for use with STK (Systems Tool Kit).
-	/// </summary>
-	#if NET6_0_OR_GREATER
-	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
-	#endif
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
-	partial class AgiRootStkMetadata : ExtraProperties
-	{
-	
-		private const int _solarPanelGroupsMinItems = 1;
-		private ChildrenList<AgiStkSolarPanelGroup,AgiRootStkMetadata> _solarPanelGroups;
-		
-	
-		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "solarPanelGroups", _solarPanelGroups, _solarPanelGroupsMinItems);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "solarPanelGroups": DeserializePropertyList<AgiStkSolarPanelGroup>(ref reader, _solarPanelGroups); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-}
+// <auto-generated/>
+
+//------------------------------------------------------------------------------------------------
+//      This file has been programatically generated; DON´T EDIT!
+//------------------------------------------------------------------------------------------------
+
+#pragma warning disable SA1001
+#pragma warning disable SA1027
+#pragma warning disable SA1028
+#pragma warning disable SA1121
+#pragma warning disable SA1205
+#pragma warning disable SA1309
+#pragma warning disable SA1402
+#pragma warning disable SA1505
+#pragma warning disable SA1507
+#pragma warning disable SA1508
+#pragma warning disable SA1652
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Numerics;
+using System.Text.Json;
+
+namespace SharpGLTF.Schema2
+{
+	using Collections;
+
+	/// <summary>
+	/// A solar panel group definition.
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiStkSolarPanelGroup : ExtraProperties
+	{
+	
+		private const Double _efficiencyMinimum = 0;
+		private const Double _efficiencyMaximum = 100;
+		private Double _efficiency;
+		
+		private String _name;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "efficiency", _efficiency);
+			SerializeProperty(writer, "name", _name);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "efficiency": _efficiency = DeserializePropertyValue<Double>(ref reader); break;
+				case "name": _name = DeserializePropertyValue<String>(ref reader); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+	/// <summary>
+	/// glTF Extension that defines metadata for use with STK (Systems Tool Kit).
+	/// </summary>
+	#if NET6_0_OR_GREATER
+	[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
+	#endif
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("SharpGLTF.CodeGen", "1.0.0.0")]
+	partial class AgiRootStkMetadata : ExtraProperties
+	{
+	
+		private const int _solarPanelGroupsMinItems = 1;
+		private ChildrenList<AgiStkSolarPanelGroup,AgiRootStkMetadata> _solarPanelGroups;
+		
+	
+		protected override void SerializeProperties(Utf8JsonWriter writer)
+		{
+			base.SerializeProperties(writer);
+			SerializeProperty(writer, "solarPanelGroups", _solarPanelGroups, _solarPanelGroupsMinItems);
+		}
+	
+		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
+		{
+			switch (jsonPropertyName)
+			{
+				case "solarPanelGroups": DeserializePropertyList<AgiStkSolarPanelGroup>(ref reader, _solarPanelGroups); break;
+				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
+			}
+		}
+	
+	}
+
+}

+ 1 - 6
src/SharpGLTF.Core/Schema2/gltf.ExtensionsFactory.cs

@@ -46,12 +46,7 @@ namespace SharpGLTF.Schema2
             RegisterExtension<Texture, TextureKTX2>("KHR_texture_basisu");
 
             RegisterExtension<ModelRoot, XmpPackets>("KHR_xmp_json_ld");
-            RegisterExtension<ExtraProperties, XmpPacketReference>("KHR_xmp_json_ld");            
-
-            RegisterExtension<ModelRoot, AgiRootArticulations>("AGI_articulations");
-            RegisterExtension<ModelRoot, AgiRootStkMetadata>("AGI_stk_metadata");
-            RegisterExtension<Node, AgiNodeArticulations>("AGI_articulations");
-            RegisterExtension<Node, AgiNodeStkMetadata>("AGI_stk_metadata");
+            RegisterExtension<ExtraProperties, XmpPacketReference>("KHR_xmp_json_ld");                        
         }
 
         #endregion

+ 66 - 0
src/SharpGLTF.Core/Schema2/gltf.TextureInfo.cs

@@ -3,9 +3,40 @@ using System.Numerics;
 
 namespace SharpGLTF.Schema2
 {
+    /// <remarks>
+    /// Derived classes:<br/>
+    /// - <see cref="MaterialNormalTextureInfo"/><br/>
+    /// - <see cref="MaterialOcclusionTextureInfo"/>
+    /// </remarks>
     [System.Diagnostics.DebuggerDisplay("LogicalTexture[{_LogicalTextureIndex}]")]
     internal partial class TextureInfo
     {
+        #region lifecycle
+
+        public TextureInfo() { }
+
+        public TextureInfo(TextureInfo other)
+        {
+            if (other == null) throw new ArgumentNullException(nameof(other));
+
+            _index = other._index;
+            _texCoord = other._texCoord;
+
+            this.Extras = other.Extras;
+
+            // TODO: should copy all extensions, not only TextureTransform.
+
+            var otherXform = other.GetExtension<TextureTransform>();
+
+            if (otherXform != null && !otherXform.IsDefault)
+            {
+                var thisXform = other.UseExtension<TextureTransform>();
+                otherXform.CopyTo(thisXform);
+            }
+        }
+
+        #endregion
+
         #region properties
 
         internal int _LogicalTextureIndex
@@ -122,11 +153,35 @@ namespace SharpGLTF.Schema2
         }
 
         #endregion
+
+        #region API
+
+        internal void CopyTo(TextureTransform other)
+        {
+            if (other == null) throw new ArgumentNullException(nameof(other));
+            other.TextureCoordinateOverride = this.TextureCoordinateOverride;
+            other.Rotation = this.Rotation;
+            other.Offset = this.Offset;
+            other.Scale = this.Scale;            
+        }
+
+        #endregion
     }
 
     [System.Diagnostics.DebuggerDisplay("Normal LogicalTexture[{_LogicalTextureIndex}] x {Scale}")]
     internal sealed partial class MaterialNormalTextureInfo
     {
+        #region lifecycle
+
+        public MaterialNormalTextureInfo() { }
+
+        public MaterialNormalTextureInfo(MaterialNormalTextureInfo other) :base(other)
+        {
+            _scale = other._scale;
+        }
+
+        #endregion
+
         #region properties
 
         public static Single ScaleDefault => (float)_scaleDefault;
@@ -143,6 +198,17 @@ namespace SharpGLTF.Schema2
     [System.Diagnostics.DebuggerDisplay("Occlusion LogicalTexture[{_LogicalTextureIndex}] x {Strength}")]
     internal sealed partial class MaterialOcclusionTextureInfo
     {
+        #region lifecycle
+
+        public MaterialOcclusionTextureInfo() { }
+
+        public MaterialOcclusionTextureInfo(MaterialOcclusionTextureInfo other) : base(other)
+        {
+            _strength = other._strength;
+        }
+
+        #endregion
+
         #region properties
 
         public static Single StrengthDefault => (float)_strengthDefault;