Browse Source

remove min, max, scale, offset for now

Bert Temme 1 year ago
parent
commit
18d66ddb07

+ 2 - 25
src/SharpGLTF.Ext.3DTiles/Schema2/Ext.StructuralMetadataPrimitive.cs

@@ -237,34 +237,11 @@ namespace SharpGLTF.Schema2
                         var vertexAccessor = meshPrimitive.GetVertexAccessor(acc);
                         var vertexAccessor = meshPrimitive.GetVertexAccessor(acc);
                         var propertyValues = vertexAccessor.AsScalarArray();
                         var propertyValues = vertexAccessor.AsScalarArray();
 
 
-                        if (property.Value.Max != null)
-                        {
-                           var areSmaller = AreSmallerThan(propertyValues, ToFLoat(property.Value.Max));
-                            Guard.IsTrue(areSmaller, nameof(property.Value.Max), $"The property '{property.Key}' has a maximum value of {property.Value.Max}, but the maximum value in the vertex attribute {acc} is {propertyValues.Max()}");
-                        }
-                        if (property.Value.Min != null)
-                        {
-                            var areLarger = AreLargerThan(propertyValues, ToFLoat(property.Value.Min));
-                            Guard.IsTrue(areLarger, nameof(property.Value.Min), $"The property '{property.Key}' has a minimum value of {property.Value.Min}, but the maximum value in the vertex attribute {acc} is {propertyValues.Min()}");
-                        }
+                        // Todo: check min, max, scale, offset of propertyAttributeProperty
 
 
                         classDefinition.Properties.TryGetValue(key, out var propertyDefinition);
                         classDefinition.Properties.TryGetValue(key, out var propertyDefinition);
 
 
-                        var min = propertyDefinition.Min;
-                        var max = propertyDefinition.Max;
-                        var scale = propertyDefinition.Scale;
-                        var offset = propertyDefinition.Offset;
-
-                        if (max != null)
-                        {
-                            var areSmaller = AreSmallerThan(propertyValues, ToFLoat(max));
-                            Guard.IsTrue(areSmaller, nameof(max), $"The property '{property.Key}' has a maximum value of {max}, but the maximum value in the vertex attribute {acc} is {propertyValues.Max()}");
-                        }
-                        if (min != null)
-                        {
-                            var areLarger = AreLargerThan(propertyValues, ToFLoat(min));
-                            Guard.IsTrue(areLarger, nameof(min), $"The property '{property.Key}' has a minimum value of {min}, but the maximum value in the vertex attribute {acc} is {propertyValues.Min()}");
-                        }
+                        //  Todo: check min, max, scale, offset of StructuralMetadaClassProperty
 
 
                         Guard.IsTrue(propertyDefinition.Array == false, nameof(propertyDefinition.Array), $"The property '{property.Key}' is an array, which is not supported for property attributes");
                         Guard.IsTrue(propertyDefinition.Array == false, nameof(propertyDefinition.Array), $"The property '{property.Key}' is an array, which is not supported for property attributes");
 
 

+ 4 - 0
src/SharpGLTF.Ext.3DTiles/Schema2/Ext.StructuralMetadataRoot.cs

@@ -537,6 +537,7 @@ namespace SharpGLTF.Schema2
                 set => _attribute = value;
                 set => _attribute = value;
             }
             }
 
 
+            /** Commented out for now, as it is not supported
             public JsonNode Min
             public JsonNode Min
             {
             {
                 get => _min;
                 get => _min;
@@ -560,6 +561,7 @@ namespace SharpGLTF.Schema2
                 get => _offset;
                 get => _offset;
                 set => _offset = value;
                 set => _offset = value;
             }
             }
+            */
             #endregion
             #endregion
         }
         }
 
 
@@ -1276,6 +1278,7 @@ namespace SharpGLTF.Schema2
                 set => _count = value;
                 set => _count = value;
             }
             }
 
 
+            /** Commented out for now, as it is not supported
             public JsonNode Min
             public JsonNode Min
             {
             {
                 get => _min;
                 get => _min;
@@ -1299,6 +1302,7 @@ namespace SharpGLTF.Schema2
                 get => _offset;
                 get => _offset;
                 set => _offset = value;
                 set => _offset = value;
             }
             }
+            */
 
 
 
 
             #endregion
             #endregion

+ 14 - 14
tests/SharpGLTF.Cesium.Tests/ExtStructuralMetadataTests.cs

@@ -29,22 +29,22 @@ namespace SharpGLTF.Schema2.Tiles3D
         [TestCase("PropertyAttributesClassPropertyArray.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyArray.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyInvalidComponentType.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyInvalidComponentType.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyInvalidEnumValueType.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyInvalidEnumValueType.gltf", typeof(ModelException))]
-        [TestCase("PropertyAttributesClassPropertyMaxNotInRange.gltf", typeof(ModelException))]
-        [TestCase("PropertyAttributesClassPropertyMinNotInRange.gltf", typeof(ModelException))]
+        // Todo: Minmax [TestCase("PropertyAttributesClassPropertyMaxNotInRange.gltf", typeof(ModelException))]
+        // Todo: Minmax [TestCase("PropertyAttributesClassPropertyMinNotInRange.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyString.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesClassPropertyString.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidElementType.gltf", typeof(InvalidOperationException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidElementType.gltf", typeof(InvalidOperationException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidElementValue.gltf", typeof(LinkException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidElementValue.gltf", typeof(LinkException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidLength.gltf", typeof(SchemaException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidLength.gltf", typeof(SchemaException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidType.gltf", typeof(SchemaException))]
         [TestCase("PropertyAttributesMeshPrimitivePropertyAttributesInvalidType.gltf", typeof(SchemaException))]
         [TestCase("PropertyAttributesPropertyAttributePropertyInvalidAttribute.gltf", typeof(ModelException))]
         [TestCase("PropertyAttributesPropertyAttributePropertyInvalidAttribute.gltf", typeof(ModelException))]
-        [TestCase("PropertyAttributesPropertyAttributePropertyMaxMismatch.gltf", null)] // bug in the test file
-        [TestCase("PropertyAttributesPropertyAttributePropertyMaxNotInRange.gltf", typeof(ModelException))]
-        [TestCase("PropertyAttributesPropertyAttributePropertyMinMismatch.gltf", null)]
-        [TestCase("PropertyAttributesPropertyAttributePropertyMinNotInRange.gltf", typeof(ModelException))]
-        // todo minmax [TestCase("PropertyTextureClassPropertyMaxNotInRange.gltf", typeof(ModelException))]
-        // todo minmax [TestCase("PropertyTextureClassPropertyMinNotInRange.gltf", typeof(ModelException))]
-        // todo minmax [TestCase("PropertyTextureClassPropertyWithOffsetScaleMinNotInRange.gltf", typeof(ModelException))]
-        // todo minmax [TestCase("PropertyTextureEnumsInvalidEnumValue.gltf", typeof(ModelException))]
+        // Todo: Minmax [TestCase("PropertyAttributesPropertyAttributePropertyMaxMismatch.gltf", typeof(ModelException))] 
+        // Todo: Minmax [TestCase("PropertyAttributesPropertyAttributePropertyMaxNotInRange.gltf", typeof(ModelException))]
+        // Todo: Minmax [TestCase("PropertyAttributesPropertyAttributePropertyMinMismatch.gltf", typeof(ModelException))]
+        // Todo: Minmax [TestCase("PropertyAttributesPropertyAttributePropertyMinNotInRange.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTextureClassPropertyMaxNotInRange.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTextureClassPropertyMinNotInRange.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTextureClassPropertyWithOffsetScaleMinNotInRange.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTextureEnumsInvalidEnumValue.gltf", typeof(ModelException))]
         [TestCase("PropertyTextureInvalidPropertyTypeA.gltf", typeof(ModelException))]
         [TestCase("PropertyTextureInvalidPropertyTypeA.gltf", typeof(ModelException))]
         [TestCase("PropertyTextureInvalidPropertyTypeB.gltf", typeof(ModelException))]
         [TestCase("PropertyTextureInvalidPropertyTypeB.gltf", typeof(ModelException))]
         [TestCase("PropertyTextureMeshPrimitivePropertyTexturesInvalidElementType.gltf", typeof(InvalidOperationException))]
         [TestCase("PropertyTextureMeshPrimitivePropertyTexturesInvalidElementType.gltf", typeof(InvalidOperationException))]
@@ -55,10 +55,10 @@ namespace SharpGLTF.Schema2.Tiles3D
         [TestCase("PropertyTexturePropertyChannelsSizeMismatch.gltf", typeof(ModelException))]
         [TestCase("PropertyTexturePropertyChannelsSizeMismatch.gltf", typeof(ModelException))]
         [TestCase("PropertyTexturePropertyIndexInvalidType.gltf", typeof(InvalidOperationException))]
         [TestCase("PropertyTexturePropertyIndexInvalidType.gltf", typeof(InvalidOperationException))]
         [TestCase("PropertyTexturePropertyIndexInvalidValue.gltf", typeof(LinkException))]
         [TestCase("PropertyTexturePropertyIndexInvalidValue.gltf", typeof(LinkException))]
-        // todo minmax [TestCase("PropertyTexturePropertyTexturePropertyMaxMismatch.gltf", typeof(ModelException))]
-        // todo minmax [TestCase("PropertyTexturePropertyTexturePropertyMaxNotInRange.gltf", typeof(ModelException))]
-        // todo minmax [TestCase("PropertyTexturePropertyTexturePropertyMinMismatch.gltf", typeof(ModelException))]
-        // todo minmax[TestCase("PropertyTexturePropertyTexturePropertyMinNotInRange.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTexturePropertyTexturePropertyMaxMismatch.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTexturePropertyTexturePropertyMaxNotInRange.gltf", typeof(ModelException))]
+        // todo minmax with texture [TestCase("PropertyTexturePropertyTexturePropertyMinMismatch.gltf", typeof(ModelException))]
+        // todo minmax with texture[TestCase("PropertyTexturePropertyTexturePropertyMinNotInRange.gltf", typeof(ModelException))]
         [TestCase("StructuralMetadataMissingSchema.gltf", typeof(ModelException))]
         [TestCase("StructuralMetadataMissingSchema.gltf", typeof(ModelException))]
         [TestCase("StructuralMetadataSchemaAndSchemaUri.gltf", typeof(ModelException))]
         [TestCase("StructuralMetadataSchemaAndSchemaUri.gltf", typeof(ModelException))]
         [TestCase("ValidMultipleClasses.gltf", null)]
         [TestCase("ValidMultipleClasses.gltf", null)]