Merge branch 'main' into examples-backport
This commit is contained in:
commit
23b3659b1b
4 changed files with 43 additions and 27 deletions
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
|
|
@ -21,7 +21,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Setup .NET
|
- name: Set up .NET
|
||||||
uses: actions/setup-dotnet@v5
|
uses: actions/setup-dotnet@v5
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
|
|
@ -35,7 +35,6 @@ jobs:
|
||||||
- name: Create NuGet Package
|
- name: Create NuGet Package
|
||||||
run: dotnet pack Raylib-cs -c Release --output nuget
|
run: dotnet pack Raylib-cs -c Release --output nuget
|
||||||
|
|
||||||
|
|
||||||
- name: Restore + Install Built Package
|
- name: Restore + Install Built Package
|
||||||
run: |
|
run: |
|
||||||
dotnet restore
|
dotnet restore
|
||||||
|
|
@ -44,18 +43,18 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
dotnet test --verbosity normal
|
dotnet test --verbosity normal
|
||||||
|
|
||||||
- name: upload NuGet Package As Artifact
|
- name: Upload NuGet Package As Artifact
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
path: nuget/*
|
path: nuget/*
|
||||||
|
|
||||||
- name: upload NuGet Package As Release
|
- name: Upload NuGet Package As Release
|
||||||
uses: softprops/action-gh-release@v3
|
uses: softprops/action-gh-release@v3
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
files: nuget/*
|
files: nuget/*
|
||||||
|
|
||||||
- name: publish to NuGet
|
- name: Publish to NuGet
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: |
|
run: |
|
||||||
dotnet nuget push \
|
dotnet nuget push \
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,13 @@
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup Condition="'$(UseRaylibCsPackage)' != 'true'">
|
||||||
|
<ProjectReference Include="..\Raylib-cs\Raylib-cs.csproj"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Import Project="..\Raylib-cs\Raylib-cs.targets" Condition="'$(UseRaylibCsPackage)' != 'true'"/>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(UseRaylibCsPackage)' == 'true'">
|
||||||
<PackageReference Include="Raylib-cs" Version="$(RaylibCsVersion)"/>
|
<PackageReference Include="Raylib-cs" Version="$(RaylibCsVersion)"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ using Xunit;
|
||||||
|
|
||||||
namespace Raylib_cs.Tests;
|
namespace Raylib_cs.Tests;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
public static class BlittableHelper
|
public static class BlittableHelper
|
||||||
{
|
{
|
||||||
public static bool IsBlittable<T>()
|
public static bool IsBlittable<T>()
|
||||||
|
|
|
||||||
|
|
@ -130,16 +130,42 @@ public unsafe struct Model
|
||||||
public Matrix4x4* BoneMatrices;
|
public Matrix4x4* BoneMatrices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bones animated transformation matrices as span. Based on Skeleton.BoneCount length
|
/// Meshes as span. Based on MeshCount length
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Span<Matrix4x4> BoneMatricesAsSpan()
|
public Span<Mesh> MeshesAsSpan()
|
||||||
{
|
{
|
||||||
if (BoneMatrices == null || Skeleton.BoneCount <= 0)
|
if (Meshes == null || MeshCount <= 0)
|
||||||
{
|
{
|
||||||
return Span<Matrix4x4>.Empty;
|
return Span<Mesh>.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Span<Matrix4x4>(BoneMatrices, Skeleton.BoneCount);
|
return new Span<Mesh>(Meshes, MeshCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Materials as span. Based on MaterialCount length
|
||||||
|
/// </summary>
|
||||||
|
public Span<Material> MaterialsAsSpan()
|
||||||
|
{
|
||||||
|
if (Materials == null || MaterialCount <= 0)
|
||||||
|
{
|
||||||
|
return Span<Material>.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Span<Material>(Materials, MaterialCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mesh material number as span. Based on MeshCount length
|
||||||
|
/// </summary>
|
||||||
|
public Span<int> MeshMaterialAsSpan()
|
||||||
|
{
|
||||||
|
if (MeshMaterial == null || MeshCount <= 0)
|
||||||
|
{
|
||||||
|
return Span<int>.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Span<int>(MeshMaterial, MeshCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -156,29 +182,16 @@ public unsafe struct Model
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mesh material number as span. Based on MaterialCount length
|
/// Bones animated transformation matrices as span. Based on Skeleton.BoneCount length
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Span<int> MeshMaterialAsSpan()
|
public Span<Matrix4x4> BoneMatricesAsSpan()
|
||||||
{
|
{
|
||||||
if (MeshMaterial == null || MaterialCount <= 0)
|
if (BoneMatrices == null || Skeleton.BoneCount <= 0)
|
||||||
{
|
{
|
||||||
return Span<int>.Empty;
|
return Span<Matrix4x4>.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Span<int>(MeshMaterial, MaterialCount);
|
return new Span<Matrix4x4>(BoneMatrices, Skeleton.BoneCount);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Meshes as span. Based on MeshCount length
|
|
||||||
/// </summary>
|
|
||||||
public Span<Mesh> MeshesAsSpan()
|
|
||||||
{
|
|
||||||
if (Meshes == null || MeshCount <= 0)
|
|
||||||
{
|
|
||||||
return Span<Mesh>.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Span<Mesh>(Meshes, MeshCount);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue