Skip to content

Commit 4dec93c

Browse files
author
huqingjie
committed
Merge branch 'master' of https://github.com/jackletter/SharpGLTF
2 parents 0a8965b + b0dcbb7 commit 4dec93c

File tree

26 files changed

+682
-146
lines changed

26 files changed

+682
-146
lines changed

.github/workflows/publishAlpha.yml renamed to .github/workflows/PublishToNuget.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v4
1414
- name: Setup .NET SDK
15-
uses: actions/setup-dotnet@v3
15+
uses: actions/setup-dotnet@v4
1616
- name: Install dependencies
1717
run: dotnet restore
1818
- name: Build

.github/workflows/dotnet.yml renamed to .github/workflows/TestCommit.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16+
1617
- name: Setup dotnet ${{ matrix.dotnet-version }}
17-
uses: actions/setup-dotnet@v3
18+
uses: actions/setup-dotnet@v4
1819
with:
1920
dotnet-version: ${{ matrix.dotnet-version }}
21+
2022
- name: Install dependencies
2123
run: dotnet restore
24+
2225
- name: Build
23-
run: dotnet build
26+
# https://github.com/dotnet/core/issues/7840 failed to build with 0 errors
27+
run: dotnet build --configuration Debug --no-restore --disable-build-servers
28+
2429
- name: Test
25-
run: dotnet test ./tests/SharpGLTF.Ext.3DTiles.Tests/SharpGLTF.Ext.3DTiles.Tests.csproj
30+
run: dotnet test ./tests/SharpGLTF.Ext.3DTiles.Tests/SharpGLTF.Ext.3DTiles.Tests.csproj --no-build --verbosity diagnostic

SharpGLTF.sln

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{29566B60-311D-42A0-9E8D-C48DECDD587F}"
77
ProjectSection(SolutionItems) = preProject
88
.editorconfig = .editorconfig
9-
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
10-
.github\workflows\publishAlpha.yml = .github\workflows\publishAlpha.yml
9+
.github\workflows\PublishToNuget.yml = .github\workflows\PublishToNuget.yml
1110
README.md = README.md
1211
SharpGLTF.ruleset = SharpGLTF.ruleset
12+
.github\workflows\TestCommit.yml = .github\workflows\TestCommit.yml
1313
EndProjectSection
1414
EndProject
1515
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{072B725F-773F-4751-9616-E9778897C1D2}"
@@ -58,7 +58,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Plotly", "example
5858
EndProject
5959
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.ThirdParty.Tests", "tests\SharpGLTF.ThirdParty.Tests\SharpGLTF.ThirdParty.Tests.csproj", "{38B27C0B-DB22-4CB7-A6DA-4A6C2A8385A8}"
6060
EndProject
61-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Trimmed.App", "tests\SharpGLTF.Trimmed.App\SharpGLTF.Trimmed.App.csproj", "{A09437F7-403C-44A2-B1FE-15CC535B64CA}"
61+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Trimmed.App", "examples\SharpGLTF.Trimmed.App\SharpGLTF.Trimmed.App.csproj", "{A09437F7-403C-44A2-B1FE-15CC535B64CA}"
6262
EndProject
6363
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpGLTF.Runtime", "src\SharpGLTF.Runtime\SharpGLTF.Runtime.csproj", "{E06015B0-8DBC-4DC9-81A2-605DAFE36821}"
6464
EndProject
@@ -170,7 +170,7 @@ Global
170170
{7FEFC259-51D6-4409-8724-8DE0EA8D5CD9} = {0CBF510D-D836-40BA-95EC-E93FDBB90632}
171171
{A63C2A2D-950F-4C76-9299-2B2D325A8653} = {83E7E49D-8A28-45E8-9DBD-1F3AEDEF3E42}
172172
{38B27C0B-DB22-4CB7-A6DA-4A6C2A8385A8} = {0CBF510D-D836-40BA-95EC-E93FDBB90632}
173-
{A09437F7-403C-44A2-B1FE-15CC535B64CA} = {0CBF510D-D836-40BA-95EC-E93FDBB90632}
173+
{A09437F7-403C-44A2-B1FE-15CC535B64CA} = {83E7E49D-8A28-45E8-9DBD-1F3AEDEF3E42}
174174
{E06015B0-8DBC-4DC9-81A2-605DAFE36821} = {072B725F-773F-4751-9616-E9778897C1D2}
175175
{3925E45C-E7AA-4396-9567-4D8B1D1EF1C6} = {0CBF510D-D836-40BA-95EC-E93FDBB90632}
176176
{F98E7E4B-EF27-48A0-BA56-730F14CEEEE1} = {072B725F-773F-4751-9616-E9778897C1D2}

build/SharpGLTF.CodeGen/SharpGLTF.CodeGen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="LibGit2Sharp" Version="0.29.0" />
10+
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
1111
<PackageReference Include="NJsonSchema.CodeGeneration.CSharp" Version="11.0.0" />
1212
<PackageReference Include="NJsonSchema.NewtonsoftJson" Version="11.0.0" />
1313
</ItemGroup>
File renamed without changes.

src/SharpGLTF.Core/Memory/MemoryAccessor.Validation.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,13 @@ public static void VerifyAccessorBounds(MemoryAccessor memory, IReadOnlyList<dou
286286
xinfo.Dimensions = DIMENSIONS.SCALAR;
287287
memory = new MemoryAccessor(memory.Data, xinfo);
288288

289-
var array = new MultiArray(memory.Data, memory.Attribute.ByteOffset, memory.Attribute.ItemsCount, memory.Attribute.ByteStride, dimensions, memory.Attribute.Encoding, memory.Attribute.Normalized);
289+
var array = new MultiArray(
290+
memory.Data,
291+
memory.Attribute.ByteOffset,
292+
memory.Attribute.ItemsCount,
293+
memory.Attribute.ByteStride,
294+
dimensions, memory.Attribute.Encoding,
295+
false); // bounds checks are done without normalization; https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#_accessor_max
290296

291297
var current = new float[dimensions];
292298

src/SharpGLTF.Core/Memory/MemoryImage.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,23 @@ public string MimeType
307307
throw new InvalidOperationException("Image format not recognized.");
308308
}
309309
}
310+
311+
/// <summary>
312+
/// If the given path ends with an image extension, it removes the extension.
313+
/// </summary>
314+
/// <param name="path">A file path</param>
315+
/// <returns>a trimmed path if it had an image extension, or the original path.</returns>
316+
public static string TrimImageExtension(string path)
317+
{
318+
if (path == null) return null;
319+
320+
foreach (var ext in new string[] { ".jpg",".jpeg",".png",".dds",".webp",".ktx2" })
321+
{
322+
if (path.EndsWith(ext, StringComparison.OrdinalIgnoreCase)) return path.Substring(0, path.Length - ext.Length);
323+
}
324+
325+
return path;
326+
}
310327

311328
#endregion
312329

0 commit comments

Comments
 (0)