2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

Convert some RLGL consts to Enums

Also added helper methods/overloads for related methods
This commit is contained in:
2021-12-05 01:47:49 +11:00
parent fb6c60cfc2
commit b9756993f1

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel;
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security; using System.Security;
@@ -40,15 +41,6 @@ namespace Raylib_cs
public const int RL_TEXTURE_WRAP_MIRROR_REPEAT = 0x8370; public const int RL_TEXTURE_WRAP_MIRROR_REPEAT = 0x8370;
public const int RL_TEXTURE_WRAP_MIRROR_CLAMP = 0x8742; public const int RL_TEXTURE_WRAP_MIRROR_CLAMP = 0x8742;
// Matrix modes (equivalent to OpenGL)
public const int RL_MODELVIEW = 0x1700;
public const int RL_PROJECTION = 0x1701;
public const int RL_TEXTURE = 0x1702;
// Primitive assembly draw modes
public const int RL_LINES = 0x0001;
public const int RL_TRIANGLES = 0x0004;
public const int RL_QUADS = 0x0007;
// GL equivalent data types // GL equivalent data types
public const int RL_UNSIGNED_BYTE = 0x1401; public const int RL_UNSIGNED_BYTE = 0x1401;
@@ -65,10 +57,6 @@ namespace Raylib_cs
public const int RL_DYNAMIC_READ = 0x88E9; public const int RL_DYNAMIC_READ = 0x88E9;
public const int RL_DYNAMIC_COPY = 0x88EA; public const int RL_DYNAMIC_COPY = 0x88EA;
// GL Shader type
public const int RL_FRAGMENT_SHADER = 0x8B30;
public const int RL_VERTEX_SHADER = 0x8B31;
public const int RL_COMPUTE_SHADER = 0x91B9;
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
// Functions Declaration - Matrix operations // Functions Declaration - Matrix operations
@@ -78,6 +66,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlMatrixMode(int mode); public static extern void rlMatrixMode(int mode);
public static void rlMatrixMode(MatrixMode mode)
{
rlMatrixMode((int)mode);
}
/// <summary>Push the current matrix to stack</summary> /// <summary>Push the current matrix to stack</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlPushMatrix(); public static extern void rlPushMatrix();
@@ -125,6 +118,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlBegin(int mode); public static extern void rlBegin(int mode);
public static void rlBegin(DrawMode mode)
{
rlBegin((int)mode);
}
/// <summary>Finish vertex providing</summary> /// <summary>Finish vertex providing</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlEnd(); public static extern void rlEnd();
@@ -689,4 +687,117 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlLoadDrawQuad(); public static extern void rlLoadDrawQuad();
} }
/// <summary>
/// Matrix Modes (equivalent to OpenGL)
/// </summary>
public enum MatrixMode : int
{
/// <summary>
/// GL_MODELVIEW
/// </summary>
MODELVIEW = 0x1700,
/// <summary>
/// GL_PROJECTION
/// </summary>
PROJECTION = 0x1701,
/// <summary>
/// GL_TEXTURE
/// </summary>
TEXTURE = 0x1702
}
/// <summary>
/// Primitive assembly draw modes
/// </summary>
public enum DrawMode : int
{
/// <summary>
/// GL_LINES
/// </summary>
LINES = 0x0001,
/// <summary>
/// GL_TRIANGLES
/// </summary>
TRIANGLES = 0x0004,
/// <summary>
/// GL_QUADS
/// </summary>
QUADS = 0x0007
}
/// <summary>
/// Texture parameters (equivalent to OpenGL defines)
/// </summary>
public enum TextureFilters : int
{
/// <summary>
/// RL_TEXTURE_FILTER_NEAREST
/// <br/>
/// GL_NEAREST
/// </summary>
NEAREST = 0x2600,
/// <summary>
/// RL_TEXTURE_FILTER_LINEAR
/// <br/>
/// GL_LINEAR
/// </summary>
LINEAR = 0x2601,
/// <summary>
/// RL_TEXTURE_FILTER_MIP_NEAREST
/// <br/>
/// GL_NEAREST_MIPMAP_NEAREST
/// </summary>
MIP_NEAREST = 0x2700,
/// <summary>
/// RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR
/// <br/>
/// GL_NEAREST_MIPMAP_LINEAR
/// </summary>
NEAREST_MIP_LINEAR = 0x2702,
/// <summary>
/// RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST
/// <br/>
/// GL_LINEAR_MIPMAP_NEAREST
/// </summary>
LINEAR_MIP_NEAREST = 0x2701,
/// <summary>
/// RL_TEXTURE_FILTER_MIP_LINEAR
/// <br/>
/// GL_LINEAR_MIPMAP_LINEAR
/// </summary>
MIP_LINEAR = 0x2703,
/// <summary>
/// RL_TEXTURE_FILTER_ANISOTROPIC
/// <br/>
/// Anisotropic filter (custom identifier)
/// </summary>
ANISOTROPIC = 0x3000
}
/// <summary>
/// GL Shader type
/// </summary>
public enum ShaderType : int
{
/// <summary>
/// RL_FRAGMENT_SHADER
/// <br/>
/// GL_FRAGMENT_SHADER
/// </summary>
FRAGMENT = 0x8B30,
/// <summary>
/// RL_VERTEX_SHADER
/// <br/>
/// GL_VERTEX_SHADER
/// </summary>
VERTEX = 0x8B31,
/// <summary>
/// RL_COMPUTE_SHADER
/// <br/>
/// GL_COMPUTE_SHADER
/// </summary>
COMPUTE = 0x91b9
}
} }