support C# 10, 11 in DotRecast.Recast.Demo

This commit is contained in:
ikpil 2024-04-25 00:59:02 +09:00
parent 4a80473e2f
commit f22ec94038
6 changed files with 21 additions and 14 deletions

View File

@ -49,7 +49,7 @@ jobs:
uses: actions/checkout@v4
- name: Set up .NET 8.0
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

View File

@ -37,7 +37,7 @@ jobs:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}.x
@ -45,9 +45,7 @@ jobs:
run: dotnet restore
- name: Build
run: |
dotnet restore
dotnet build -c Release --no-restore --framework net${{ matrix.dotnet-version }}.0
run: dotnet build -c Release --no-restore --framework net${{ matrix.dotnet-version }}.0
- name: Test
run: dotnet test -c Release --no-build --verbosity normal --framework net${{ matrix.dotnet-version }}.0

View File

@ -33,7 +33,7 @@ jobs:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

View File

@ -15,7 +15,7 @@ jobs:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>DotRecast.Recast.Demo</PackageId>
<PackageReadmeFile>README.md</PackageReadmeFile>

View File

@ -32,15 +32,18 @@ public class GLCheckerTexture
_gl = gl;
}
public void Release()
public unsafe void Release()
{
if (m_texId != 0)
{
_gl.DeleteTextures(1, m_texId);
fixed (uint* p = &m_texId)
{
_gl.DeleteTextures(1, p);
}
}
}
public void Bind()
public unsafe void Bind()
{
if (m_texId == 0)
{
@ -50,7 +53,11 @@ public class GLCheckerTexture
uint TSIZE = 64;
int[] data = new int[TSIZE * TSIZE];
_gl.GenTextures(1, out m_texId);
fixed (uint* p = &m_texId)
{
_gl.GenTextures(1, p);
}
_gl.BindTexture(GLEnum.Texture2D, m_texId);
int level = 0;
@ -70,8 +77,10 @@ public class GLCheckerTexture
level++;
}
_gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMinFilter, (uint)GLEnum.LinearMipmapNearest);
_gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMagFilter, (uint)GLEnum.Linear);
uint linearMipmapNearest = (uint)GLEnum.LinearMipmapNearest;
uint linear = (uint)GLEnum.Linear;
_gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMinFilter, &linearMipmapNearest);
_gl.TexParameterI(GLEnum.Texture2D, GLEnum.TextureMagFilter, &linear);
}
else
{