Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x

- name: Build
run: echo ${{ github.sha }} > Release.txt
Expand All @@ -32,15 +32,15 @@ jobs:
run: dotnet publish -p:PublishProfile=osx-x64.pubxml Obj2Tiles

- name: Zip win-x64
run: cd Obj2Tiles/bin/Release/net8.0/publish/win-x64/ && zip -r ../../../../../../Obj2Tiles-Win64.zip *
run: cd Obj2Tiles/bin/Release/net9.0/publish/win-x64/ && zip -r ../../../../../../Obj2Tiles-Win64.zip *
- name: Zip win-arm64
run: cd Obj2Tiles/bin/Release/net8.0/publish/win-arm64/ && zip -r ../../../../../../Obj2Tiles-WinArm64.zip *
run: cd Obj2Tiles/bin/Release/net9.0/publish/win-arm64/ && zip -r ../../../../../../Obj2Tiles-WinArm64.zip *
- name: Zip linux-x64
run: cd Obj2Tiles/bin/Release/net8.0/publish/linux-x64/ && zip -r ../../../../../../Obj2Tiles-Linux64.zip *
run: cd Obj2Tiles/bin/Release/net9.0/publish/linux-x64/ && zip -r ../../../../../../Obj2Tiles-Linux64.zip *
- name: Zip linux-arm64
run: cd Obj2Tiles/bin/Release/net8.0/publish/linux-arm64/ && zip -r ../../../../../../Obj2Tiles-LinuxArm64.zip *
run: cd Obj2Tiles/bin/Release/net9.0/publish/linux-arm64/ && zip -r ../../../../../../Obj2Tiles-LinuxArm64.zip *
- name: Zip osx-x64
run: cd Obj2Tiles/bin/Release/net8.0/publish/osx-x64/ && zip -r ../../../../../../Obj2Tiles-Osx64.zip *
run: cd Obj2Tiles/bin/Release/net9.0/publish/osx-x64/ && zip -r ../../../../../../Obj2Tiles-Osx64.zip *

- name: Release
uses: softprops/action-gh-release@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ public override Mesh ToMesh()
else
{
// This mesh doesn't have any triangles left
indices[subMeshIndex] = new int[0];
indices[subMeshIndex] = [];
}
}

Expand Down
2 changes: 1 addition & 1 deletion MeshDecimatorCore/Collections/ResizableArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal sealed class ResizableArray<T>
private T[] items = null;
private int length = 0;

private static T[] emptyArr = new T[0];
private static T[] emptyArr = [];
#endregion

#region Properties
Expand Down
2 changes: 1 addition & 1 deletion MeshDecimatorCore/Mesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public sealed class Mesh
private Vector4[] colors = null;
private BoneWeight[] boneWeights = null;

private static readonly int[] emptyIndices = new int[0];
private static readonly int[] emptyIndices = [];
#endregion

#region Properties
Expand Down
2 changes: 1 addition & 1 deletion MeshDecimatorCore/MeshDecimatorCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Obj2Gltf/Obj2Gltf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Configurations>Source;Debug;Release</Configurations>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>10</LangVersion>
</PropertyGroup>

Expand Down
12 changes: 6 additions & 6 deletions Obj2Tiles.Common/CommonUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@

for (var i = 0; i < iterations; i++)
{
fs1.Read(one, 0, BytesToRead);
fs2.Read(two, 0, BytesToRead);
fs1.ReadExactly(one, 0, BytesToRead);
fs2.ReadExactly(two, 0, BytesToRead);

if (BitConverter.ToInt64(one, 0) != BitConverter.ToInt64(two, 0))
return false;
Expand All @@ -64,7 +64,7 @@

public static TValue SafeGetValue<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
{
return !dictionary.TryGetValue(key, out var value) ? default : value;

Check warning on line 67 in Obj2Tiles.Common/CommonUtils.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.
}

public static TValueOut? SafeGetValue<TKey, TValue, TValueOut>(this IDictionary<TKey, TValue> dictionary,
Expand Down Expand Up @@ -317,16 +317,16 @@
}

if (!entries.Any())
return Array.Empty<string>();
return [];

Thread.Sleep(delay);
}

return entries.ToArray();
}

private static readonly HashSet<string> _compressibleMimeTypes = new()
{
private static readonly HashSet<string> _compressibleMimeTypes =
[
"text/html",
"text/css",
"text/plain",
Expand Down Expand Up @@ -358,7 +358,7 @@
"font/eot",
"font/otf",
"font/opentype"
};
];


// Credit https://stackoverflow.com/a/11124118
Expand Down Expand Up @@ -420,7 +420,7 @@
{
results = new List<ValidationResult>();

return Validator.TryValidateObject(obj, new ValidationContext(obj), results, true);

Check warning on line 423 in Obj2Tiles.Common/CommonUtils.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'instance' in 'bool Validator.TryValidateObject(object instance, ValidationContext validationContext, ICollection<ValidationResult>? validationResults, bool validateAllProperties)'.

Check warning on line 423 in Obj2Tiles.Common/CommonUtils.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'instance' in 'ValidationContext.ValidationContext(object instance)'.
}

public static string ToErrorString(this IEnumerable<ValidationResult> results)
Expand Down Expand Up @@ -478,7 +478,7 @@
{
for (var numTries = 0; numTries < retries; numTries++)
{
FileStream fs = null;

Check warning on line 481 in Obj2Tiles.Common/CommonUtils.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.
try
{
fs = new FileStream(fullPath, mode, access, share);
Expand All @@ -495,7 +495,7 @@
}
}

return null;

Check warning on line 498 in Obj2Tiles.Common/CommonUtils.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference return.
}

}
Expand Down
4 changes: 2 additions & 2 deletions Obj2Tiles.Common/HttpHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

public static class HttpHelper
{
private static readonly HttpClient _httpClient = new HttpClient();
private static readonly HttpClient HttpClient = new();

public static async Task DownloadFileAsync(string uri, string outputPath)
{
if (!Uri.TryCreate(uri, UriKind.Absolute, out _))
throw new InvalidOperationException("URI is invalid.");

var fileBytes = await _httpClient.GetByteArrayAsync(uri);
var fileBytes = await HttpClient.GetByteArrayAsync(uri);
await File.WriteAllBytesAsync(outputPath, fileBytes);
}
}
2 changes: 1 addition & 1 deletion Obj2Tiles.Common/Obj2Tiles.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
23 changes: 11 additions & 12 deletions Obj2Tiles.Library.Test/Mesh3Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.IO;
using System.Linq;
using System.Numerics;
using FluentAssertions;
using NUnit.Framework;
using Obj2Tiles.Common;
using Obj2Tiles.Library.Geometry;
using Shouldly;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;
Expand All @@ -19,8 +19,7 @@ public class Mesh3Tests
private const string TestOutputPath = "TestOutput";
private const string BrightonTexturingTestUrl = "https://github.com/DroneDB/test_data/raw/master/brighton/odm_texturing.zip";


private string GetTestOutputPath(string testName)
private static string GetTestOutputPath(string testName)
{
var folder = Path.Combine(TestOutputPath, testName);
if (Directory.Exists(folder))
Expand Down Expand Up @@ -262,9 +261,9 @@ public void Orientation_TestOk()

var o = Common.Orientation(v1, v2, v3);

o.Z.Should().Be(1);
o.X.Should().Be(0);
o.Y.Should().Be(0);
o.Z.ShouldBe(1);
o.X.ShouldBe(0);
o.Y.ShouldBe(0);
}


Expand All @@ -277,9 +276,9 @@ public void Orientation_TestZero()

var o = Common.Orientation(v1, v2, v3);

o.Z.Should().Be(0);
o.X.Should().Be(0);
o.Y.Should().Be(0);
o.Z.ShouldBe(0);
o.X.ShouldBe(0);
o.Y.ShouldBe(0);
}

[Test]
Expand All @@ -289,9 +288,9 @@ public void Orientation_TestCubeMesh()

var orientation = mesh.GetAverageOrientation();

orientation.X.Should().Be(0);
orientation.Y.Should().Be(0);
orientation.Z.Should().Be(0);
orientation.X.ShouldBe(0);
orientation.Y.ShouldBe(0);
orientation.Z.ShouldBe(0);
}

[Test]
Expand Down
14 changes: 7 additions & 7 deletions Obj2Tiles.Library.Test/Obj2Tiles.Library.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Obj2Tiles.Library/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void CopyImage(Image<Rgba32> sourceImage, Image<Rgba32> dest, int
{
sourceRowIndex %= sourceRow.Length;
}
targetRow[x + destX] = sourceRow[sourceRowIndex];//
targetRow[x + destX] = sourceRow[sourceRowIndex];
}
}
});
Expand Down
36 changes: 18 additions & 18 deletions Obj2Tiles.Library/Geometry/Box3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ public Box3[] Split(Axis axis, double position)
{
return axis switch
{
Axis.X => new[]
{
Axis.X =>
[
new Box3(Min, new Vertex3(position, Max.Y, Max.Z)),
new Box3(new Vertex3(position, Min.Y, Min.Z), Max)
},
Axis.Y => new[]
{
],
Axis.Y =>
[
new Box3(Min, new Vertex3(Max.X, position, Max.Z)),
new Box3(new Vertex3(Min.X, position, Min.Z), Max)
},
Axis.Z => new[]
{
],
Axis.Z =>
[
new Box3(Min, new Vertex3(Max.X, Max.Y, position)),
new Box3(new Vertex3(Min.X, Min.Y, position), Max)
},
],
_ => throw new ArgumentOutOfRangeException(nameof(axis), axis, null)
};
}
Expand All @@ -86,21 +86,21 @@ public Box3[] Split(Axis axis)
{
return axis switch
{
Axis.X => new[]
{
Axis.X =>
[
new Box3(Min, new Vertex3(Min.X + Width / 2, Max.Y, Max.Z)),
new Box3(new Vertex3(Min.X + Width / 2, Min.Y, Min.Z), Max)
},
Axis.Y => new[]
{
],
Axis.Y =>
[
new Box3(Min, new Vertex3(Max.X, Min.Y + Height / 2, Max.Z)),
new Box3(new Vertex3(Min.X, Min.Y + Height / 2, Min.Z), Max)
},
Axis.Z => new[]
{
],
Axis.Z =>
[
new Box3(Min, new Vertex3(Max.X, Max.Y, Min.Z + Depth / 2)),
new Box3(new Vertex3(Min.X, Min.Y, Min.Z + Depth / 2), Max)
},
],
_ => throw new ArgumentOutOfRangeException(nameof(axis), axis, null)
};
}
Expand Down
4 changes: 2 additions & 2 deletions Obj2Tiles.Library/Obj2Tiles.Library.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
</ItemGroup>

</Project>
11 changes: 6 additions & 5 deletions Obj2Tiles.Test/Obj2Tiles.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Obj2Tiles.Test/StagesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class StagesTests
private const string TestDataPath = "TestData";
private const string TestOutputPath = "TestOutput";

private string GetTestOutputPath(string testName)
private static string GetTestOutputPath(string testName)
{
var folder = Path.Combine(TestOutputPath, testName);
if (Directory.Exists(folder))
Expand Down Expand Up @@ -47,7 +47,7 @@ public void TilingStage_Tile()
Name = Path.GetFileNameWithoutExtension(file)
}).ToDictionary(item => item.Name, item => item.Bounds);

StagesFacade.Tile("TestData/Tile1", testPath, 1, 100, new[] { boundsMapper });
StagesFacade.Tile("TestData/Tile1", testPath, 1, 100, [boundsMapper]);

}

Expand Down
2 changes: 1 addition & 1 deletion Obj2Tiles.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">VISIBLE_FILES</s:String>

<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8f6e98fe_002Dd45d_002D40bb_002D8f84_002Dbefc3c28f84e/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Session" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Project Location="D:\repos\Obj2Tiles\Obj2Tiles.Test" Presentation="&amp;lt;Obj2Tiles.Test&amp;gt;" /&gt;&#xD;
&lt;Project Location="D:\DATA\repos\Obj2Tiles\Obj2Tiles.Library.Test" Presentation="&amp;lt;Obj2Tiles.Library.Test&amp;gt;" /&gt;&#xD;
&lt;/SessionState&gt;</s:String>


Expand Down
Loading
Loading