diff --git a/src/PackageInfo.props b/src/PackageInfo.props index ddf0a9ff..de24a937 100644 --- a/src/PackageInfo.props +++ b/src/PackageInfo.props @@ -7,11 +7,11 @@ Copyright (c) 2020 Vicente Penades SharpGLTF is a C# library for reading and writing glTF2 3D models - https://github.com/vpenades/SharpGLTF git - - C# glTF 3D + https://github.com/vpenades/SharpGLTF https://github.com/vpenades/SharpGLTF + + C# glTF 3D glTF2Sharp.png bin\$(Configuration)\$(AssemblyName).xml diff --git a/src/SharpGLTF.Core/Runtime/NodeTemplate.cs b/src/SharpGLTF.Core/Runtime/NodeTemplate.cs index 3885ee52..a312ed59 100644 --- a/src/SharpGLTF.Core/Runtime/NodeTemplate.cs +++ b/src/SharpGLTF.Core/Runtime/NodeTemplate.cs @@ -64,12 +64,12 @@ internal NodeTemplate(Schema2.Node srcNode, int parentIdx, int[] childIndices, b #region data /// - /// the index of this node within + /// the index of this node within /// private readonly int _LogicalSourceIndex; /// - /// the index of the parent node within + /// the index of the parent node within /// private readonly int _ParentIndex; private readonly int[] _ChildIndices; @@ -95,12 +95,12 @@ internal NodeTemplate(Schema2.Node srcNode, int parentIdx, int[] childIndices, b public int LogicalNodeIndex => _LogicalSourceIndex; /// - /// Gets the index of the parent in + /// Gets the index of the parent in /// public int ParentIndex => _ParentIndex; /// - /// Gets the list of indices of the children in + /// Gets the list of indices of the children in /// public IReadOnlyList ChildIndices => _ChildIndices; diff --git a/src/SharpGLTF.Core/Schema2/gltf.MeshPrimitive.cs b/src/SharpGLTF.Core/Schema2/gltf.MeshPrimitive.cs index 1badc6bd..825206a2 100644 --- a/src/SharpGLTF.Core/Schema2/gltf.MeshPrimitive.cs +++ b/src/SharpGLTF.Core/Schema2/gltf.MeshPrimitive.cs @@ -293,32 +293,38 @@ protected override void OnValidateContent(Validation.ValidationContext validate) // check indices - if (IndexAccessor != null) + if (IndexAccessor != null && IndexAccessor.Count > 0) { IndexAccessor.ValidateIndices(validate, (uint)vertexCount, DrawPrimitiveType); - var incompatibleMode = false; + var incompatiblePrimitiveCount = false; switch (this.DrawPrimitiveType) { + case PrimitiveType.POINTS: + if (IndexAccessor.Count < 1) incompatiblePrimitiveCount = true; + break; + case PrimitiveType.LINE_LOOP: case PrimitiveType.LINE_STRIP: - if (IndexAccessor.Count < 2) incompatibleMode = true; + if (IndexAccessor.Count < 2) incompatiblePrimitiveCount = true; break; case PrimitiveType.TRIANGLE_FAN: case PrimitiveType.TRIANGLE_STRIP: - if (IndexAccessor.Count < 3) incompatibleMode = true; + if (IndexAccessor.Count < 3) incompatiblePrimitiveCount = true; break; case PrimitiveType.LINES: - if (!IndexAccessor.Count.IsMultipleOf(2)) incompatibleMode = true; + if (!IndexAccessor.Count.IsMultipleOf(2)) incompatiblePrimitiveCount = true; break; case PrimitiveType.TRIANGLES: - if (!IndexAccessor.Count.IsMultipleOf(3)) incompatibleMode = true; + if (!IndexAccessor.Count.IsMultipleOf(3)) incompatiblePrimitiveCount = true; break; } + + validate.IsTrue(nameof(_indices), !incompatiblePrimitiveCount, "Mismatch between indices count and PrimitiveType"); } // check vertex attributes accessors ByteStride diff --git a/src/SharpGLTF.Core/Schema2/gltf.Serialization.Write.cs b/src/SharpGLTF.Core/Schema2/gltf.Serialization.Write.cs index f44713c5..e4c4c7e6 100644 --- a/src/SharpGLTF.Core/Schema2/gltf.Serialization.Write.cs +++ b/src/SharpGLTF.Core/Schema2/gltf.Serialization.Write.cs @@ -77,9 +77,9 @@ public WriteSettings(WriteSettings other) public Boolean MergeBuffers { get; set; } = true; /// - /// Gets or sets a value indicating how to format the JSON document of the glTF. + /// Gets or sets a value indicating whether the JSON formatting will include indentation. /// - public Boolean JsonIndented { get; set; } = false; + public Boolean JsonIndented { get; set; } /// /// Gets or sets a value indicating the level of validation applied when loading a file. diff --git a/src/SharpGLTF.Core/SharpGLTF.Core.csproj b/src/SharpGLTF.Core/SharpGLTF.Core.csproj index 62d5b6f9..dfd381d2 100644 --- a/src/SharpGLTF.Core/SharpGLTF.Core.csproj +++ b/src/SharpGLTF.Core/SharpGLTF.Core.csproj @@ -4,26 +4,17 @@ netstandard2.0;netcoreapp3.1 SharpGLTF.Core SharpGLTF - 7.3 - true + 7.3 + - - - - - <_Parameter1>SharpGLTF.Core.Tests - - - <_Parameter1>SharpGLTF.Toolkit.Tests - diff --git a/src/SharpGLTF.Core/Validation/ValidationContext.cs b/src/SharpGLTF.Core/Validation/ValidationContext.cs index e25c41c3..d0064398 100644 --- a/src/SharpGLTF.Core/Validation/ValidationContext.cs +++ b/src/SharpGLTF.Core/Validation/ValidationContext.cs @@ -10,6 +10,7 @@ namespace SharpGLTF.Validation /// /// Utility class used in the process of model validation. /// + [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)] public readonly partial struct ValidationContext { #region constructor diff --git a/src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj b/src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj index 796ae060..d1eb2510 100644 --- a/src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj +++ b/src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj @@ -4,23 +4,14 @@ netstandard2.0;netcoreapp3.1 SharpGLTF.Toolkit SharpGLTF - 7.3 - true + 7.3 true - - - - <_Parameter1>SharpGLTF.Core.Tests - - - <_Parameter1>SharpGLTF.Toolkit.Tests - - + diff --git a/src/SourceLink.props b/src/SourceLink.props new file mode 100644 index 00000000..02498393 --- /dev/null +++ b/src/SourceLink.props @@ -0,0 +1,20 @@ + + + + + + github + + + true + + + true + + + + + + + + \ No newline at end of file diff --git a/src/Testing.props b/src/Testing.props new file mode 100644 index 00000000..785fe136 --- /dev/null +++ b/src/Testing.props @@ -0,0 +1,13 @@ + + + + + + <_Parameter1>SharpGLTF.Core.Tests + + + <_Parameter1>SharpGLTF.Toolkit.Tests + + + + \ No newline at end of file diff --git a/src/Version.props b/src/Version.props index c5f615cf..5f7629af 100644 --- a/src/Version.props +++ b/src/Version.props @@ -9,13 +9,11 @@ 1.0.0 - - - - true - - - false + + true + + + true @@ -23,29 +21,14 @@ true + + true false $(MSBuildThisFileDirectory)SharpGLTF.snk - - - - - - - - \ No newline at end of file diff --git a/src/build-alpha.cmd b/src/build-alpha.cmd index f3893a7b..4d33c767 100644 --- a/src/build-alpha.cmd +++ b/src/build-alpha.cmd @@ -4,4 +4,6 @@ set VERSIONSUFFIX=alpha0020 echo Building %VERSIONSUFFIX% dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Core\SharpGLTF.Core.csproj -dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Toolkit\SharpGLTF.Toolkit.csproj \ No newline at end of file +dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Toolkit\SharpGLTF.Toolkit.csproj + +pause \ No newline at end of file