Switch from DllImport to LibraryImport (#334)
This commit is contained in:
parent
d49c0f8474
commit
a1cde79294
4 changed files with 2617 additions and 1743 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,6 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace Raylib_cs;
|
||||
|
|
@ -19,153 +20,186 @@ public unsafe struct Float16
|
|||
public static unsafe partial class Raymath
|
||||
{
|
||||
/// <summary>
|
||||
/// Used by DllImport to load the native library
|
||||
/// Used by LibraryImport to load the native library
|
||||
/// </summary>
|
||||
public const string NativeLibName = Raylib.NativeLibName;
|
||||
|
||||
/// <summary>Clamp float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Clamp(float value, float min, float max);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Clamp(float value, float min, float max);
|
||||
|
||||
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Lerp(float start, float end, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Lerp(float start, float end, float amount);
|
||||
|
||||
/// <summary>Normalize input value within input range</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Normalize(float value, float start, float end);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Normalize(float value, float start, float end);
|
||||
|
||||
/// <summary>Remap input value within input range to output range</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Remap(float value,
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Remap(float value,
|
||||
float inputStart, float inputEnd,
|
||||
float outputStart, float outputEnd
|
||||
);
|
||||
|
||||
/// <summary>Wrap input value from min to max</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Wrap(float value, float min, float max);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Wrap(float value, float min, float max);
|
||||
|
||||
/// <summary>Check whether two given floats are almost equal</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int FloatEquals(float x, float y);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int FloatEquals(float x, float y);
|
||||
|
||||
/// <summary>Vector with components value 0.0f</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Zero();
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Zero();
|
||||
|
||||
/// <summary>Vector with components value 1.0f</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2One();
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2One();
|
||||
|
||||
/// <summary>Add two vectors (v1 + v2)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Add(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Add(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>Add vector and float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2AddValue(Vector2 v, float add);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2AddValue(Vector2 v, float add);
|
||||
|
||||
/// <summary>Subtract two vectors (v1 - v2)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>Subtract vector by float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2SubtractValue(Vector2 v, float sub);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2SubtractValue(Vector2 v, float sub);
|
||||
|
||||
/// <summary>Calculate vector length</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2Length(Vector2 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2Length(Vector2 v);
|
||||
|
||||
/// <summary>Calculate vector square length</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2LengthSqr(Vector2 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2LengthSqr(Vector2 v);
|
||||
|
||||
/// <summary>Calculate two vectors dot product</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2DotProduct(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>Calculate distance between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2Distance(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>Calculate square distance between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2DistanceSqr(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2DistanceSqr(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>
|
||||
/// Calculate angle between two vectors
|
||||
/// NOTE: Angle is calculated from origin point (0, 0)
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2Angle(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>
|
||||
/// Calculate angle defined by a two vectors line
|
||||
/// NOTE: Parameters need to be normalized
|
||||
/// Current implementation should be aligned with glm::angle
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector2LineAngle(Vector2 start, Vector2 end);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector2LineAngle(Vector2 start, Vector2 end);
|
||||
|
||||
/// <summary>Scale vector (multiply by value)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Scale(Vector2 v, float scale);
|
||||
|
||||
/// <summary>Multiply vector by vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Multiply(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Multiply(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>Negate vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Negate(Vector2 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Negate(Vector2 v);
|
||||
|
||||
/// <summary>Divide vector by vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Divide(Vector2 v1, Vector2 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Divide(Vector2 v1, Vector2 v2);
|
||||
|
||||
/// <summary>Normalize provided vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Normalize(Vector2 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Normalize(Vector2 v);
|
||||
|
||||
/// <summary>Transforms a Vector2 by a given Matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Transform(Vector2 v, Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Transform(Vector2 v, Matrix4x4 mat);
|
||||
|
||||
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
|
||||
|
||||
/// <summary>Calculate reflected vector to normal</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Reflect(Vector2 v, Vector2 normal);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Reflect(Vector2 v, Vector2 normal);
|
||||
|
||||
/// <summary>Rotate vector by angle</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Rotate(Vector2 v, float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Rotate(Vector2 v, float angle);
|
||||
|
||||
/// <summary>Move Vector towards target</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance);
|
||||
|
||||
/// <summary>Invert the given vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Invert(Vector2 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Invert(Vector2 v);
|
||||
|
||||
/// <summary>
|
||||
/// Clamp the components of the vector between min and max values specified by the given vectors
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max);
|
||||
|
||||
/// <summary>Clamp the magnitude of the vector between two min and max values</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2ClampValue(Vector2 v, float min, float max);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2ClampValue(Vector2 v, float min, float max);
|
||||
|
||||
/// <summary>Check whether two given vectors are almost equal</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Vector2Equals(Vector2 p, Vector2 q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int Vector2Equals(Vector2 p, Vector2 q);
|
||||
|
||||
/// <summary>Compute the direction of a refracted ray</summary>
|
||||
/// <param name="v">normalized direction of the incoming ray</param>
|
||||
|
|
@ -174,176 +208,215 @@ public static unsafe partial class Raymath
|
|||
/// ratio of the refractive index of the medium from where the ray comes
|
||||
/// to the refractive index of the medium on the other side of the surface
|
||||
/// </param>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector2Refract(Vector2 v, Vector2 n, float r);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector2Refract(Vector2 v, Vector2 n, float r);
|
||||
|
||||
/// <summary>Vector with components value 0.0f</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Zero();
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Zero();
|
||||
|
||||
/// <summary>Vector with components value 1.0f</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3One();
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3One();
|
||||
|
||||
/// <summary>Add two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Add vector and float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3AddValue(Vector3 v, float add);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3AddValue(Vector3 v, float add);
|
||||
|
||||
/// <summary>Subtract two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Subtract vector and float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3SubtractValue(Vector3 v, float sub);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3SubtractValue(Vector3 v, float sub);
|
||||
|
||||
/// <summary>Multiply vector by scalar</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Scale(Vector3 v, float scalar);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Scale(Vector3 v, float scalar);
|
||||
|
||||
/// <summary>Multiply vector by vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Multiply(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Multiply(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Calculate two vectors cross product</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Calculate one vector perpendicular vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Perpendicular(Vector3 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Perpendicular(Vector3 v);
|
||||
|
||||
/// <summary>Calculate vector length</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector3Length(Vector3 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector3Length(Vector3 v);
|
||||
|
||||
/// <summary>Calculate vector square length</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector3LengthSqr(Vector3 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector3LengthSqr(Vector3 v);
|
||||
|
||||
/// <summary>Calculate two vectors dot product</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector3DotProduct(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector3DotProduct(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Calculate distance between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector3Distance(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Calculate square distance between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float Vector3DistanceSqr(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float Vector3DistanceSqr(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Calculate angle between two vectors in XY and XZ</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector2 Vector3Angle(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector2 Vector3Angle(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Negate provided vector (invert direction)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Negate(Vector3 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Negate(Vector3 v);
|
||||
|
||||
/// <summary>Divide vector by vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Divide(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Divide(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Normalize provided vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Normalize(Vector3 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Normalize(Vector3 v);
|
||||
|
||||
/// <summary>Calculate the projection of the vector v1 on to v2</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Project(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Project(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Calculate the rejection of the vector v1 on to v2</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Reject(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Reject(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>
|
||||
/// Orthonormalize provided vectors<br/>
|
||||
/// Makes vectors normalized and orthogonal to each other<br/>
|
||||
/// Gram-Schmidt function implementation
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void Vector3OrthoNormalize(Vector3* v1, Vector3* v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial void Vector3OrthoNormalize(Vector3* v1, Vector3* v2);
|
||||
|
||||
/// <summary>Transforms a Vector3 by a given Matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Transform(Vector3 v, Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Transform(Vector3 v, Matrix4x4 mat);
|
||||
|
||||
/// <summary>Transform a vector by quaternion rotation</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
|
||||
|
||||
/// <summary>Rotates a vector around an axis</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);
|
||||
|
||||
/// <summary>Move Vector towards target</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance);
|
||||
|
||||
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
|
||||
|
||||
/// <summary>
|
||||
/// Calculate cubic hermite interpolation between two vectors and their tangents
|
||||
/// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount);
|
||||
|
||||
/// <summary>Calculate reflected vector to normal</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
|
||||
|
||||
/// <summary>Get min value for each pair of components</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Min(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Min(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>Get max value for each pair of components</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Max(Vector3 v1, Vector3 v2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Max(Vector3 v1, Vector3 v2);
|
||||
|
||||
/// <summary>
|
||||
/// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)<br/>
|
||||
/// NOTE: Assumes P is on the plane of the triangle
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
|
||||
|
||||
/// <summary>
|
||||
/// Projects a Vector3 from screen space into object space<br/>
|
||||
/// NOTE: We are avoiding calling other raymath functions despite available
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial 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);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Float3 Vector3ToFloatV(Vector3 v);
|
||||
|
||||
/// <summary>Invert the given vector</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Invert(Vector3 v);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Invert(Vector3 v);
|
||||
|
||||
/// <summary>
|
||||
/// Clamp the components of the vector between
|
||||
/// min and max values specified by the given vectors
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max);
|
||||
|
||||
/// <summary>Clamp the magnitude of the vector between two values</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3ClampValue(Vector3 v, float min, float max);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3ClampValue(Vector3 v, float min, float max);
|
||||
|
||||
/// <summary>Check whether two given vectors are almost equal</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int Vector3Equals(Vector3 p, Vector3 q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int Vector3Equals(Vector3 p, Vector3 q);
|
||||
|
||||
/// <summary>
|
||||
/// Compute the direction of a refracted ray where v specifies the
|
||||
|
|
@ -353,83 +426,101 @@ public static unsafe partial class Raymath
|
|||
/// from where the ray comes to the refractive index of the medium
|
||||
/// on the other side of the surface
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 Vector3Refract(Vector3 v, Vector3 n, float r);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 Vector3Refract(Vector3 v, Vector3 n, float r);
|
||||
|
||||
|
||||
/// <summary>Compute matrix determinant</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float MatrixDeterminant(Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float MatrixDeterminant(Matrix4x4 mat);
|
||||
|
||||
/// <summary>Get the trace of the matrix (sum of the values along the diagonal)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float MatrixTrace(Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float MatrixTrace(Matrix4x4 mat);
|
||||
|
||||
/// <summary>Transposes provided matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixTranspose(Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixTranspose(Matrix4x4 mat);
|
||||
|
||||
/// <summary>Invert provided matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixInvert(Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixInvert(Matrix4x4 mat);
|
||||
|
||||
/// <summary>Get identity matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixIdentity();
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixIdentity();
|
||||
|
||||
/// <summary>Add two matrices</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
|
||||
|
||||
/// <summary>Subtract two matrices (left - right)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixSubtract(Matrix4x4 left, Matrix4x4 right);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixSubtract(Matrix4x4 left, Matrix4x4 right);
|
||||
|
||||
/// <summary>
|
||||
/// Get two matrix multiplication<br/>
|
||||
/// NOTE: When multiplying matrices... the order matters!
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
|
||||
|
||||
/// <summary>Get translation matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixTranslate(float x, float y, float z);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixTranslate(float x, float y, float z);
|
||||
|
||||
/// <summary>
|
||||
/// Create rotation matrix from axis and angle<br/>
|
||||
/// NOTE: Angle should be provided in radians
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixRotate(Vector3 axis, float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixRotate(Vector3 axis, float angle);
|
||||
|
||||
/// <summary>Get x-rotation matrix (angle in radians)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixRotateX(float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixRotateX(float angle);
|
||||
|
||||
/// <summary>Get y-rotation matrix (angle in radians)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixRotateY(float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixRotateY(float angle);
|
||||
|
||||
/// <summary>Get z-rotation matrix (angle in radians)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixRotateZ(float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixRotateZ(float angle);
|
||||
|
||||
/// <summary>Get xyz-rotation matrix (angles in radians)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixRotateXYZ(Vector3 ang);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixRotateXYZ(Vector3 ang);
|
||||
|
||||
/// <summary>Get zyx-rotation matrix (angles in radians)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixRotateZYX(Vector3 ang);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixRotateZYX(Vector3 ang);
|
||||
|
||||
/// <summary>Get scaling matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixScale(float x, float y, float z);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixScale(float x, float y, float z);
|
||||
|
||||
/// <summary>Get perspective projection matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixFrustum(
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixFrustum(
|
||||
double left,
|
||||
double right,
|
||||
double bottom,
|
||||
|
|
@ -442,12 +533,14 @@ public static unsafe partial class Raymath
|
|||
/// Get perspective projection matrix<br/>
|
||||
/// NOTE: Angle should be provided in radians
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixPerspective(double fovy, double aspect, double near, double far);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixPerspective(double fovy, double aspect, double near, double far);
|
||||
|
||||
/// <summary>Get orthographic projection matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixOrtho(
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 MatrixOrtho(
|
||||
double left,
|
||||
double right,
|
||||
double bottom,
|
||||
|
|
@ -457,76 +550,93 @@ public static unsafe partial class Raymath
|
|||
);
|
||||
|
||||
/// <summary>Get camera look-at matrix (view matrix)</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial 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);
|
||||
[LibraryImport(Raylib.NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Float16 MatrixToFloatV(Matrix4x4 m);
|
||||
|
||||
|
||||
/// <summary>Add 2 quaternions</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionAdd(Quaternion q1, Quaternion q2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionAdd(Quaternion q1, Quaternion q2);
|
||||
|
||||
/// <summary>Add quaternion and float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionAddValue(Quaternion q, float add);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionAddValue(Quaternion q, float add);
|
||||
|
||||
/// <summary>Subtract 2 quaternions</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionSubtract(Quaternion q1, Quaternion q2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionSubtract(Quaternion q1, Quaternion q2);
|
||||
|
||||
/// <summary>Subtract quaternion and float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionSubtractValue(Quaternion q, float add);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionSubtractValue(Quaternion q, float add);
|
||||
|
||||
/// <summary>Get identity quaternion</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionIdentity();
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionIdentity();
|
||||
|
||||
/// <summary>Computes the length of a quaternion</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float QuaternionLength(Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial float QuaternionLength(Quaternion q);
|
||||
|
||||
/// <summary>Normalize provided quaternion</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionNormalize(Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionNormalize(Quaternion q);
|
||||
|
||||
/// <summary>Invert provided quaternion</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionInvert(Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionInvert(Quaternion q);
|
||||
|
||||
/// <summary>Calculate two quaternion multiplication</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
|
||||
|
||||
/// <summary>Scale quaternion by float value</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionScale(Quaternion q, float mul);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionScale(Quaternion q, float mul);
|
||||
|
||||
/// <summary>Divide two quaternions</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);
|
||||
|
||||
/// <summary>Calculate linear interpolation between two quaternions</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
|
||||
|
||||
/// <summary>Calculate slerp-optimized interpolation between two quaternions</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
|
||||
|
||||
/// <summary>Calculates spherical linear interpolation between two quaternions</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
|
||||
|
||||
/// <summary>
|
||||
/// Calculate quaternion cubic spline interpolation using Cubic Hermite Spline algorithm
|
||||
/// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionCubicHermiteSpline(
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionCubicHermiteSpline(
|
||||
Quaternion q1,
|
||||
Quaternion outTangent1,
|
||||
Quaternion q2,
|
||||
|
|
@ -535,53 +645,63 @@ public static unsafe partial class Raymath
|
|||
);
|
||||
|
||||
/// <summary>Calculate quaternion based on the rotation from one vector to another</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
|
||||
|
||||
/// <summary>Get a quaternion for a given rotation matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionFromMatrix(Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionFromMatrix(Matrix4x4 mat);
|
||||
|
||||
/// <summary>Get a matrix for a given quaternion</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Matrix4x4 QuaternionToMatrix(Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Matrix4x4 QuaternionToMatrix(Quaternion q);
|
||||
|
||||
/// <summary>
|
||||
/// Get rotation quaternion for an angle and axis<br/>
|
||||
/// NOTE: angle must be provided in radians
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
|
||||
|
||||
/// <summary>Get the rotation angle and axis for a given quaternion</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void QuaternionToAxisAngle(Quaternion q, Vector3* outAxis, float* outAngle);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial void QuaternionToAxisAngle(Quaternion q, Vector3* outAxis, float* outAngle);
|
||||
|
||||
/// <summary>
|
||||
/// Get the quaternion equivalent to Euler angles<br/>
|
||||
/// NOTE: Rotation order is ZYX
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionFromEuler(float pitch, float yaw, float roll);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionFromEuler(float pitch, float yaw, float roll);
|
||||
|
||||
/// <summary>
|
||||
/// Get the Euler angles equivalent to quaternion (roll, pitch, yaw)<br/>
|
||||
/// NOTE: Angles are returned in a Vector3 struct in radians
|
||||
/// </summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Vector3 QuaternionToEuler(Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Vector3 QuaternionToEuler(Quaternion q);
|
||||
|
||||
/// <summary>Transform a quaternion given a transformation matrix</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern Quaternion QuaternionTransform(Quaternion q, Matrix4x4 mat);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial Quaternion QuaternionTransform(Quaternion q, Matrix4x4 mat);
|
||||
|
||||
/// <summary>Check whether two given quaternions are almost equal</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int QuaternionEquals(Quaternion p, Quaternion q);
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int QuaternionEquals(Quaternion p, Quaternion q);
|
||||
|
||||
/// <summary>Decompose a transformation matrix into its rotational, translational and scaling components</summary>
|
||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void MatrixDecompose(
|
||||
[LibraryImport(NativeLibName)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial void MatrixDecompose(
|
||||
Matrix4x4 mat,
|
||||
Vector3* translation,
|
||||
Quaternion* rotation,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -2,30 +2,36 @@
|
|||
// For more information see the dotnet issue: https://github.com/dotnet/runtime/issues/9316
|
||||
// Example of va_list interop: https://github.com/jeremyVignelles/va-list-interop-demo
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Raylib_cs;
|
||||
|
||||
internal readonly struct Native
|
||||
internal readonly partial struct Native
|
||||
{
|
||||
internal const string Msvcrt = "msvcrt";
|
||||
internal const string Libc = "libc";
|
||||
internal const string LibSystem = "libSystem";
|
||||
|
||||
[DllImport(LibSystem, EntryPoint = "vasprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int VasPrintfApple(ref IntPtr buffer, IntPtr format, IntPtr args);
|
||||
[LibraryImport(LibSystem, EntryPoint = "vasprintf")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int VasPrintfApple(ref IntPtr buffer, IntPtr format, IntPtr args);
|
||||
|
||||
[DllImport(Libc, EntryPoint = "vsprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int VsPrintfLinux(IntPtr buffer, IntPtr format, IntPtr args);
|
||||
[LibraryImport(Libc, EntryPoint = "vsprintf")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int VsPrintfLinux(IntPtr buffer, IntPtr format, IntPtr args);
|
||||
|
||||
[DllImport(Msvcrt, EntryPoint = "vsprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int VsPrintfWindows(IntPtr buffer, IntPtr format, IntPtr args);
|
||||
[LibraryImport(Msvcrt, EntryPoint = "vsprintf")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int VsPrintfWindows(IntPtr buffer, IntPtr format, IntPtr args);
|
||||
|
||||
[DllImport(Libc, EntryPoint = "vsnprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int VsnPrintfLinux(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
|
||||
[LibraryImport(Libc, EntryPoint = "vsnprintf")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int VsnPrintfLinux(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
|
||||
|
||||
[DllImport(Msvcrt, EntryPoint = "vsnprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int VsnPrintfWindows(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
|
||||
[LibraryImport(Msvcrt, EntryPoint = "vsnprintf")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial int VsnPrintfWindows(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue