2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

Create rlMultMatrixf safe overload

This commit is contained in:
2021-12-05 21:11:55 +11:00
parent 7325ecc17d
commit 5a198187ec

View File

@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
@@ -95,10 +96,28 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlScalef(float x, float y, float z);
/// <summary>Multiply the current matrix by another matrix</summary>
/// <summary>
/// Multiply the current matrix by another matrix
/// <br/>
/// Current Matrix can be set via <see cref="rlMatrixMode(int)"/>
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlMultMatrixf(float* matf);
public static void rlMultMatrixf(ref Matrix4x4 matf)
{
var pinned = new GCHandle();
try
{
pinned = GCHandle.Alloc(matf, GCHandleType.Pinned);
rlMultMatrixf((float*)pinned.AddrOfPinnedObject());
}
finally
{
pinned.Free();
}
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);