Skip to content

Commit

Permalink
last minute fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vpenades committed Oct 2, 2020
1 parent 68c96be commit a82ce52
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 62 deletions.
6 changes: 3 additions & 3 deletions src/PackageInfo.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<Copyright>Copyright (c) 2020 Vicente Penades</Copyright>
<Description>SharpGLTF is a C# library for reading and writing glTF2 3D models</Description>

<RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>
<RepositoryType>git</RepositoryType>

<PackageTags>C# glTF 3D</PackageTags>
<RepositoryUrl>https://github.com/vpenades/SharpGLTF</RepositoryUrl>
<PackageProjectUrl>https://github.com/vpenades/SharpGLTF</PackageProjectUrl>

<PackageTags>C# glTF 3D</PackageTags>
<PackageIcon>glTF2Sharp.png</PackageIcon>

<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
Expand Down
8 changes: 4 additions & 4 deletions src/SharpGLTF.Core/Runtime/NodeTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ internal NodeTemplate(Schema2.Node srcNode, int parentIdx, int[] childIndices, b
#region data

/// <summary>
/// the index of this node within <see cref="SceneTemplate._NodeTemplates"/>
/// the index of this node within <see cref="SceneTemplate._Armature"/>
/// </summary>
private readonly int _LogicalSourceIndex;

/// <summary>
/// the index of the parent node within <see cref="SceneTemplate._NodeTemplates"/>
/// the index of the parent node within <see cref="SceneTemplate._Armature"/>
/// </summary>
private readonly int _ParentIndex;
private readonly int[] _ChildIndices;
Expand All @@ -95,12 +95,12 @@ internal NodeTemplate(Schema2.Node srcNode, int parentIdx, int[] childIndices, b
public int LogicalNodeIndex => _LogicalSourceIndex;

/// <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>
public int ParentIndex => _ParentIndex;

/// <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>
public IReadOnlyList<int> ChildIndices => _ChildIndices;

Expand Down
18 changes: 12 additions & 6 deletions src/SharpGLTF.Core/Schema2/gltf.MeshPrimitive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/SharpGLTF.Core/Schema2/gltf.Serialization.Write.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public WriteSettings(WriteSettings other)
public Boolean MergeBuffers { get; set; } = true;

/// <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>
public Boolean JsonIndented { get; set; } = false;
public Boolean JsonIndented { get; set; }

/// <summary>
/// Gets or sets a value indicating the level of validation applied when loading a file.
Expand Down
13 changes: 2 additions & 11 deletions src/SharpGLTF.Core/SharpGLTF.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,17 @@
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<AssemblyName>SharpGLTF.Core</AssemblyName>
<RootNamespace>SharpGLTF</RootNamespace>
<LangVersion>7.3</LangVersion>
<DebugSymbols>true</DebugSymbols>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<Import Project="..\PackageInfo.props" />
<Import Project="..\Version.props" />
<Import Project="..\Analyzers.props" />
<Import Project="..\Testing.props" />

<ItemGroup>
<Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.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 Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
Expand Down
1 change: 1 addition & 0 deletions src/SharpGLTF.Core/Validation/ValidationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace SharpGLTF.Validation
/// <summary>
/// Utility class used in the process of model validation.
/// </summary>
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
public readonly partial struct ValidationContext
{
#region constructor
Expand Down
13 changes: 2 additions & 11 deletions src/SharpGLTF.Toolkit/SharpGLTF.Toolkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,14 @@
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<AssemblyName>SharpGLTF.Toolkit</AssemblyName>
<RootNamespace>SharpGLTF</RootNamespace>
<LangVersion>7.3</LangVersion>
<DebugSymbols>true</DebugSymbols>
<LangVersion>7.3</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<Import Project="..\PackageInfo.props" />
<Import Project="..\Version.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>
<Compile Include="..\Shared\Guard.cs" Link="Debug\Guard.cs" />
Expand Down
20 changes: 20 additions & 0 deletions src/SourceLink.props
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions src/Testing.props
Original file line number Diff line number Diff line change
@@ -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>
31 changes: 7 additions & 24 deletions src/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,26 @@
<VersionPrefix>1.0.0</VersionPrefix>
</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 -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<!-- Required -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

</PropertyGroup>

<!-- strong name signing -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<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>
-->

</Project>
4 changes: 3 additions & 1 deletion src/build-alpha.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
dotnet build -c:Release --version-suffix %VERSIONSUFFIX% SharpGLTF.Toolkit\SharpGLTF.Toolkit.csproj

pause

0 comments on commit a82ce52

Please sign in to comment.