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

Updated target to Raylib 6 + synced invoke called with the changes in C. [WARNING: Breaking changes!]

This commit is contained in:
Meatcorps 2026-05-20 21:21:15 +02:00
commit 2a86968da0
11 changed files with 293 additions and 139 deletions

View file

@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetRaylibTag>5.5</TargetRaylibTag>
<TargetRaylibTag>6.0</TargetRaylibTag>
<Version>8.0.0</Version>
<PackageVersion>8.0.0</PackageVersion>
</PropertyGroup>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<EnableDefaultItems>false</EnableDefaultItems>
<AssemblyName>Raylib-cs</AssemblyName>
<RootNamespace>Raylib_cs</RootNamespace>

View file

@ -19,7 +19,7 @@ public static unsafe partial class Raylib
/// </summary>
public const string NativeLibName = "raylib";
public const string RAYLIB_VERSION = "5.5";
public const string RAYLIB_VERSION = "6.0";
public const float DEG2RAD = MathF.PI / 180.0f;
public const float RAD2DEG = 180.0f / MathF.PI;
@ -701,6 +701,8 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadRandomSequence(int* sequence);
// Misc. functions
/// <summary>Takes a screenshot of current screen (saved a .png)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -711,6 +713,13 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetConfigFlags(ConfigFlags flags);
/// <summary>Open URL with default system browser (if available)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void OpenURL(sbyte* url);
// Logging system
/// <summary>Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -721,6 +730,8 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetTraceLogLevel(TraceLogLevel logLevel);
// Memory management, using internal allocators
/// <summary>Internal memory allocator</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -745,29 +756,6 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetTraceLogCallback(delegate* unmanaged[Cdecl]<int, sbyte*, sbyte*, void> callback);
/// <summary>Set custom file binary data loader</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetLoadFileDataCallback(delegate* unmanaged[Cdecl]<sbyte*, int*, byte*> callback);
/// <summary>Set custom file binary data saver</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetSaveFileDataCallback(
delegate* unmanaged[Cdecl]<sbyte*, void*, int, CBool> callback
);
/// <summary>Set custom file text data loader</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetLoadFileTextCallback(delegate* unmanaged[Cdecl]<sbyte*, sbyte*> callback);
/// <summary>Set custom file text data saver</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetSaveFileTextCallback(delegate* unmanaged[Cdecl]<sbyte*, sbyte*, CBool> callback);
// Files management functions
/// <summary>Load file data as byte array (read)</summary>
@ -790,27 +778,81 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool ExportDataAsCode(byte* data, int dataSize, sbyte* fileName);
// Load text data from file (read), returns a '\0' terminated string
/// <summary>Load text data from file (read), returns a '\0' terminated string</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* LoadFileText(sbyte* fileName);
// Unload file text data allocated by LoadFileText()
/// <summary>Unload file text data allocated by LoadFileText()</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadFileText(sbyte* text);
// Save text data to file (write), string must be '\0' terminated, returns true on success
/// <summary>Save text data to file (write), string must be '\0' terminated, returns true on success</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool SaveFileText(sbyte* fileName, sbyte* text);
// Check if file exists
// File access custom callbacks
// WARNING: Callbacks setup is intended for advanced users
/// <summary>Set custom file binary data loader</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetLoadFileDataCallback(delegate* unmanaged[Cdecl]<sbyte*, int*, byte*> callback);
/// <summary>Set custom file binary data saver</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetSaveFileDataCallback(
delegate* unmanaged[Cdecl]<sbyte*, void*, int, CBool> callback
);
/// <summary>Set custom file text data loader</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetLoadFileTextCallback(delegate* unmanaged[Cdecl]<sbyte*, sbyte*> callback);
/// <summary>Set custom file text data saver</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetSaveFileTextCallback(delegate* unmanaged[Cdecl]<sbyte*, sbyte*, CBool> callback);
/// <summary>Rename file (if exists)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileRename(sbyte* fileName, sbyte* fileRename);
/// <summary>Remove file (if exists)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileRemove(sbyte* fileName);
/// <summary>Copy file from one path to another, dstPath created if it doesn't exist</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileCopy(sbyte* srcPath, sbyte* dstPath);
/// <summary>Move file from one path to another, dstPath created if it doesn't exist</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileMove(sbyte* srcPath, sbyte* dstPath);
/// <summary>Replace text in an existing file</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileTextReplace(sbyte* fileName, sbyte* search, sbyte* replacement);
/// <summary>Find text in existing file</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileTextFindIndex(sbyte* fileName, sbyte* search);
/// <summary>Check if file exists</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool FileExists(sbyte* fileName);
// Check if a directory path exists
/// <summary>Check if a directory path exists</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool DirectoryExists(sbyte* dirPath);
@ -825,6 +867,11 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int GetFileLength(sbyte* fileName);
/// <summary>Get file modification time (last write time)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial long GetFileModTime(sbyte* fileName);
/// <summary>Get pointer to extension for a filename string (includes dot: '.png')</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -865,6 +912,21 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int MakeDirectory(sbyte* dirPath);
/// <summary>Change working directory, return true on success</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool ChangeDirectory(sbyte* dirPath);
/// <summary>Check if a given path is a file or a directory</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool IsPathFile(sbyte* path);
/// <summary>Check if fileName is valid for the platform/OS</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool IsFileNameValid(sbyte* fileName);
/// <summary>Load directory filepaths</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -880,21 +942,6 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadDirectoryFiles(FilePathList files);
/// <summary>Check if a given path is a file or a directory</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool IsPathFile(sbyte* path);
/// <summary>Check if fileName is valid for the platform/OS</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool IsFileNameValid(sbyte* fileName);
/// <summary>Change working directory, return true on success</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool ChangeDirectory(sbyte* dir);
/// <summary>Check if a file has been dropped into window</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -910,11 +957,15 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadDroppedFiles(FilePathList files);
/// <summary>Get file modification time (last write time)</summary>
/// <summary>Get the file count in a directory</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial long GetFileModTime(sbyte* fileName);
public static partial FilePathList GetDirectoryFileCount(sbyte* dirPath);
/// <summary>Get the file count in a directory</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial FilePathList GetDirectoryFileCountEx(sbyte* dirPath, sbyte* filter, CBool scanSubdirs);
// Compression/Encoding functionality
@ -953,10 +1004,10 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint* ComputeSHA1(byte* data, int dataSize);
/// <summary>Open URL with default system browser (if available)</summary>
/// <summary>Compute SHA256 hash code, returns static int[8] (32 bytes)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void OpenURL(sbyte* url);
public static partial uint* ComputeSHA256(byte* data, int dataSize);
// Automation events functionality
@ -1031,11 +1082,6 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool IsKeyUp(KeyboardKey key);
/// <summary>Set a custom key to exit program (default is ESC)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetExitKey(KeyboardKey key);
/// <summary>
/// Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
/// </summary>
@ -1050,6 +1096,16 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int GetCharPressed();
/// <summary>Get gamepad internal name id</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* GetKeyName(KeyboardKey key);
/// <summary>Set a custom key to exit program (default is ESC)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetExitKey(KeyboardKey key);
// Input-related functions: gamepads
@ -1398,21 +1454,38 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color);
/// <summary>Draw a line using cubic-bezier curves in-out</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color);
/// <summary>Draw lines sequence</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawLineStrip(Vector2* points, int pointCount, Color color);
/// <summary>Draw a line using cubic-bezier curves in-out</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color);
/// <summary>Draw a color-filled circle</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawCircle(int centerX, int centerY, float radius, Color color);
/// <summary>Draw a color-filled circle (Vector version)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawCircleV(Vector2 center, float radius, Color color);
/// <summary>Draw a gradient-filled circle</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawCircleGradient(
int centerX,
int centerY,
float radius,
Color inner,
Color outer
);
/// <summary>Draw a piece of a circle</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -1437,22 +1510,6 @@ public static unsafe partial class Raylib
Color color
);
/// <summary>Draw a gradient-filled circle</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawCircleGradient(
int centerX,
int centerY,
float radius,
Color inner,
Color outer
);
/// <summary>Draw a color-filled circle (Vector version)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawCircleV(Vector2 center, float radius, Color color);
/// <summary>Draw circle outline</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -1468,11 +1525,21 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawEllipse(int centerX, int centerY, float radiusH, float radiusV, Color color);
/// <summary>Draw ellipse (Vector version)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawEllipseV(Vector2 center, float radiusH, float radiusV, Color color);
/// <summary>Draw ellipse outline</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawEllipseLines(int centerX, int centerY, float radiusH, float radiusV, Color color);
/// <summary>Draw ellipse outline (Vector version)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawEllipseLinesV(Vector2 center, float radiusH, float radiusV, Color color);
/// <summary>Draw ring</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -2372,6 +2439,11 @@ public static unsafe partial class Raylib
// Color/pixel related functions
/// <summary>Check if two colors are equal</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial CBool ColorIsEqual(Color col1, Color col2);
/// <summary>Get hexadecimal value for a Color (0xRRGGBBAA)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -2684,8 +2756,21 @@ public static unsafe partial class Raylib
// Text strings management functions (no UTF-8 strings, only byte chars)
// WARNING 1: Most of these functions use internal static buffers[], it's recommended to store returned data on user-side for re-use
// WARNING 2: Some functions allocate memory internally for the returned strings, those strings must be freed by user using MemFree()
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
/// <summary>Load text as separate lines ('\n')</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte** LoadTextLines(sbyte* text, int* count);
/// <summary>Unload text lines</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadTextLines(sbyte** text, int* lineCount);
/// <summary>Copy one string to another, returns bytes copied</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -2711,15 +2796,35 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* TextSubtext(sbyte* text, int position, int length);
/// <summary>Remove text spaces, concat words</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* TextRemoveSpaces(sbyte* text);
/// <summary>Get text between two strings</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* GetTextBetween(sbyte* text, sbyte* begin, sbyte* end);
/// <summary>Replace text string</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* TextReplace(sbyte* text, sbyte* search, sbyte* replacement);
/// <summary>Replace text string (WARNING: memory must be freed!)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* TextReplace(sbyte* text, sbyte* replace, sbyte* by);
public static partial sbyte* TextReplaceAlloc(sbyte* text, sbyte* search, sbyte* replacement);
/// <summary>Insert text in a position</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* TextInsert(sbyte* text, sbyte* insert, int position);
/// <summary>Insert text in a position (WARNING: memory must be freed!)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial sbyte* TextInsert(sbyte* text, sbyte* insert, int position);
public static partial sbyte* TextInsertAlloc(sbyte* text, sbyte* insert, int position);
/// <summary>Join text strings with delimiter</summary>
[LibraryImport(NativeLibName)]
@ -3004,23 +3109,6 @@ public static unsafe partial class Raylib
Color tint
);
/// <summary>Draw a model as points</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawModelPoints(Model model, Vector3 position, float scale, Color tint);
/// <summary>Draw a model as points with extended parameters</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DrawModelPointsEx(
Model model,
Vector3 position,
Vector3 rotationAxis,
float rotationAngle,
Vector3 scale,
Color tint
);
/// <summary>Draw bounding box (wires)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -3211,15 +3299,15 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial ModelAnimation* LoadModelAnimations(sbyte* fileName, int* animCount);
/// <summary>Update model animation pose (CPU)</summary>
/// <summary>Update model animation pose (vertex buffers and bone matrices)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UpdateModelAnimation(Model model, ModelAnimation anim, int frame);
public static partial void UpdateModelAnimation(Model model, ModelAnimation anim, float frame);
/// <summary>Update model animation mesh bone matrices (GPU skinning)</summary>
/// <summary>// Update model animation pose, blending two animations</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame);
public static partial void UpdateModelAnimationEx(Model model, ModelAnimation anim, float frame, ModelAnimation animB, float frameB, float blend);
/// <summary>Unload animation data</summary>
[LibraryImport(NativeLibName)]
@ -3247,7 +3335,6 @@ public static unsafe partial class Raylib
Vector3 center2,
float radius2
);
/// <summary>Detect collision between two bounding boxes</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -3421,7 +3508,7 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetSoundPitch(Sound sound, float pitch);
/// <summary>Set pan for a sound (0.5 is center)</summary>
/// <summary>Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetSoundPan(Sound sound, float pan);
@ -3518,7 +3605,7 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetMusicPitch(Music music, float pitch);
/// <summary>Set pan for a music (0.5 is center)</summary>
/// <summary>Set pan for a music (-1.0 left, 0.0 center, 1.0 right)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetMusicPan(Music music, float pan);
@ -3596,7 +3683,7 @@ public static unsafe partial class Raylib
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetAudioStreamPitch(AudioStream stream, float pitch);
/// <summary>Set pan for audio stream (0.5 is centered)</summary>
/// <summary>Set pan for audio stream (-1.0 to 1.0 range, 0.0 is centered)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetAudioStreamPan(AudioStream stream, float pan);
@ -3614,7 +3701,7 @@ public static unsafe partial class Raylib
delegate* unmanaged[Cdecl]<void*, uint, void> callback
);
/// <summary>Attach audio stream processor to stream</summary>
/// <summary>Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void AttachAudioStreamProcessor(
@ -3630,7 +3717,7 @@ public static unsafe partial class Raylib
delegate* unmanaged[Cdecl]<void*, uint, void> processor
);
/// <summary>Attach audio stream processor to the entire audio pipeline</summary>
/// <summary>Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void AttachAudioMixedProcessor(

View file

@ -102,6 +102,11 @@ public static unsafe partial class Raymath
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial float Vector2DotProduct(Vector2 v1, Vector2 v2);
/// <summary>Calculate two vectors cross product</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial float Vector2CrossProduct(Vector2 v1, Vector2 v2);
/// <summary>Calculate distance between two vectors</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -113,8 +118,9 @@ public static unsafe partial class Raymath
public static partial float Vector2DistanceSqr(Vector2 v1, Vector2 v2);
/// <summary>
/// Calculate angle between two vectors
/// NOTE: Angle is calculated from origin point (0, 0)
/// Calculate the signed angle from v1 to v2, relative to the origin (0, 0)
/// NOTE: Coordinate system convention: positive X right, positive Y down
/// positive angles appear clockwise, and negative angles appear counterclockwise
/// </summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -474,6 +480,13 @@ public static unsafe partial class Raymath
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
/// <summary>
/// Multiply matrix components by value
/// </summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial Matrix4x4 MatrixMultiplyValue(Matrix4x4 left, float value);
/// <summary>Get translation matrix</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -698,6 +711,14 @@ public static unsafe partial class Raymath
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial int QuaternionEquals(Quaternion p, Quaternion q);
/// <summary>
/// Compose a transformation matrix from rotational, translational and scaling components
/// TODO: This function is not following raymath conventions defined in header: NOT self-contained
/// </summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial Matrix4x4 MatrixCompose(Vector3 translation, Quaternion rotation, Vector3 scale);
/// <summary>Decompose a transformation matrix into its rotational, translational and scaling components</summary>
[LibraryImport(NativeLibName)]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]

View file

@ -462,16 +462,31 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Scissor(int x, int y, int width, int height);
/// <summary>Enable wire mode</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlEnableWireMode")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void EnableWireMode();
/// <summary>Enable point mode</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlEnablePointMode")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void EnablePointMode();
/// <summary>Disable point mode</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlDisablePointMode")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void DisablePointMode();
/// <summary>Set the point drawing size</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlSetPointSize")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void SetPointSize(float size);
/// <summary>Set the point drawing size</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlGetPointSize")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial float GetPointSize();
/// <summary>Disable wire mode</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlEnableWireMode")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void EnableWireMode();
/// <summary>Disable wire mode</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlDisableWireMode")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -569,6 +584,11 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void LoadExtensions(void* loader);
/// <summary>Get OpenGL procedure address</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlGetProcAddress")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void* GetProcAddress(sbyte* procName);
/// <summary>Get current OpenGL version</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlGetVersion")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@ -811,24 +831,43 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadFramebuffer(uint id);
/// <summary>Copy framebuffer pixel data to internal buffer</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlCopyFramebuffer")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void rlCopyFramebuffer(int x, int y, int width, int height, int format, void* pixels);
/// <summary>Copy framebuffer pixel data to internal buffer</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlResizeFramebuffer")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void rlResizeFramebuffer(int width, int height);
// Shaders management
/// <summary>Load (compile) shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlLoadShader")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint LoadShader(sbyte* vsCode, int type);
/// <summary>Load shader from code strings</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlLoadShaderCode")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint LoadShaderCode(sbyte* vsCode, sbyte* fsCode);
/// <summary>Compile custom shader and return shader id<br/>
/// (type: VERTEX_SHADER, FRAGMENT_SHADER, COMPUTE_SHADER)</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlCompileShader")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint CompileShader(sbyte* shaderCode, int type);
/// <summary>Load custom shader program</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlLoadShaderProgram")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint LoadShaderProgram(uint vShaderId, uint fShaderId);
public static partial uint LoadShaderProgram(sbyte* vsCode, sbyte* fsCode);
/// <summary>Load shader from code strings</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlLoadShaderProgramEx")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint LoadShaderProgramEx(uint vsId, uint fsId);
/// <summary>Load shader from code strings</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlLoadShaderProgramCompute")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint LoadShaderProgramCompute(uint csId);
/// <summary>Unload shader program</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlUnloadShader")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void UnloadShader(uint id);
/// <summary>Unload shader program</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlUnloadShaderProgram")]
@ -873,11 +912,6 @@ public static unsafe partial class Rlgl
// Compute shader management
/// <summary>Load compute shader program</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlLoadComputeShaderProgram")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial uint LoadComputeShaderProgram(uint shaderId);
/// <summary>Dispatch compute shader (equivalent to *draw* for graphics pilepine)</summary>
[LibraryImport(NativeLibName, EntryPoint = "rlComputeShaderDispatch")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]

View file

@ -181,38 +181,23 @@ public unsafe struct Mesh
#endregion
#region Animation vertex data
#region Skin data for animation
/// <summary>
/// Animated vertex positions (after bones transformations)
/// Number of bones (MAX: 256 bones)
/// </summary>
public float* AnimVertices = default;
/// <summary>
/// Animated normals (after bones transformations)
/// </summary>
public float* AnimNormals = default;
public int BoneCount;
/// <summary>
/// Vertex bone ids, up to 4 bones influence by vertex (skinning)
/// </summary>
public byte* BoneIds = default;
public byte* boneIndices = default;
/// <summary>
/// Vertex bone weight, up to 4 bones influence by vertex (skinning)
/// </summary>
public float* BoneWeights = default;
/// <summary>
/// Bones animated transformation matrices
/// </summary>
public Matrix4x4* BoneMatrices = default;
/// <summary>
/// Number of bones
/// </summary>
public int BoneCount;
#endregion
#region OpenGL identifiers

View file

@ -21,6 +21,32 @@ public unsafe struct BoneInfo
public int Parent;
}
/// <summary>
/// Skeleton, animation bones hierarchy
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ModelSkeleton
{
/// <summary>
/// Number of bones
/// </summary>
public int BoneCount;
/// <summary>
/// Bones information (skeleton)
/// </summary>
public BoneInfo* Bones;
/// <summary>
/// Bones base transformation (Transform[])
/// </summary>
public Transform* ModelAnimPose;
}
// Note:
// Anim pose, an array of Transform[]
// typedef Transform *ModelAnimPose; It's just an pointer array.
/// <summary>
/// Model type
/// </summary>

View file

@ -35,7 +35,8 @@ public enum ShaderLocationIndex
MapBrdf,
VertexBoneIds,
VertexBoneWeights,
BoneMatrices,
BoneTransforms,
BoneInstanceTransform,
MapDiffuse = MapAlbedo,
MapSpecular = MapMetalness,