From a3dfd57b5a39cdf268ca7b0563c51603f640c0fd Mon Sep 17 00:00:00 2001
From: JupiterRider <60042618+JupiterRider@users.noreply.github.com>
Date: Sat, 21 Dec 2024 16:00:13 +0100
Subject: [PATCH] Update to raylib 5.5 (#279)
---
Examples/Core/Picking3D.cs | 5 +-
Examples/Core/VrSimulator.cs | 2 -
Examples/Models/MeshPicking.cs | 2 +-
Examples/Models/ModelLoading.cs | 2 +-
Examples/Models/SkyboxDemo.cs | 4 +-
Examples/Shaders/HybridRender.cs | 2 +-
Examples/Shaders/WriteDepth.cs | 2 +-
Examples/Shapes/DrawRectangleRounded.cs | 2 +-
README.md | 2 +-
Raylib-cs/Build.props | 8 +-
Raylib-cs/Raylib-cs.csproj | 2 +-
Raylib-cs/interop/Raylib.cs | 295 ++++++++++++++++++------
Raylib-cs/interop/Raymath.cs | 31 ++-
Raylib-cs/interop/Rlgl.cs | 37 ++-
Raylib-cs/types/Automation.cs | 35 +++
Raylib-cs/types/Input.cs | 11 +-
Raylib-cs/types/Mesh.cs | 11 +
Raylib-cs/types/Ray.cs | 2 +-
Raylib-cs/types/Raylib.Utils.cs | 127 +++++++++-
Raylib-cs/types/RenderBatch.cs | 17 +-
Raylib-cs/types/Rlgl.Utils.cs | 15 ++
Raylib-cs/types/Shader.cs | 7 +
Raylib-cs/types/Texture2D.cs | 7 +-
23 files changed, 504 insertions(+), 124 deletions(-)
create mode 100644 Raylib-cs/types/Automation.cs
create mode 100644 Raylib-cs/types/Rlgl.Utils.cs
diff --git a/Examples/Core/Picking3D.cs b/Examples/Core/Picking3D.cs
index afe8c10b..41c2f864 100644
--- a/Examples/Core/Picking3D.cs
+++ b/Examples/Core/Picking3D.cs
@@ -54,7 +54,7 @@ public static int Main()
{
if (!collision.Hit)
{
- ray = GetMouseRay(GetMousePosition(), camera);
+ ray = GetScreenToWorldRay(GetMousePosition(), camera);
// Check collision between ray and box
BoundingBox box = new(
@@ -68,7 +68,7 @@ public static int Main()
collision.Hit = false;
}
- ray = GetMouseRay(GetMousePosition(), camera);
+ ray = GetScreenToWorldRay(GetMousePosition(), camera);
}
//----------------------------------------------------------------------------------
@@ -119,4 +119,3 @@ public static int Main()
return 0;
}
}
-
diff --git a/Examples/Core/VrSimulator.cs b/Examples/Core/VrSimulator.cs
index 33055885..f2b3894a 100644
--- a/Examples/Core/VrSimulator.cs
+++ b/Examples/Core/VrSimulator.cs
@@ -35,7 +35,6 @@ public static int Main()
VResolution = 1200,
HScreenSize = 0.133793f,
VScreenSize = 0.0669f,
- VScreenCenter = 0.04678f,
EyeToScreenDistance = 0.041f,
LensSeparationDistance = 0.07f,
InterpupillaryDistance = 0.07f,
@@ -188,4 +187,3 @@ public static int Main()
return 0;
}
}
-
diff --git a/Examples/Models/MeshPicking.cs b/Examples/Models/MeshPicking.cs
index c0e098a3..e2dbceb7 100644
--- a/Examples/Models/MeshPicking.cs
+++ b/Examples/Models/MeshPicking.cs
@@ -99,7 +99,7 @@ public unsafe static int Main()
Color cursorColor = Color.White;
// Get ray and test against objects
- ray = GetMouseRay(GetMousePosition(), camera);
+ ray = GetScreenToWorldRay(GetMousePosition(), camera);
// Check ray collision aginst ground quad
RayCollision groundHitInfo = GetRayCollisionQuad(ray, g0, g1, g2, g3);
diff --git a/Examples/Models/ModelLoading.cs b/Examples/Models/ModelLoading.cs
index b1b82bde..b714a73e 100644
--- a/Examples/Models/ModelLoading.cs
+++ b/Examples/Models/ModelLoading.cs
@@ -104,7 +104,7 @@ public unsafe static int Main()
if (IsMouseButtonPressed(MouseButton.Left))
{
// Check collision between ray and box
- if (GetRayCollisionBox(GetMouseRay(GetMousePosition(), camera), bounds).Hit)
+ if (GetRayCollisionBox(GetScreenToWorldRay(GetMousePosition(), camera), bounds).Hit)
{
selected = !selected;
}
diff --git a/Examples/Models/SkyboxDemo.cs b/Examples/Models/SkyboxDemo.cs
index 974c9ddb..b9f67254 100644
--- a/Examples/Models/SkyboxDemo.cs
+++ b/Examples/Models/SkyboxDemo.cs
@@ -216,9 +216,9 @@ private static unsafe Texture2D GenTextureCubemap(Shader shader, Texture2D panor
// STEP 1: Setup framebuffer
//------------------------------------------------------------------------------------------
uint rbo = Rlgl.LoadTextureDepth(size, size, true);
- cubemap.Id = Rlgl.LoadTextureCubemap(null, size, format);
+ cubemap.Id = Rlgl.LoadTextureCubemap(null, size, format, 1);
- uint fbo = Rlgl.LoadFramebuffer(size, size);
+ uint fbo = Rlgl.LoadFramebuffer();
Rlgl.FramebufferAttach(
fbo,
rbo,
diff --git a/Examples/Shaders/HybridRender.cs b/Examples/Shaders/HybridRender.cs
index 3b232687..e6103277 100644
--- a/Examples/Shaders/HybridRender.cs
+++ b/Examples/Shaders/HybridRender.cs
@@ -160,7 +160,7 @@ private static unsafe RenderTexture2D LoadRenderTextureDepthTex(int width, int h
RenderTexture2D target = new();
// Load an empty framebuffer
- target.Id = Rlgl.LoadFramebuffer(width, height);
+ target.Id = Rlgl.LoadFramebuffer();
if (target.Id > 0)
{
diff --git a/Examples/Shaders/WriteDepth.cs b/Examples/Shaders/WriteDepth.cs
index fee44d45..7b6a6ac5 100644
--- a/Examples/Shaders/WriteDepth.cs
+++ b/Examples/Shaders/WriteDepth.cs
@@ -109,7 +109,7 @@ private static unsafe RenderTexture2D LoadRenderTextureDepthTex(int width, int h
RenderTexture2D target = new();
// Load an empty framebuffer
- target.Id = Rlgl.LoadFramebuffer(width, height);
+ target.Id = Rlgl.LoadFramebuffer();
if (target.Id > 0)
{
diff --git a/Examples/Shapes/DrawRectangleRounded.cs b/Examples/Shapes/DrawRectangleRounded.cs
index b46f9266..5190358c 100644
--- a/Examples/Shapes/DrawRectangleRounded.cs
+++ b/Examples/Shapes/DrawRectangleRounded.cs
@@ -70,7 +70,7 @@ public static int Main()
}
if (drawRoundedLines)
{
- DrawRectangleRoundedLines(rec, roundness, segments, (float)lineThick, ColorAlpha(Color.Maroon, 0.4f));
+ DrawRectangleRoundedLinesEx(rec, roundness, segments, (float)lineThick, ColorAlpha(Color.Maroon, 0.4f));
}
// Draw GUI controls
diff --git a/README.md b/README.md
index cab859f6..92890977 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ C# bindings for raylib, a simple and easy-to-use library to learn videogames pro
[![GitHub stars](https://img.shields.io/github/stars/chrisdill/raylib-cs?style=social)](https://github.com/chrisdill/raylib-cs/stargazers)
[![Build](https://github.com/chrisdill/raylib-cs/workflows/Build/badge.svg)](https://github.com/chrisdill/raylib-cs/actions?query=workflow%3ABuild)
-Raylib-cs targets net6.0 and uses the [official 5.0 release](https://github.com/raysan5/raylib/releases/tag/5.0) to build the native libraries.
+Raylib-cs targets net6.0 and uses the [official 5.5 release](https://github.com/raysan5/raylib/releases/tag/5.5) to build the native libraries.
## Status
diff --git a/Raylib-cs/Build.props b/Raylib-cs/Build.props
index 64e17220..ef344193 100644
--- a/Raylib-cs/Build.props
+++ b/Raylib-cs/Build.props
@@ -1,9 +1,9 @@
- 5.0
- 6.1.1
- 6.1.1
+ 5.5
+ 7.0.0
+ 7.0.0
-
\ No newline at end of file
+
diff --git a/Raylib-cs/Raylib-cs.csproj b/Raylib-cs/Raylib-cs.csproj
index 5bbb2261..a4b11995 100644
--- a/Raylib-cs/Raylib-cs.csproj
+++ b/Raylib-cs/Raylib-cs.csproj
@@ -33,7 +33,7 @@
-
+
diff --git a/Raylib-cs/interop/Raylib.cs b/Raylib-cs/interop/Raylib.cs
index 517edcfa..6d2daf73 100644
--- a/Raylib-cs/interop/Raylib.cs
+++ b/Raylib-cs/interop/Raylib.cs
@@ -13,7 +13,7 @@ public static unsafe partial class Raylib
///
public const string NativeLibName = "raylib";
- public const string RAYLIB_VERSION = "5.0";
+ public const string RAYLIB_VERSION = "5.5";
public const float DEG2RAD = MathF.PI / 180.0f;
public const float RAD2DEG = 180.0f / MathF.PI;
@@ -50,19 +50,19 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsWindowFullscreen();
- /// Check if window is currently hidden (only PLATFORM_DESKTOP)
+ /// Check if window is currently hidden
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsWindowHidden();
- /// Check if window is currently minimized (only PLATFORM_DESKTOP)
+ /// Check if window is currently minimized
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsWindowMinimized();
- /// Check if window is currently maximized (only PLATFORM_DESKTOP)
+ /// Check if window is currently maximized
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsWindowMaximized();
- /// Check if window is currently focused (only PLATFORM_DESKTOP)
+ /// Check if window is currently focused
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsWindowFocused();
@@ -82,39 +82,39 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearWindowState(ConfigFlags flag);
- /// Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
+ /// Toggle window state: fullscreen/windowed, resizes monitor to match window resolution
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ToggleFullscreen();
- /// Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
+ /// Toggle window state: borderless windowed, resizes window to match monitor resolution
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ToggleBorderlessWindowed();
- /// Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
+ /// Set window state: maximized, if resizable
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void MaximizeWindow();
- /// Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
+ /// Set window state: minimized, if resizable
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void MinimizeWindow();
- /// Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
+ /// Set window state: not minimized/maximized
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void RestoreWindow();
- /// Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
+ /// Set icon for window (single image, RGBA 32bit)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowIcon(Image image);
- /// Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
+ /// Set icon for window (multiple images, RGBA 32bit)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowIcons(Image* images, int count);
- /// Set title for window (only PLATFORM_DESKTOP)
+ /// Set title for window
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowTitle(sbyte* title);
- /// Set window position on screen (only PLATFORM_DESKTOP)
+ /// Set window position on screen
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowPosition(int x, int y);
@@ -134,11 +134,11 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowSize(int width, int height);
- /// Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
+ /// Set window opacity [0.0f..1.0f]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowOpacity(float opacity);
- /// Set window focused (only PLATFORM_DESKTOP)
+ /// Set window focused
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetWindowFocused();
@@ -166,7 +166,7 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetMonitorCount();
- /// Get current connected monitor
+ /// Get current monitor where window is placed
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int GetCurrentMonitor();
@@ -210,6 +210,10 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte* GetClipboardText();
+ /// Get clipboard image content (only works on Windows)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Image GetClipboardImage();
+
/// Set clipboard text content
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetClipboardText(sbyte* text);
@@ -358,9 +362,9 @@ public static unsafe partial class Raylib
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Shader LoadShaderFromMemory(sbyte* vsCode, sbyte* fsCode);
- /// Check if a shader is ready
+ /// Check if a shader is valid (loaded on GPU)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsShaderReady(Shader shader);
+ public static extern CBool IsShaderValid(Shader shader);
/// Get shader uniform location
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -404,9 +408,13 @@ int count
// Screen-space-related functions
- /// Get a ray trace from mouse position
+ /// Get a ray trace from screen position (i.e mouse)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Ray GetScreenToWorldRay(Vector2 position, Camera3D camera);
+
+ /// Get a ray trace from screen position (i.e mouse) in a viewport
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Ray GetMouseRay(Vector2 mousePosition, Camera3D camera);
+ public static extern Ray GetScreenToWorldRayEx(Vector2 position, Camera3D camera, int width, int height);
/// Get camera transform matrix (view matrix)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -599,11 +607,15 @@ public static extern void SetSaveFileDataCallback(
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte* GetApplicationDirectory();
+ /// Create directories (including full path requested), returns 0 on success
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int MakeDirectory(sbyte* dirPath);
+
/// Load directory filepaths
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern FilePathList LoadDirectoryFiles(sbyte* dirPath, int* count);
- /// Load directory filepaths with extension filtering and recursive directory scan
+ /// Load directory filepaths with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern FilePathList LoadDirectoryFilesEx(sbyte* basePath, sbyte* filter, CBool scanSubdirs);
@@ -615,6 +627,10 @@ public static extern void SetSaveFileDataCallback(
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool IsPathFile(sbyte* path);
+ /// Check if fileName is valid for the platform/OS
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool IsFileNameValid(sbyte* fileName);
+
/// Change working directory, return true on success
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool ChangeDirectory(sbyte* dir);
@@ -654,10 +670,56 @@ public static extern void SetSaveFileDataCallback(
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern byte* DecodeDataBase64(byte* data, int* outputSize);
+ /// Compute CRC32 hash code
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern uint ComputeCRC32(byte* data, int dataSize);
+
+ /// Compute MD5 hash code, returns static int[4] (16 bytes)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern uint* ComputeMD5(byte* data, int dataSize);
+
+ /// Compute SHA1 hash code, returns static int[5] (20 bytes)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern uint* ComputeSHA1(byte* data, int dataSize);
+
/// Open URL with default system browser (if available)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void OpenURL(sbyte* url);
+ // Automation events functionality
+
+ /// Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern AutomationEventList LoadAutomationEventList(sbyte* fileName);
+
+ /// Unload automation events list from file
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void UnloadAutomationEventList(AutomationEventList list);
+
+ /// Export automation events list as text file
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool ExportAutomationEventList(AutomationEventList list, sbyte* fileName);
+
+ /// Set automation event list to record to
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetAutomationEventList(AutomationEventList* list);
+
+ /// Set automation event internal base frame to start recording
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetAutomationEventBaseFrame(int frame);
+
+ /// Start recording automation events (AutomationEventList must be set)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void StartAutomationEventRecording();
+
+ /// Stop recording automation events
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void StopAutomationEventRecording();
+
+ /// Play a recorded automation event
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void PlayAutomationEvent(AutomationEvent ev);
+
//------------------------------------------------------------------------------------
// Input Handling Functions (Module: core)
//------------------------------------------------------------------------------------
@@ -743,6 +805,9 @@ public static extern void SetSaveFileDataCallback(
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int SetGamepadMappings(sbyte* mappings);
+ /// Set gamepad vibration for both motors (duration in seconds)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration);
// Input-related functions: mouse
@@ -841,7 +906,7 @@ public static extern void SetSaveFileDataCallback(
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Gesture GetGestureDetected();
- /// Get gesture hold time in milliseconds
+ /// Get gesture hold time in seconds
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float GetGestureHoldDuration();
@@ -955,13 +1020,21 @@ CBool rotateUp
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void SetShapesTexture(Texture2D texture, Rectangle source);
+ /// Get texture that is used for shapes drawing
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Texture2D GetShapesTexture();
+
+ /// Get texture source rectangle that is used for shapes drawing
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Rectangle GetShapesTextureRectangle();
+
// Basic shapes drawing functions
- /// Draw a pixel
+ /// Draw a pixel using geometry [Can be slow, use with care]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawPixel(int posX, int posY, Color color);
- /// Draw a pixel (Vector version)
+ /// Draw a pixel using geometry (Vector version) [Can be slow, use with care]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawPixelV(Vector2 position, Color color);
@@ -1038,8 +1111,8 @@ public static extern void DrawCircleGradient(
int centerX,
int centerY,
float radius,
- Color color1,
- Color color2
+ Color inner,
+ Color outer
);
/// Draw a color-filled circle (Vector version)
@@ -1109,8 +1182,8 @@ public static extern void DrawRectangleGradientV(
int posY,
int width,
int height,
- Color color1,
- Color color2
+ Color top,
+ Color bottom
);
/// Draw a horizontal-gradient-filled rectangle
@@ -1120,18 +1193,18 @@ public static extern void DrawRectangleGradientH(
int posY,
int width,
int height,
- Color color1,
- Color color2
+ Color left,
+ Color right
);
/// Draw a gradient-filled rectangle with custom vertex colors
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawRectangleGradientEx(
Rectangle rec,
- Color col1,
- Color col2,
- Color col3,
- Color col4
+ Color topLeft,
+ Color bottomLeft,
+ Color topRight,
+ Color bottomRight
);
/// Draw rectangle outline
@@ -1146,9 +1219,18 @@ Color col4
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color);
- /// Draw rectangle with rounded edges outline
+ /// Draw rectangle lines with rounded edges
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawRectangleRoundedLines(
+ Rectangle rec,
+ float roundness,
+ int segments,
+ Color color
+ );
+
+ /// Draw rectangle with rounded edges outline
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawRectangleRoundedLinesEx(
Rectangle rec,
float roundness,
int segments,
@@ -1274,6 +1356,10 @@ float radius2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
+ /// Check if circle collides with a line created betweeen two points [p1] and [p2]
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2);
+
/// Check if point is inside rectangle
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern CBool CheckCollisionPointRec(Vector2 point, Rectangle rec);
@@ -1334,10 +1420,6 @@ public static extern Image LoadImageRaw(
int headerSize
);
- /// Load image from SVG file data or string with specified size
- [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern Image LoadImageSvg(sbyte* fileName, int width, int height);
-
/// Load image sequence from file (frames appended to image.data)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image LoadImageAnim(sbyte* fileName, int* frames);
@@ -1354,9 +1436,9 @@ int headerSize
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image LoadImageFromScreen();
- /// Check if an image is ready
+ /// Check if an image is valid (data and parameters)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsImageReady(Image image);
+ public static extern CBool IsImageValid(Image image);
/// Unload image from CPU memory (RAM)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1442,6 +1524,10 @@ Color col2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image ImageFromImage(Image image, Rectangle rec);
+ /// Create an image from a selected channel of another image (GRAYSCALE)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Image ImageFromChannel(Image image, int selectedChannel);
+
/// Create an image from text (default font)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Image ImageText(sbyte* text, int fontSize, Color color);
@@ -1482,6 +1568,10 @@ Color col2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageBlurGaussian(Image* image, int blurSize);
+ /// Apply custom square convolution kernel to image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageKernelConvolution(Image* image, float* kernel, int kernelSize);
+
/// Resize image (Bicubic scaling algorithm)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageResize(Image* image, int newWidth, int newHeight);
@@ -1608,6 +1698,10 @@ Color color
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawLineV(Image* dst, Vector2 start, Vector2 end, Color color);
+ /// Draw a line defining thickness within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawLineEx(Image* dst, Vector2 start, Vector2 end, int thick, Color color);
+
/// Draw circle within an image
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawCircle(Image* dst, int centerX, int centerY, int radius, Color color);
@@ -1647,6 +1741,26 @@ Color color
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDrawRectangleLines(Image* dst, Rectangle rec, int thick, Color color);
+ /// Draw triangle within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangle(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color);
+
+ /// Draw triangle with interpolated colors within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleEx(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3);
+
+ /// Draw triangle outline within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleLines(Image* dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color);
+
+ /// Draw a triangle fan defined by points within an image (first vertex is the center)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleFan(Image* dst, Vector2* points, int pointCount, Color color);
+
+ /// Draw a triangle strip defined by points within an image
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ImageDrawTriangleStrip(Image* dst, Vector2* points, int pointCount, Color color);
+
/// Draw a source image within a destination image (tint applied to source)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImageDraw(Image* dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint);
@@ -1687,17 +1801,17 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern RenderTexture2D LoadRenderTexture(int width, int height);
- /// Check if a texture is ready
+ /// Check if a texture is valid (loaded in GPU)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsTextureReady(Texture2D texture);
+ public static extern CBool IsTextureValid(Texture2D texture);
/// Unload texture from GPU memory (VRAM)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadTexture(Texture2D texture);
- /// Check if a render texture is ready
+ /// Check if a render texture is valid (loaded in GPU)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsRenderTextureReady(RenderTexture2D target);
+ public static extern CBool IsRenderTextureValid(RenderTexture2D target);
/// Unload render texture from GPU memory (VRAM)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -1776,7 +1890,7 @@ Color tint
// Color/pixel related functions
- /// Get hexadecimal value for a Color
+ /// Get hexadecimal value for a Color (0xRRGGBBAA)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int ColorToInt(Color color);
@@ -1816,6 +1930,10 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color ColorAlphaBlend(Color dst, Color src, Color tint);
+ /// Get color lerp interpolation between two colors, factor [0.0f..1.0f]
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Color ColorLerp(Color color1, Color color2, float factor);
+
/// Get Color structure from hexadecimal value
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Color GetColor(uint hexValue);
@@ -1848,8 +1966,8 @@ Color tint
public static extern Font LoadFont(sbyte* fileName);
///
- /// Load font from file with extended parameters, use NULL for fontChars and 0 for glyphCount to load
- /// the default character set
+ /// Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load
+ /// the default character set, font size is provided in pixels height
///
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Font LoadFontEx(sbyte* fileName, int fontSize, int* codepoints, int codepointCount);
@@ -1869,9 +1987,9 @@ public static extern Font LoadFontFromMemory(
int codepointCount
);
- /// Check if a font is ready
+ /// Check if a font is valid (font data loaded, WARNING: GPU texture not checked)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsFontReady(Font font);
+ public static extern CBool IsFontValid(Font font);
/// Load font data for further use
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2039,7 +2157,7 @@ Color tint
// Text strings management functions (no UTF-8 strings, only byte chars)
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
- // Copy one string to another, returns bytes copied
+ /// Copy one string to another, returns bytes copied
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TextCopy(sbyte* dst, sbyte* src);
@@ -2095,10 +2213,21 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern sbyte* TextToPascal(sbyte* text);
+ /// Get Snake case notation version of provided string
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern sbyte* TextToSnake(sbyte* text);
+
+ /// Get Camel case notation version of provided string
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern sbyte* TextToCamel(sbyte* text);
+
/// Get integer value from text (negative values not supported)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int TextToInteger(sbyte* text);
+ /// Get float value from text (negative values not supported)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern float TextToFloat(sbyte* text);
//------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models)
@@ -2253,9 +2382,9 @@ Color color
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Model LoadModelFromMesh(Mesh mesh);
- /// Check if a model is ready
+ /// Check if a model is valid (loaded in GPU, VAO/VBOs)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsModelReady(Model model);
+ public static extern CBool IsModelValid(Model model);
/// Unload model from memory (RAM and/or VRAM)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2298,6 +2427,21 @@ public static extern void DrawModelWiresEx(
Color tint
);
+ /// Draw a model as points
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawModelPoints(Model model, Vector3 position, float scale, Color tint);
+
+ /// Draw a model as points with extended parameters
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void DrawModelPointsEx(
+ Model model,
+ Vector3 position,
+ Vector3 rotationAxis,
+ float rotationAngle,
+ Vector3 scale,
+ Color tint
+ );
+
/// Draw bounding box (wires)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawBoundingBox(BoundingBox box, Color color);
@@ -2308,7 +2452,7 @@ public static extern void DrawBillboard(
Camera3D camera,
Texture2D texture,
Vector3 center,
- float size,
+ float scale,
Color tint
);
@@ -2360,10 +2504,6 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void DrawMeshInstanced(Mesh mesh, Material material, Matrix4x4* transforms, int instances);
- /// Export mesh data to file, returns true on success
- [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool ExportMesh(Mesh mesh, sbyte* fileName);
-
/// Compute mesh bounding box limits
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern BoundingBox GetMeshBoundingBox(Mesh mesh);
@@ -2372,6 +2512,13 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void GenMeshTangents(Mesh* mesh);
+ /// Export mesh data to file, returns true on success
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool ExportMesh(Mesh mesh, sbyte* fileName);
+
+ /// Export mesh as code file (.h) defining multiple arrays of vertex attributes
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CBool ExportMeshAsCode(Mesh mesh, sbyte* fileName);
// Mesh generation functions
@@ -2431,9 +2578,9 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Material LoadMaterialDefault();
- /// Check if a material is ready
+ /// Check if a material is valid (shader assigned, map textures loaded in GPU)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsMaterialReady(Material material);
+ public static extern CBool IsMaterialValid(Material material);
/// Unload material from GPU memory (VRAM)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2454,10 +2601,14 @@ Color tint
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern ModelAnimation* LoadModelAnimations(sbyte* fileName, int* animCount);
- /// Update model animation pose
+ /// Update model animation pose (CPU)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdateModelAnimation(Model model, ModelAnimation anim, int frame);
+ /// Update model animation mesh bone matrices (GPU skinning)
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame);
+
/// Unload animation data
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadModelAnimation(ModelAnimation anim);
@@ -2547,9 +2698,9 @@ float radius2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Wave LoadWaveFromMemory(sbyte* fileType, byte* fileData, int dataSize);
- /// Checks if wave data is ready
+ /// Checks if wave data is valid (data loaded and parameters)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsWaveReady(Wave wave);
+ public static extern CBool IsWaveValid(Wave wave);
/// Load sound from file
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2563,9 +2714,9 @@ float radius2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Sound LoadSoundAlias(Sound source);
- /// Checks if a sound is ready
+ /// Checks if a sound is valid (data loaded and buffers initialized)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsSoundReady(Sound sound);
+ public static extern CBool IsSoundValid(Sound sound);
/// Update sound buffer with new data
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2634,9 +2785,9 @@ float radius2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Wave WaveCopy(Wave wave);
- /// Crop a wave to defined samples range
+ /// Crop a wave to defined frames range
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern void WaveCrop(Wave* wave, int initSample, int finalSample);
+ public static extern void WaveCrop(Wave* wave, int initFrame, int finalFrame);
/// Convert wave data to desired format
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2660,9 +2811,9 @@ float radius2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Music LoadMusicStreamFromMemory(sbyte* fileType, byte* data, int dataSize);
- /// Checks if a music stream is ready
+ /// Checks if a music stream is valid (context and buffers initialized)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsMusicReady(Music music);
+ public static extern CBool IsMusicValid(Music music);
/// Unload music stream
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -2723,9 +2874,9 @@ float radius2
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern AudioStream LoadAudioStream(uint sampleRate, uint sampleSize, uint channels);
- /// Checks if an audio stream is ready
+ /// Checks if an audio stream is valid (buffers initialized)
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
- public static extern CBool IsAudioStreamReady(AudioStream stream);
+ public static extern CBool IsAudioStreamValid(AudioStream stream);
/// Unload audio stream and free memory
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
diff --git a/Raylib-cs/interop/Raymath.cs b/Raylib-cs/interop/Raymath.cs
index eca66717..703d6ade 100644
--- a/Raylib-cs/interop/Raymath.cs
+++ b/Raylib-cs/interop/Raymath.cs
@@ -170,6 +170,15 @@ float outputEnd
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Vector2Equals(Vector2 p, Vector2 q);
+ /// Compute the direction of a refracted ray
+ /// normalized direction of the incoming ray
+ /// normalized normal vector of the interface of two optical media
+ ///
+ /// 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
+ ///
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Vector2 Vector2Refract(Vector2 v, Vector2 n, float r);
/// Vector with components value 0.0f
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -275,10 +284,21 @@ float outputEnd
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);
+ /// Move Vector towards target
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Vector3 Vector3MoveTowards(Vector3 v, Vector3 target, float maxDistance);
+
/// Calculate linear interpolation between two vectors
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
+ ///
+ /// 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
+ ///
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vector3 tangent2, float amount);
+
/// Calculate reflected vector to normal
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
@@ -417,8 +437,8 @@ public static extern Matrix4x4 MatrixFrustum(
double right,
double bottom,
double top,
- double near,
- double far
+ double nearPlane,
+ double farPlane
);
///
@@ -504,6 +524,13 @@ double far
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
+ ///
+ /// 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
+ ///
+ [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern Quaternion QuaternionCubicHermiteSpline(Quaternion q1, Quaternion outTangent1, Quaternion q2, Quaternion inTangent2, float t);
+
/// Calculate quaternion based on the rotation from one vector to another
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
diff --git a/Raylib-cs/interop/Rlgl.cs b/Raylib-cs/interop/Rlgl.cs
index 9f6cf7a0..238cfab0 100644
--- a/Raylib-cs/interop/Rlgl.cs
+++ b/Raylib-cs/interop/Rlgl.cs
@@ -163,6 +163,18 @@ double zfar
[DllImport(NativeLibName, EntryPoint = "rlViewport", CallingConvention = CallingConvention.Cdecl)]
public static extern void Viewport(int x, int y, int width, int height);
+ /// Set clip planes distances
+ [DllImport(NativeLibName, EntryPoint = "rlSetClipPlanes", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetClipPlanes(double nearPlane, double farPlane);
+
+ /// Get cull plane distance near
+ [DllImport(NativeLibName, EntryPoint = "rlGetCullDistanceNear", CallingConvention = CallingConvention.Cdecl)]
+ public static extern double GetCullDistanceNear();
+
+ /// Get cull plane distance far
+ [DllImport(NativeLibName, EntryPoint = "rlGetCullDistanceFar", CallingConvention = CallingConvention.Cdecl)]
+ public static extern double GetCullDistanceFar();
+
// ------------------------------------------------------------------------------------
// Functions Declaration - Vertex level operations
@@ -316,10 +328,18 @@ public static void Begin(DrawMode mode)
[DllImport(NativeLibName, EntryPoint = "rlDisableFramebuffer", CallingConvention = CallingConvention.Cdecl)]
public static extern void DisableFramebuffer();
+ /// Get the currently active render texture (fbo), 0 for default framebuffer
+ [DllImport(NativeLibName, EntryPoint = "rlGetActiveFramebuffer", CallingConvention = CallingConvention.Cdecl)]
+ public static extern uint GetActiveFramebuffer();
+
/// Blit active framebuffer to main framebuffer
[DllImport(NativeLibName, EntryPoint = "rlBlitFramebuffer", CallingConvention = CallingConvention.Cdecl)]
public static extern void BlitFramebuffer();
+ /// Bind framebuffer (FBO)
+ [DllImport(NativeLibName, EntryPoint = "rlBindFramebuffer", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void BindFramebuffer(uint target, uint framebuffer);
+
/// Activate multiple draw color buffers
[DllImport(NativeLibName, EntryPoint = "rlActiveDrawBuffers", CallingConvention = CallingConvention.Cdecl)]
public static extern void ActiveDrawBuffers(int count);
@@ -359,6 +379,10 @@ public static void Begin(DrawMode mode)
[DllImport(NativeLibName, EntryPoint = "rlDisableBackfaceCulling", CallingConvention = CallingConvention.Cdecl)]
public static extern void DisableBackfaceCulling();
+ /// Color mask control
+ [DllImport(NativeLibName, EntryPoint = "rlColorMask", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void ColorMask(CBool r, CBool g, CBool b, CBool a);
+
/// Set face culling mode
[DllImport(NativeLibName, EntryPoint = "rlSetCullFace", CallingConvention = CallingConvention.Cdecl)]
public static extern void SetCullFace(int mode);
@@ -548,6 +572,7 @@ int glEqAlpha
[DllImport(NativeLibName, EntryPoint = "rlUnloadVertexBuffer", CallingConvention = CallingConvention.Cdecl)]
public static extern void UnloadVertexBuffer(uint vboId);
+ /// Set vertex attribute data configuration
[DllImport(NativeLibName, EntryPoint = "rlSetVertexAttribute", CallingConvention = CallingConvention.Cdecl)]
public static extern void SetVertexAttribute(
uint index,
@@ -555,7 +580,7 @@ public static extern void SetVertexAttribute(
int type,
CBool normalized,
int stride,
- void* pointer
+ int offset
);
[DllImport(NativeLibName, EntryPoint = "rlSetVertexAttributeDivisor", CallingConvention = CallingConvention.Cdecl)]
@@ -593,9 +618,9 @@ int instances
[DllImport(NativeLibName, EntryPoint = "rlLoadTextureDepth", CallingConvention = CallingConvention.Cdecl)]
public static extern uint LoadTextureDepth(int width, int height, CBool useRenderBuffer);
- /// Load texture cubemap
+ /// Load texture cubemap data
[DllImport(NativeLibName, EntryPoint = "rlLoadTextureCubemap", CallingConvention = CallingConvention.Cdecl)]
- public static extern uint LoadTextureCubemap(void* data, int size, PixelFormat format);
+ public static extern uint LoadTextureCubemap(void* data, int size, PixelFormat format, int mipmapCount);
/// Update GPU texture with new data
[DllImport(NativeLibName, EntryPoint = "rlUpdateTexture", CallingConvention = CallingConvention.Cdecl)]
@@ -643,7 +668,7 @@ public static extern void GetGlTextureFormats(
/// Load an empty framebuffer
[DllImport(NativeLibName, EntryPoint = "rlLoadFramebuffer", CallingConvention = CallingConvention.Cdecl)]
- public static extern uint LoadFramebuffer(int width, int height);
+ public static extern uint LoadFramebuffer();
/// Attach texture/renderbuffer to a framebuffer
[DllImport(NativeLibName, EntryPoint = "rlFramebufferAttach", CallingConvention = CallingConvention.Cdecl)]
@@ -699,6 +724,10 @@ int mipLevel
[DllImport(NativeLibName, EntryPoint = "rlSetUniformMatrix", CallingConvention = CallingConvention.Cdecl)]
public static extern void SetUniformMatrix(int locIndex, Matrix4x4 mat);
+ /// Set shader value matrices
+ [DllImport(NativeLibName, EntryPoint = "rlSetUniformMatrices", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void SetUniformMatrices(int locIndex, Matrix4x4* mat, int count);
+
/// Set shader value sampler
[DllImport(NativeLibName, EntryPoint = "rlSetUniformSampler", CallingConvention = CallingConvention.Cdecl)]
public static extern void SetUniformSampler(int locIndex, uint textureId);
diff --git a/Raylib-cs/types/Automation.cs b/Raylib-cs/types/Automation.cs
new file mode 100644
index 00000000..21b7cd67
--- /dev/null
+++ b/Raylib-cs/types/Automation.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Raylib_cs;
+
+/// Automation event
+[StructLayout(LayoutKind.Sequential)]
+public unsafe struct AutomationEvent
+{
+ /// Event frame
+ public uint Frame;
+
+ /// Event type (AutomationEventType)
+ public uint Type;
+
+ /// Event parameters (if required)
+ public fixed int Params[4];
+}
+
+/// Automation event list
+[StructLayout(LayoutKind.Sequential)]
+public unsafe struct AutomationEventList
+{
+ /// Events max entries (MAX_AUTOMATION_EVENTS)
+ public uint Capacity;
+
+ /// Events entries count
+ public uint Count;
+
+ /// Events entries
+ public AutomationEvent* Events;
+
+ ///
+ public ReadOnlySpan EventsAsSpan => new(Events, (int)Count);
+}
diff --git a/Raylib-cs/types/Input.cs b/Raylib-cs/types/Input.cs
index 2770b5e5..03bd1d24 100644
--- a/Raylib-cs/types/Input.cs
+++ b/Raylib-cs/types/Input.cs
@@ -128,7 +128,7 @@ public enum KeyboardKey
// Android key buttons
Back = 4,
- Menu = 82,
+ Menu = 5,
VolumeUp = 24,
VolumeDown = 25
}
@@ -305,7 +305,7 @@ public enum GamepadButton
RightFaceUp,
///
- /// Gamepad right button right (i.e. PS3: Square, Xbox: X)
+ /// Gamepad right button right (i.e. PS3: Circle, Xbox: B)
///
RightFaceRight,
@@ -315,7 +315,7 @@ public enum GamepadButton
RightFaceDown,
///
- /// Gamepad right button left (i.e. PS3: Circle, Xbox: B)
+ /// Gamepad right button left (i.e. PS3: Square, Xbox: X)
///
RightFaceLeft,
@@ -411,11 +411,6 @@ public unsafe partial struct VrDeviceInfo
///
public float VScreenSize;
- ///
- /// HMD screen center in meters
- ///
- public float VScreenCenter;
-
///
/// HMD distance between eye and display in meters
///
diff --git a/Raylib-cs/types/Mesh.cs b/Raylib-cs/types/Mesh.cs
index e4bb2c4c..16733c47 100644
--- a/Raylib-cs/types/Mesh.cs
+++ b/Raylib-cs/types/Mesh.cs
@@ -1,4 +1,5 @@
using System;
+using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs;
@@ -202,6 +203,16 @@ public readonly Span IndicesAs() where T : unmanaged
///
public float* BoneWeights = default;
+ ///
+ /// Bones animated transformation matrices
+ ///
+ public Matrix4x4* BoneMatrices = default;
+
+ ///
+ /// Number of bones
+ ///
+ public int BoneCount;
+
#endregion
#region OpenGL identifiers
diff --git a/Raylib-cs/types/Ray.cs b/Raylib-cs/types/Ray.cs
index ff829f24..768dd6ab 100644
--- a/Raylib-cs/types/Ray.cs
+++ b/Raylib-cs/types/Ray.cs
@@ -15,7 +15,7 @@ public partial struct Ray
public Vector3 Position;
///
- /// Ray direction
+ /// Ray direction (normalized)
///
public Vector3 Direction;
diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs
index 7213bce7..60df969f 100644
--- a/Raylib-cs/types/Raylib.Utils.cs
+++ b/Raylib-cs/types/Raylib.Utils.cs
@@ -119,13 +119,6 @@ public static Image LoadImageRaw(string fileName, int width, int height, PixelFo
return LoadImageRaw(str1.AsPointer(), width, height, format, headerSize);
}
- /// Load image sequence from file (frames appended to image.data)
- public static Image LoadImageSvg(string fileName, int width, int height)
- {
- using var str1 = fileName.ToAnsiBuffer();
- return LoadImageSvg(str1.AsPointer(), width, height);
- }
-
/// Load image sequence from file (frames appended to image.data)
public static Image LoadImageAnim(string fileName, out int frames)
{
@@ -514,6 +507,18 @@ public static void ImageBlurGaussian(ref Image image, int blurSize)
}
}
+ /// Apply custom square convolution kernel to image
+ public static void ImageKernelConvolution(ref Image image, float[] kernel)
+ {
+ fixed (Image* imagePtr = &image)
+ {
+ fixed (float* kernelPtr = kernel)
+ {
+ ImageKernelConvolution(imagePtr, kernelPtr, kernel.Length);
+ }
+ }
+ }
+
/// Crop an image to a defined rectangle
public static void ImageCrop(ref Image image, Rectangle crop)
{
@@ -726,6 +731,15 @@ public static void ImageDrawLineV(ref Image dst, Vector2 start, Vector2 end, Col
}
}
+ /// Draw a line defining thickness within an image
+ public static void ImageDrawLineEx(ref Image dst, Vector2 start, Vector2 end, int thick, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawLineEx(p, start, end, thick, color);
+ }
+ }
+
/// Draw circle within an image
public static void ImageDrawCircle(ref Image dst, int centerX, int centerY, int radius, Color color)
{
@@ -780,6 +794,57 @@ public static void ImageDrawRectangleLines(ref Image dst, Rectangle rec, int thi
}
}
+ /// Draw triangle within an image
+ public static void ImageDrawTriangle(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawTriangle(p, v1, v2, v3, color);
+ }
+ }
+
+ /// Draw triangle with interpolated colors within an image
+ public static void ImageDrawTriangleEx(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawTriangleEx(p, v1, v2, v3, c1, c2, c3);
+ }
+ }
+
+ /// Draw triangle outline within an image
+ public static void ImageDrawTriangleLines(ref Image dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawTriangleLines(p, v1, v2, v3, color);
+ }
+ }
+
+ /// Draw a triangle fan defined by points within an image (first vertex is the center)
+ public static void ImageDrawTriangleFan(ref Image dst, Vector2[] points, Color color)
+ {
+ fixed (Image* imagePtr = &dst)
+ {
+ fixed (Vector2* vec2Ptr = points)
+ {
+ ImageDrawTriangleFan(imagePtr, vec2Ptr, points.Length, color);
+ }
+ }
+ }
+
+ /// Draw a triangle strip defined by points within an image
+ public static void ImageDrawTriangleStrip(ref Image dst, Vector2[] points, Color color)
+ {
+ fixed (Image* imagePtr = &dst)
+ {
+ fixed (Vector2* vec2Ptr = points)
+ {
+ ImageDrawTriangleStrip(imagePtr, vec2Ptr, points.Length, color);
+ }
+ }
+ }
+
/// Draw a source image within a destination image (tint applied to source)
public static void ImageDraw(ref Image dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint)
{
@@ -870,7 +935,10 @@ public static Font LoadFont(string fileName)
return LoadFont(str1.AsPointer());
}
- /// Load font from file with extended parameters
+ ///
+ /// Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load
+ /// the default character set, font size is provided in pixels height
+ ///
public static Font LoadFontEx(string fileName, int fontSize, int[] codepoints, int codepointCount)
{
using var str1 = fileName.ToAnsiBuffer();
@@ -974,12 +1042,12 @@ public static void WaveFormat(ref Wave wave, int sampleRate, int sampleSize, int
}
}
- /// Crop a wave to defined samples range
- public static void WaveCrop(ref Wave wave, int initSample, int finalSample)
+ /// Crop a wave to defined frames range
+ public static void WaveCrop(ref Wave wave, int initFrame, int finalFrame)
{
fixed (Wave* p = &wave)
{
- WaveCrop(p, initSample, finalSample);
+ WaveCrop(p, initFrame, finalFrame);
}
}
@@ -1172,6 +1240,13 @@ public static CBool ExportMesh(Mesh mesh, string fileName)
return ExportMesh(mesh, str1.AsPointer());
}
+ /// Export mesh as code file (.h) defining multiple arrays of vertex attributes
+ public static CBool ExportMeshAsCode(Mesh mesh, string fileName)
+ {
+ using var str1 = fileName.ToAnsiBuffer();
+ return ExportMeshAsCode(mesh, str1.AsPointer());
+ }
+
/// Draw a triangle strip defined by points
public static void DrawTriangleStrip3D(Vector3[] points, int pointCount, Color color)
{
@@ -1322,4 +1397,34 @@ public static void SetMaterialShader(ref Model model, int materialIndex, ref Sha
{
model.Materials[materialIndex].Shader = shader;
}
+
+ /// Get a ray trace from mouse position
+ [ObsoleteAttribute("This method is obsolete. Call GetScreenToWorldRay instead.")]
+ public static Ray GetMouseRay(Vector2 mousePosition, Camera3D camera)
+ {
+ return GetScreenToWorldRay(mousePosition, camera);
+ }
+
+ /// Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
+ public static AutomationEventList LoadAutomationEventList(string fileName)
+ {
+ using var str1 = fileName.ToUtf8Buffer();
+ return LoadAutomationEventList(str1.AsPointer());
+ }
+
+ /// Export automation events list as text file
+ public static CBool ExportAutomationEventList(AutomationEventList list, string fileName)
+ {
+ using var str1 = fileName.ToUtf8Buffer();
+ return ExportAutomationEventList(list, str1.AsPointer());
+ }
+
+ /// Set automation event list to record to
+ public static void SetAutomationEventList(ref AutomationEventList list)
+ {
+ fixed (AutomationEventList* p = &list)
+ {
+ SetAutomationEventList(p);
+ }
+ }
}
diff --git a/Raylib-cs/types/RenderBatch.cs b/Raylib-cs/types/RenderBatch.cs
index c8e9b8e8..cfc16155 100644
--- a/Raylib-cs/types/RenderBatch.cs
+++ b/Raylib-cs/types/RenderBatch.cs
@@ -61,6 +61,11 @@ public unsafe partial struct VertexBuffer
///
public float* TexCoords;
+ ///
+ /// Vertex normal (XYZ - 3 components per vertex) (shader-location = 2)
+ ///
+ public float* Normals;
+
///
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
///
@@ -79,9 +84,9 @@ public unsafe partial struct VertexBuffer
public uint VaoId;
///
- /// OpenGL Vertex Buffer Objects id (4 types of vertex data)
+ /// OpenGL Vertex Buffer Objects id (5 types of vertex data)
///
- public fixed uint VboId[4];
+ public fixed uint VboId[5];
///
/// Access
@@ -99,6 +104,14 @@ public readonly Span TexCoordsAs() where T : unmanaged
return new(TexCoords, ElementCount * sizeof(float) / sizeof(T));
}
+ ///
+ /// Access
+ ///
+ public readonly Span NormalsAs() where T : unmanaged
+ {
+ return new(Normals, ElementCount * sizeof(float) / sizeof(T));
+ }
+
///
/// Access
///
diff --git a/Raylib-cs/types/Rlgl.Utils.cs b/Raylib-cs/types/Rlgl.Utils.cs
new file mode 100644
index 00000000..3f50d507
--- /dev/null
+++ b/Raylib-cs/types/Rlgl.Utils.cs
@@ -0,0 +1,15 @@
+using System.Numerics;
+
+namespace Raylib_cs;
+
+public static unsafe partial class Rlgl
+{
+ /// Set shader value matrices
+ public static void SetUniformMatrices(int locIndex, Matrix4x4[] mat)
+ {
+ fixed (Matrix4x4* p = mat)
+ {
+ SetUniformMatrices(locIndex, p, mat.Length);
+ }
+ }
+}
diff --git a/Raylib-cs/types/Shader.cs b/Raylib-cs/types/Shader.cs
index 6b90cfa8..eb326145 100644
--- a/Raylib-cs/types/Shader.cs
+++ b/Raylib-cs/types/Shader.cs
@@ -33,6 +33,9 @@ public enum ShaderLocationIndex
MapIrradiance,
MapPrefilter,
MapBrdf,
+ VertexBoneIds,
+ VertexBoneWeights,
+ BoneMatrices,
MapDiffuse = MapAlbedo,
MapSpecular = MapMetalness,
@@ -62,6 +65,10 @@ public enum ShaderUniformDataType
IVec2,
IVec3,
IVec4,
+ UInt,
+ UIVec2,
+ UIVec3,
+ UIVec4,
Sampler2D
}
diff --git a/Raylib-cs/types/Texture2D.cs b/Raylib-cs/types/Texture2D.cs
index e5abcdab..e1b53167 100644
--- a/Raylib-cs/types/Texture2D.cs
+++ b/Raylib-cs/types/Texture2D.cs
@@ -94,12 +94,7 @@ public enum CubemapLayout
///
/// Layout is defined by a 4x3 cross with cubemap faces
///
- CrossFourByThree,
-
- ///
- /// Layout is defined by a panorama image (equirectangular map)
- ///
- Panorama
+ CrossFourByThree
}
///