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

Fix rlMultMatrixf

- Add missing ToFloatV functions to Raymath
- Fix rlMultMatrixf overload to use MatrixToFloatV
This commit is contained in:
2021-12-09 18:40:29 +00:00
parent 776c84bb25
commit 0b081ce721
2 changed files with 12 additions and 11 deletions

View File

@@ -225,6 +225,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view); public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view);
/// <summary>Get Vector3 as float array</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float3 Vector3ToFloatV(Vector3 v);
/// <summary>Compute matrix determinant</summary> /// <summary>Compute matrix determinant</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -313,6 +317,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up); public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
/// <summary>Get float array of matrix data</summary>
[DllImport(Raylib.nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float16 MatrixToFloatV(Matrix4x4 m);
/// <summary>Add 2 quaternions</summary> /// <summary>Add 2 quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]

View File

@@ -104,18 +104,11 @@ namespace Raylib_cs
[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) /// <inheritdoc cref="rlMultMatrixf"/>
public static void rlMultMatrixf(Matrix4x4 matf)
{ {
var pinned = new GCHandle(); float16 f = Raymath.MatrixToFloatV(matf);
try rlMultMatrixf(f.v);
{
pinned = GCHandle.Alloc(matf, GCHandleType.Pinned);
rlMultMatrixf((float*)pinned.AddrOfPinnedObject());
}
finally
{
pinned.Free();
}
} }
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]