Przeglądaj źródła

start testing ext_structural_metadata

Bert Temme 2 lat temu
rodzic
commit
fbd3d068df

+ 2 - 6
src/SharpGLTF.Cesium/Schema2/CesiumExtensions.cs

@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace SharpGLTF.Schema2
+namespace SharpGLTF.Schema2
 {
     /// <summary>
     /// Extension methods for Cesium glTF Extensions
@@ -23,7 +19,7 @@ namespace SharpGLTF.Schema2
             ExtensionsFactory.RegisterExtension<MeshPrimitive, CesiumPrimitiveOutline>("CESIUM_primitive_outline");
             ExtensionsFactory.RegisterExtension<Node, MeshExtInstanceFeatures>("EXT_instance_features");
             ExtensionsFactory.RegisterExtension<MeshPrimitive, MeshExtMeshFeatures>("EXT_mesh_features");
-
+            ExtensionsFactory.RegisterExtension<ModelRoot, EXTStructuralMetaDataRoot>("EXT_structural_metadata");
         }
     }
 }

+ 76 - 0
src/SharpGLTF.Cesium/Schema2/EXTStructuralMetaDataRoot.cs

@@ -0,0 +1,76 @@
+using SharpGLTF.Validation;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace SharpGLTF.Schema2
+{
+    public partial class EXTStructuralMetaDataRoot
+    {
+        internal EXTStructuralMetaDataRoot(ModelRoot modelRoot)
+        {
+            this.modelRoot = modelRoot;
+        }
+
+        private ModelRoot modelRoot;
+
+
+        internal List<PropertyTable> PropertyTables
+        {
+            get { return _propertyTables; }
+            set { if (value == null) { _propertyTables = null; return; } _propertyTables = value; }
+        }
+
+        internal StructuralMetadataSchema Schema
+        {
+            get { return _schema; }
+            set { if (value == null) { _schema = null; return; } _schema = value; }
+        }
+
+
+        protected override void OnValidateContent(ValidationContext validate)
+        {
+        }
+    }
+
+    partial class StructuralMetadataSchema
+    {
+        public StructuralMetadataSchema()
+        {
+            _classes = new Dictionary<string, StructuralMetadataClass>();
+        }
+
+    }
+
+    partial class PropertyTable
+    {
+        public PropertyTable()
+        {
+            _properties = new Dictionary<string, PropertyTableProperty>();
+        }
+
+    }
+
+    partial class PropertyTableProperty
+    {
+    }
+
+    partial class StructuralMetadataClass
+    {
+        public StructuralMetadataClass()
+        {
+            _properties = new Dictionary<string, ClassProperty>();
+        }
+    }
+
+    partial class ClassProperty
+    {
+    }
+
+    public static class ExtStructuralMetadata
+    {
+        public static void AddMetadata<T>(this ModelRoot modelRoot, string fieldname, List<T> values)
+        {
+        }
+    }
+}

+ 1 - 1
src/SharpGLTF.Cesium/Schema2/Generated/Ext.CESIUM_ext_structural_metadata_root.g.cs

@@ -638,7 +638,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 EXTStructuralMetaData : ExtraProperties
+	partial class EXTStructuralMetaDataRoot : ExtraProperties
 	{
 	
 		private const int _propertyAttributesMinItems = 1;

+ 18 - 0
tests/SharpGLTF.Cesium.Tests/ExtStructuralMetadataTests.cs

@@ -0,0 +1,18 @@
+using NUnit.Framework;
+using SharpGLTF.Schema2;
+
+namespace SharpGLTF
+{
+    [Category("Toolkit.Scenes")]
+    public class ExtStructuralMetadataTests
+    {
+        [SetUp]
+        public void SetUp()
+        {
+            CesiumExtensions.RegisterExtensions();
+        }
+
+
+
+    }
+}