瀏覽代碼

fix the unit test

Bert Temme 2 年之前
父節點
當前提交
5cb9f382f3

+ 9 - 45
src/SharpGLTF.Cesium/Schema2/Generated/Ext.CESIUM_ext_mesh_features.g.cs

@@ -28,56 +28,20 @@ namespace SharpGLTF.Schema2
 	using Collections;
 
 	/// <summary>
-	/// Reference to a texture.
+	/// A texture containing feature IDs
 	/// </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 TextureInfo : ExtraProperties
+	partial class MeshExtMeshFeatureIDTexture : TextureInfo
 	{
 	
-		private Int32 _index;
-		
-		private const Int32 _texCoordDefault = 0;
-		private const Int32 _texCoordMinimum = 0;
-		private Int32? _texCoord = _texCoordDefault;
+		private const int _channelsMinItems = 1;
+		private List<Int32> _channels;
 		
 	
 		protected override void SerializeProperties(Utf8JsonWriter writer)
-		{
-			base.SerializeProperties(writer);
-			SerializeProperty(writer, "index", _index);
-			SerializeProperty(writer, "texCoord", _texCoord, _texCoordDefault);
-		}
-	
-		protected override void DeserializeProperty(string jsonPropertyName, ref Utf8JsonReader reader)
-		{
-			switch (jsonPropertyName)
-			{
-				case "index": _index = DeserializePropertyValue<Int32>(ref reader); break;
-				case "texCoord": _texCoord = DeserializePropertyValue<Int32?>(ref reader); break;
-				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
-			}
-		}
-	
-	}
-
-	/// <summary>
-	/// A texture containing feature IDs
-	/// </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 FeatureIDTextureinEXT_mesh_features : TextureInfo
-	{
-        private static readonly Int32[] _channelsDefault = new Int32[1] { 0 };
-        private const int _channelsMinItems = 1;
-        private Int32[] _channels = _channelsDefault;
-
-
-        protected override void SerializeProperties(Utf8JsonWriter writer)
 		{
 			base.SerializeProperties(writer);
 			SerializeProperty(writer, "channels", _channels, _channelsMinItems);
@@ -101,7 +65,7 @@ namespace SharpGLTF.Schema2
 	[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 FeatureID : ExtraProperties
+	partial class MeshExtMeshFeatureID : ExtraProperties
 	{
 	
 		private Int32? _attribute;
@@ -117,7 +81,7 @@ namespace SharpGLTF.Schema2
 		private const Int32 _propertyTableMinimum = 0;
 		private Int32? _propertyTable;
 		
-		private FeatureIDTextureinEXT_mesh_features _texture;
+		private MeshExtMeshFeatureIDTexture _texture;
 		
 	
 		protected override void SerializeProperties(Utf8JsonWriter writer)
@@ -140,7 +104,7 @@ namespace SharpGLTF.Schema2
 				case "label": _label = DeserializePropertyValue<String>(ref reader); break;
 				case "nullFeatureId": _nullFeatureId = DeserializePropertyValue<Int32?>(ref reader); break;
 				case "propertyTable": _propertyTable = DeserializePropertyValue<Int32?>(ref reader); break;
-				case "texture": _texture = DeserializePropertyValue<FeatureIDTextureinEXT_mesh_features>(ref reader); break;
+				case "texture": _texture = DeserializePropertyValue<MeshExtMeshFeatureIDTexture>(ref reader); break;
 				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
 			}
 		}
@@ -158,7 +122,7 @@ namespace SharpGLTF.Schema2
 	{
 	
 		private const int _featureIdsMinItems = 1;
-		private List<FeatureID> _featureIds;
+		private List<MeshExtMeshFeatureID> _featureIds;
 		
 	
 		protected override void SerializeProperties(Utf8JsonWriter writer)
@@ -171,7 +135,7 @@ namespace SharpGLTF.Schema2
 		{
 			switch (jsonPropertyName)
 			{
-				case "featureIds": DeserializePropertyList<FeatureID>(ref reader, _featureIds); break;
+				case "featureIds": DeserializePropertyList<MeshExtMeshFeatureID>(ref reader, _featureIds); break;
 				default: base.DeserializeProperty(jsonPropertyName,ref reader); break;
 			}
 		}

+ 5 - 5
src/SharpGLTF.Cesium/Schema2/MeshExtMeshFeatures.cs

@@ -11,11 +11,11 @@ namespace SharpGLTF.Schema2
         internal MeshExtMeshFeatures(MeshPrimitive meshPrimitive)
         {
             _meshPrimitive = meshPrimitive;
-            _featureIds = new List<FeatureID>();
+            _featureIds = new List<MeshExtMeshFeatureID>();
         }
 
 
-        public List<FeatureID> FeatureIds
+        public List<MeshExtMeshFeatureID> FeatureIds
         {
             get
             {
@@ -40,9 +40,9 @@ namespace SharpGLTF.Schema2
         }
     }
 
-    public partial class FeatureID
+    public partial class MeshExtMeshFeatureID
     {
-        public FeatureID(int featureCount, int? attribute = null, int? propertyTable = null, string label = null)
+        public MeshExtMeshFeatureID(int featureCount, int? attribute = null, int? propertyTable = null, string label = null)
         {
             _featureCount = featureCount;
             _attribute = attribute == null ? 0 : attribute;
@@ -53,7 +53,7 @@ namespace SharpGLTF.Schema2
 
     public static class ExtMeshFeatures
     {
-        public static void SetFeatureIds(this MeshPrimitive primitive, List<FeatureID> list)
+        public static void SetFeatureIds(this MeshPrimitive primitive, List<MeshExtMeshFeatureID> list)
         {
             if (list == null) { primitive.RemoveExtensions<MeshExtMeshFeatures>(); return; }
 

+ 1 - 1
tests/SharpGLTF.Cesium.Tests/ExtMeshFeaturesTests.cs

@@ -38,7 +38,7 @@ namespace SharpGLTF.Cesium
 
             var model = scene.ToGltf2();
 
-            var featureIds = new List<FeatureID>() { new FeatureID(1) };
+            var featureIds = new List<MeshExtMeshFeatureID>() { new MeshExtMeshFeatureID(1) };
             model.LogicalMeshes[0].Primitives[0].SetFeatureIds(featureIds);
 
             var cesiumExtMeshFeaturesExtension = (MeshExtMeshFeatures)model.LogicalMeshes[0].Primitives[0].Extensions.FirstOrDefault();