Watch
2
0
Fork
You've already forked raylib-cs
0

Fix rlMultMatrixf

- Add missing ToFloatV functions to Raymath
- Fix rlMultMatrixf overload to use MatrixToFloatV
This commit is contained in:
Rgebee 2021-12-09 18:40:29 +00:00
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)]
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>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@ -313,6 +317,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
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>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]

View file

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