From 6ac30f758f6271e823e738d273e127da636ba2c4 Mon Sep 17 00:00:00 2001 From: Chris Dill Date: Mon, 20 Jul 2026 21:52:59 +0100 Subject: [PATCH 1/2] Update Model span utils * Order based on field position * Fix length bug with MeshMaterialAsSpan * Add MaterialsAsSpan --- Raylib-cs/types/Model.cs | 59 ++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/Raylib-cs/types/Model.cs b/Raylib-cs/types/Model.cs index edde296..74da3f8 100644 --- a/Raylib-cs/types/Model.cs +++ b/Raylib-cs/types/Model.cs @@ -130,16 +130,42 @@ public unsafe struct Model public Matrix4x4* BoneMatrices; /// - /// Bones animated transformation matrices as span. Based on Skeleton.BoneCount length + /// Meshes as span. Based on MeshCount length /// - public Span BoneMatricesAsSpan() + public Span MeshesAsSpan() { - if (BoneMatrices == null || Skeleton.BoneCount <= 0) + if (Meshes == null || MeshCount <= 0) { - return Span.Empty; + return Span.Empty; } - return new Span(BoneMatrices, Skeleton.BoneCount); + return new Span(Meshes, MeshCount); + } + + /// + /// Materials as span. Based on MaterialCount length + /// + public Span MaterialsAsSpan() + { + if (Materials == null || MaterialCount <= 0) + { + return Span.Empty; + } + + return new Span(Materials, MaterialCount); + } + + /// + /// Mesh material number as span. Based on MeshCount length + /// + public Span MeshMaterialAsSpan() + { + if (MeshMaterial == null || MeshCount <= 0) + { + return Span.Empty; + } + + return new Span(MeshMaterial, MeshCount); } /// @@ -156,29 +182,16 @@ public unsafe struct Model } /// - /// Mesh material number as span. Based on MaterialCount length + /// Bones animated transformation matrices as span. Based on Skeleton.BoneCount length /// - public Span MeshMaterialAsSpan() + public Span BoneMatricesAsSpan() { - if (MeshMaterial == null || MaterialCount <= 0) + if (BoneMatrices == null || Skeleton.BoneCount <= 0) { - return Span.Empty; + return Span.Empty; } - return new Span(MeshMaterial, MaterialCount); - } - - /// - /// Meshes as span. Based on MeshCount length - /// - public Span MeshesAsSpan() - { - if (Meshes == null || MeshCount <= 0) - { - return Span.Empty; - } - - return new Span(Meshes, MeshCount); + return new Span(BoneMatrices, Skeleton.BoneCount); } } From b207e633ae952d5f52cee6fdf37999633f22e707 Mon Sep 17 00:00:00 2001 From: Chris Dill Date: Tue, 21 Jul 2026 07:58:12 +0100 Subject: [PATCH 2/2] Default tests to local project reference. Can optionally use the nuget package. --- .github/workflows/build.yml | 11 +++++------ Raylib-cs.Tests/Raylib-cs.Tests.csproj | 8 +++++++- Raylib-cs.Tests/RaylibTests.cs | 2 -- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 797afd3..aafc9df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: paths-ignore: - "README.md" - ".github/ISSUE_TEMPLATE/**" - + workflow_dispatch: jobs: @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v7 - - name: Setup .NET + - name: Set up .NET uses: actions/setup-dotnet@v5 with: dotnet-version: | @@ -34,7 +34,6 @@ jobs: - name: Create NuGet Package run: dotnet pack Raylib-cs -c Release --output nuget - - name: Restore + Install Built Package run: | @@ -44,18 +43,18 @@ jobs: run: | dotnet test --verbosity normal - - name: upload NuGet Package As Artifact + - name: Upload NuGet Package As Artifact uses: actions/upload-artifact@v7 with: path: nuget/* - - name: upload NuGet Package As Release + - name: Upload NuGet Package As Release uses: softprops/action-gh-release@v3 if: startsWith(github.ref, 'refs/tags/') with: files: nuget/* - - name: publish to NuGet + - name: Publish to NuGet if: startsWith(github.ref, 'refs/tags/') run: | dotnet nuget push \ diff --git a/Raylib-cs.Tests/Raylib-cs.Tests.csproj b/Raylib-cs.Tests/Raylib-cs.Tests.csproj index fb066da..759930e 100644 --- a/Raylib-cs.Tests/Raylib-cs.Tests.csproj +++ b/Raylib-cs.Tests/Raylib-cs.Tests.csproj @@ -15,7 +15,13 @@ - + + + + + + + diff --git a/Raylib-cs.Tests/RaylibTests.cs b/Raylib-cs.Tests/RaylibTests.cs index 745371f..410c638 100644 --- a/Raylib-cs.Tests/RaylibTests.cs +++ b/Raylib-cs.Tests/RaylibTests.cs @@ -3,8 +3,6 @@ using Xunit; namespace Raylib_cs.Tests; -using System.Collections.Generic; - public static class BlittableHelper { public static bool IsBlittable()