Browse Source

updating default values featureIds + unit test

Bert Temme 2 years ago
parent
commit
3cac840b0e

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

@@ -45,9 +45,9 @@ namespace SharpGLTF.Schema2
         public MeshExtMeshFeatureID(int featureCount, int? attribute = null, int? propertyTable = null, string label = null)
         {
             _featureCount = featureCount;
-            _attribute = attribute == null ? 0 : attribute;
+            _attribute = attribute;
             _label = label;
-            _propertyTable = propertyTable == null ? 0 : propertyTable;
+            _propertyTable = propertyTable;
         }
     }
 

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

@@ -38,7 +38,9 @@ namespace SharpGLTF.Cesium
 
             var model = scene.ToGltf2();
 
-            var featureIds = new List<MeshExtMeshFeatureID>() { new MeshExtMeshFeatureID(1) };
+            // See sample https://github.com/CesiumGS/glTF/tree/proposal-EXT_mesh_features/extensions/2.0/Vendor/EXT_mesh_features#feature-id-by-vertex
+            var featureId = new MeshExtMeshFeatureID(2, 0);
+            var featureIds = new List<MeshExtMeshFeatureID>() { featureId };
             model.LogicalMeshes[0].Primitives[0].SetFeatureIds(featureIds);
 
             var cesiumExtMeshFeaturesExtension = (MeshExtMeshFeatures)model.LogicalMeshes[0].Primitives[0].Extensions.FirstOrDefault();