瀏覽代碼

last minute fixes

Vicente Penades 5 年之前
父節點
當前提交
a82ce52267

+ 3 - 3
src/PackageInfo.props

@@ -7,11 +7,11 @@
     <Copyright>Copyright (c) 2020 Vicente Penades</Copyright>
     <Copyright>Copyright (c) 2020 Vicente Penades</Copyright>
     <Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>
     <Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>
 
 
-    <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>
     <RepositoryType>git</RepositoryType>
     <RepositoryType>git</RepositoryType>
-
-    <PackageTags>C# glTF 3D</PackageTags>
+    <RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>    
     <PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>
     <PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>
+
+    <PackageTags>C# glTF 3D</PackageTags>    
     <PackageIcon>glTF2Sharp.png</PackageIcon>
     <PackageIcon>glTF2Sharp.png</PackageIcon>
 
 
     <DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
     <DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>

+ 4 - 4
src/SharpGLTF.Core/Runtime/NodeTemplate.cs

@@ -64,12 +64,12 @@ namespace SharpGLTF.Runtime
         #region data
         #region data
 
 
         /// <summary>
         /// <summary>
-        /// the index of this node within <see cref="SceneTemplate._NodeTemplates"/>
+        /// the index of this node within <see cref="SceneTemplate._Armature"/>
         /// </summary>
         /// </summary>
         private readonly int _LogicalSourceIndex;
         private readonly int _LogicalSourceIndex;
 
 
         /// <summary>
         /// <summary>
-        /// the index of the parent node within <see cref="SceneTemplate._NodeTemplates"/>
+        /// the index of the parent node within <see cref="SceneTemplate._Armature"/>
         /// </summary>
         /// </summary>
         private readonly int _ParentIndex;
         private readonly int _ParentIndex;
         private readonly int[] _ChildIndices;
         private readonly int[] _ChildIndices;
@@ -95,12 +95,12 @@ namespace SharpGLTF.Runtime
         public int LogicalNodeIndex => _LogicalSourceIndex;
         public int LogicalNodeIndex => _LogicalSourceIndex;
 
 
         /// <summary>
         /// <summary>
-        /// Gets the index of the parent <see cref="NodeTemplate"/> in <see cref="SceneTemplate._NodeTemplates"/>
+        /// Gets the index of the parent <see cref="NodeTemplate"/> in <see cref="SceneTemplate._Armature"/>
         /// </summary>
         /// </summary>
         public int ParentIndex => _ParentIndex;
         public int ParentIndex => _ParentIndex;
 
 
         /// <summary>
         /// <summary>
-        /// Gets the list of indices of the children <see cref="NodeTemplate"/> in <see cref="SceneTemplate._NodeTemplates"/>
+        /// Gets the list of indices of the children <see cref="NodeTemplate"/> in <see cref="SceneTemplate._Armature"/>
         /// </summary>
         /// </summary>
         public IReadOnlyList<int> ChildIndices => _ChildIndices;
         public IReadOnlyList<int> ChildIndices => _ChildIndices;
 
 

+ 12 - 6
src/SharpGLTF.Core/Schema2/gltf.MeshPrimitive.cs

@@ -293,32 +293,38 @@ namespace SharpGLTF.Schema2
 
 
             // check indices
             // check indices
 
 
-            if (IndexAccessor != null)
+            if (IndexAccessor != null && IndexAccessor.Count > 0)
             {
             {
                 IndexAccessor.ValidateIndices(validate, (uint)vertexCount, DrawPrimitiveType);
                 IndexAccessor.ValidateIndices(validate, (uint)vertexCount, DrawPrimitiveType);
 
 
-                var incompatibleMode = false;
+                var incompatiblePrimitiveCount = false;
 
 
                 switch (this.DrawPrimitiveType)
                 switch (this.DrawPrimitiveType)
                 {
                 {
+                    case PrimitiveType.POINTS:
+                        if (IndexAccessor.Count < 1) incompatiblePrimitiveCount = true;
+                        break;
+
                     case PrimitiveType.LINE_LOOP:
                     case PrimitiveType.LINE_LOOP:
                     case PrimitiveType.LINE_STRIP:
                     case PrimitiveType.LINE_STRIP:
-                        if (IndexAccessor.Count < 2) incompatibleMode = true;
+                        if (IndexAccessor.Count < 2) incompatiblePrimitiveCount = true;
                         break;
                         break;
 
 
                     case PrimitiveType.TRIANGLE_FAN:
                     case PrimitiveType.TRIANGLE_FAN:
                     case PrimitiveType.TRIANGLE_STRIP:
                     case PrimitiveType.TRIANGLE_STRIP:
-                        if (IndexAccessor.Count < 3) incompatibleMode = true;
+                        if (IndexAccessor.Count < 3) incompatiblePrimitiveCount = true;
                         break;
                         break;
 
 
                     case PrimitiveType.LINES:
                     case PrimitiveType.LINES:
-                        if (!IndexAccessor.Count.IsMultipleOf(2)) incompatibleMode = true;
+                        if (!IndexAccessor.Count.IsMultipleOf(2)) incompatiblePrimitiveCount = true;
                         break;
                         break;
 
 
                     case PrimitiveType.TRIANGLES:
                     case PrimitiveType.TRIANGLES:
-                        if (!IndexAccessor.Count.IsMultipleOf(3)) incompatibleMode = true;
+                        if (!IndexAccessor.Count.IsMultipleOf(3)) incompatiblePrimitiveCount = true;
                         break;
                         break;
                 }
                 }
+
+                validate.IsTrue(nameof(_indices), !incompatiblePrimitiveCount, "Mismatch between indices count and PrimitiveType");
             }
             }
 
 
             // check vertex attributes accessors ByteStride
             // check vertex attributes accessors ByteStride

+ 2 - 2
src/SharpGLTF.Core/Schema2/gltf.Serialization.Write.cs

@@ -77,9 +77,9 @@ namespace SharpGLTF.Schema2
         public Boolean MergeBuffers { get; set; } = true;
         public Boolean MergeBuffers { get; set; } = true;
 
 
         /// <summary>
         /// <summary>
-        /// 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.
         /// </summary>
         /// </summary>
-        public Boolean JsonIndented { get; set; } = false;
+        public Boolean JsonIndented { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating the level of validation applied when loading a file.
         /// Gets or sets a value indicating the level of validation applied when loading a file.

+ 2 - 11
src/SharpGLTF.Core/SharpGLTF.Core.csproj

@@ -4,26 +4,17 @@
     <TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
     <TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
     <AssemblyName>SharpGLTF.Core</AssemblyName>
     <AssemblyName>SharpGLTF.Core</AssemblyName>
     <RootNamespace>SharpGLTF</RootNamespace>
     <RootNamespace>SharpGLTF</RootNamespace>
-    <LangVersion>7.3</LangVersion>
-    <DebugSymbols>true</DebugSymbols>    
+    <LangVersion>7.3</LangVersion>    
   </PropertyGroup>
   </PropertyGroup>
 
 
   <Import Project="..\PackageInfo.props" />
   <Import Project="..\PackageInfo.props" />
   <Import Project="..\Version.props" />
   <Import Project="..\Version.props" />
   <Import Project="..\Analyzers.props" />
   <Import Project="..\Analyzers.props" />
+  <Import Project="..\Testing.props" />
   
   
   <ItemGroup>
   <ItemGroup>
     <Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />
     <Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />
     <Compile Include="..\Shared\_Extensions.cs" Link="_Extensions.cs" />
     <Compile Include="..\Shared\_Extensions.cs" Link="_Extensions.cs" />
-  </ItemGroup>
-
-  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
-    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
-      <_Parameter1>SharpGLTF.Core.Tests</_Parameter1>
-    </AssemblyAttribute>
-    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
-      <_Parameter1>SharpGLTF.Toolkit.Tests</_Parameter1>
-    </AssemblyAttribute>
   </ItemGroup>  
   </ItemGroup>  
   
   
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
   <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">

+ 1 - 0
src/SharpGLTF.Core/Validation/ValidationContext.cs

@@ -10,6 +10,7 @@ namespace SharpGLTF.Validation
     /// <summary>
     /// <summary>
     /// Utility class used in the process of model validation.
     /// Utility class used in the process of model validation.
     /// </summary>
     /// </summary>
+    [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
     public readonly partial struct ValidationContext
     public readonly partial struct ValidationContext
     {
     {
         #region constructor
         #region constructor

+ 2 - 11
src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj

@@ -4,23 +4,14 @@
     <TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
     <TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
     <AssemblyName>SharpGLTF.Toolkit</AssemblyName>
     <AssemblyName>SharpGLTF.Toolkit</AssemblyName>
     <RootNamespace>SharpGLTF</RootNamespace>    
     <RootNamespace>SharpGLTF</RootNamespace>    
-    <LangVersion>7.3</LangVersion>
-    <DebugSymbols>true</DebugSymbols>    
+    <LangVersion>7.3</LangVersion>    
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>    
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>    
   </PropertyGroup>
   </PropertyGroup>
 
 
   <Import Project="..\PackageInfo.props" />
   <Import Project="..\PackageInfo.props" />
   <Import Project="..\Version.props" />
   <Import Project="..\Version.props" />
   <Import Project="..\Analyzers.props" />
   <Import Project="..\Analyzers.props" />
-
-  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
-    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
-      <_Parameter1>SharpGLTF.Core.Tests</_Parameter1>
-    </AssemblyAttribute>
-    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
-      <_Parameter1>SharpGLTF.Toolkit.Tests</_Parameter1>
-    </AssemblyAttribute>
-  </ItemGroup>  
+  <Import Project="..\Testing.props" />  
 
 
   <ItemGroup>
   <ItemGroup>
     <Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />
     <Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />

+ 20 - 0
src/SourceLink.props

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+
+    <GitRepositoryRemoteName>github</GitRepositoryRemoteName>
+
+    <!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
+    <PublishRepositoryUrl>true</PublishRepositoryUrl>
+
+    <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
+    <EmbedUntrackedSources>true</EmbedUntrackedSources>    
+
+  </PropertyGroup>
+
+  <ItemGroup Condition=" '$(Configuration)' == 'Release' ">
+    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
+  </ItemGroup>
+	
+</Project>

+ 13 - 0
src/Testing.props

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
+      <_Parameter1>SharpGLTF.Core.Tests</_Parameter1>
+    </AssemblyAttribute>
+    <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
+      <_Parameter1>SharpGLTF.Toolkit.Tests</_Parameter1>
+    </AssemblyAttribute>
+  </ItemGroup>  
+	
+</Project>

+ 7 - 24
src/Version.props

@@ -9,13 +9,11 @@
     <VersionPrefix>1.0.0</VersionPrefix>    
     <VersionPrefix>1.0.0</VersionPrefix>    
   </PropertyGroup>
   </PropertyGroup>
 
 
-  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-    
-    <!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
-    <PublishRepositoryUrl>true</PublishRepositoryUrl>
-    
-    <!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
-    <EmbedUntrackedSources>false</EmbedUntrackedSources>
+  <PropertyGroup>
+    <DebugSymbols>true</DebugSymbols>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">    
 
 
     <!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
     <!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
     <IncludeSymbols>true</IncludeSymbols>
     <IncludeSymbols>true</IncludeSymbols>
@@ -23,29 +21,14 @@
     
     
     <!-- Required -->
     <!-- Required -->
     <GeneratePackageOnBuild>true</GeneratePackageOnBuild>    
     <GeneratePackageOnBuild>true</GeneratePackageOnBuild>    
+    
   </PropertyGroup>
   </PropertyGroup>
 
 
+  <!-- strong name signing -->
   <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
   <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
     <SignAssembly>true</SignAssembly>
     <SignAssembly>true</SignAssembly>
     <DelaySign>false</DelaySign>
     <DelaySign>false</DelaySign>
     <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)SharpGLTF.snk</AssemblyOriginatorKeyFile>
     <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)SharpGLTF.snk</AssemblyOriginatorKeyFile>
-  </PropertyGroup>
-
-  <ItemGroup Condition=" '$(Configuration)' == 'Release' ">
-    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
-  </ItemGroup>
-
-
-  <!--
-  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
-    <VersionSuffix>dev-$([System.DateTime]::UtcNow.ToString(yyyyMMdd-HHmm))</VersionSuffix>
-    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
-  </PropertyGroup>
-
-  <PropertyGroup Condition=" '$(Configuration)' != 'Debug' ">
-    <VersionSuffix>preview-$([System.DateTime]::UtcNow.ToString(yyyyMMdd-HHmm))</VersionSuffix>
-    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
   </PropertyGroup>  
   </PropertyGroup>  
-  -->
 	
 	
 </Project>
 </Project>

+ 3 - 1
src/build-alpha.cmd

@@ -4,4 +4,6 @@ set VERSIONSUFFIX=alpha0020
 echo Building %VERSIONSUFFIX%
 echo Building %VERSIONSUFFIX%
 
 
 dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Core\SharpGLTF.Core.csproj
 dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Core\SharpGLTF.Core.csproj
-dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Toolkit\SharpGLTF.Toolkit.csproj
+dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Toolkit\SharpGLTF.Toolkit.csproj
+
+pause