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:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
|
|
||||||
@@ -95,10 +96,28 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlScalef(float x, float y, float z);
|
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)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlMultMatrixf(float* matf);
|
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)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
|
public static extern void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user