From 44a9eb9738766050399b9b11a38f9c7a9a92231d Mon Sep 17 00:00:00 2001
From: Skellybob56 <68912116+Skellybob56@users.noreply.github.com>
Date: Mon, 12 Oct 2026 19:51:01 +0100
Subject: [PATCH] Add Vector/Color overloads to Rlgl (#348)
---
Raylib-cs/interop/Rlgl.cs | 55 +++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/Raylib-cs/interop/Rlgl.cs b/Raylib-cs/interop/Rlgl.cs
index c65440d..cf7c8e6 100644
--- a/Raylib-cs/interop/Rlgl.cs
+++ b/Raylib-cs/interop/Rlgl.cs
@@ -123,16 +123,34 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Translatef(float x, float y, float z);
+ ///
+ public static void Translatef(Vector3 v)
+ {
+ Translatef(v.X, v.Y, v.Z);
+ }
+
/// Multiply the current matrix by a rotation matrix
[LibraryImport(NativeLibName, EntryPoint = "rlRotatef")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Rotatef(float angle, float x, float y, float z);
+ ///
+ public static void Rotatef(float angle, Vector3 v)
+ {
+ Rotatef(angle, v.X, v.Y, v.Z);
+ }
+
/// Multiply the current matrix by a scaling matrix
[LibraryImport(NativeLibName, EntryPoint = "rlScalef")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Scalef(float x, float y, float z);
+ ///
+ public static void Scalef(Vector3 v)
+ {
+ Scalef(v.X, v.Y, v.Z);
+ }
+
///
/// Multiply the current matrix by another matrix
/// Current Matrix can be set via
@@ -200,6 +218,7 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Begin(int mode);
+ ///
public static void Begin(DrawMode mode)
{
Begin((int)mode);
@@ -220,26 +239,56 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Vertex2f(float x, float y);
+ ///
+ public static void Vertex2f(Vector2 v)
+ {
+ Vertex2f(v.X, v.Y);
+ }
+
/// Define one vertex (position) - 3 float
[LibraryImport(NativeLibName, EntryPoint = "rlVertex3f")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Vertex3f(float x, float y, float z);
+ ///
+ public static void Vertex3f(Vector3 v)
+ {
+ Vertex3f(v.X, v.Y, v.Z);
+ }
+
/// Define one vertex (texture coordinate) - 2 float
[LibraryImport(NativeLibName, EntryPoint = "rlTexCoord2f")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void TexCoord2f(float x, float y);
+ ///
+ public static void TexCoord2f(Vector2 v)
+ {
+ TexCoord2f(v.X, v.Y);
+ }
+
/// Define one vertex (normal) - 3 float
[LibraryImport(NativeLibName, EntryPoint = "rlNormal3f")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Normal3f(float x, float y, float z);
+ ///
+ public static void Normal3f(Vector3 v)
+ {
+ Normal3f(v.X, v.Y, v.Z);
+ }
+
/// Define one vertex (color) - 4 byte
[LibraryImport(NativeLibName, EntryPoint = "rlColor4ub")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Color4ub(byte r, byte g, byte b, byte a);
+ ///
+ public static void Color4ub(Color color)
+ {
+ Color4ub(color.R, color.G, color.B, color.A);
+ }
+
/// Define one vertex (color) - 3 float
[LibraryImport(NativeLibName, EntryPoint = "rlColor3f")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
@@ -250,6 +299,12 @@ public static unsafe partial class Rlgl
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
public static partial void Color4f(float x, float y, float z, float w);
+ ///
+ public static void Color4f(Vector4 normalized)
+ {
+ Color4f(normalized.X, normalized.Y, normalized.Z, normalized.W);
+ }
+
// ------------------------------------------------------------------------------------
// Functions Declaration - OpenGL equivalent functions (common to 1.1, 3.3+, ES2)