mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-04-03 11:09:40 -04:00
Minor improvements and formatting
- Replaced Rlgl format usage with PixelFormat enum and update constants. - Added new enums used with framebuffers. - Added missing functions and fixed function naming.
This commit is contained in:
parent
da81033670
commit
1279502344
@ -1681,6 +1681,11 @@ namespace Raylib_cs
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3);
|
||||
|
||||
// Check the collision between two lines defined by two points each, returns collision point by reference
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.I1)]
|
||||
public static extern bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Texture Loading and Drawing Functions (Module: textures)
|
||||
//------------------------------------------------------------------------------------
|
||||
|
@ -16,18 +16,45 @@ namespace Raylib_cs
|
||||
OPENGL_ES_20
|
||||
}
|
||||
|
||||
public enum FramebufferAttachType
|
||||
{
|
||||
RL_ATTACHMENT_COLOR_CHANNEL0 = 0,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL1,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL2,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL3,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL4,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL5,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL6,
|
||||
RL_ATTACHMENT_COLOR_CHANNEL7,
|
||||
RL_ATTACHMENT_DEPTH = 100,
|
||||
RL_ATTACHMENT_STENCIL = 200,
|
||||
}
|
||||
|
||||
public enum FramebufferTexType
|
||||
{
|
||||
RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0,
|
||||
RL_ATTACHMENT_CUBEMAP_NEGATIVE_X,
|
||||
RL_ATTACHMENT_CUBEMAP_POSITIVE_Y,
|
||||
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y,
|
||||
RL_ATTACHMENT_CUBEMAP_POSITIVE_Z,
|
||||
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z,
|
||||
RL_ATTACHMENT_TEXTURE2D = 100,
|
||||
RL_ATTACHMENT_RENDERBUFFER = 200,
|
||||
}
|
||||
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
public static class Rlgl
|
||||
{
|
||||
// Used by DllImport to load the native library.
|
||||
public const string nativeLibName = "raylib";
|
||||
|
||||
public const float MAX_BATCH_ELEMENTS = 8192;
|
||||
public const float MAX_BATCH_BUFFERING = 1;
|
||||
public const float MAX_MATRIX_STACK_SIZE = 32;
|
||||
public const float MAX_DRAWCALL_REGISTERED = 256;
|
||||
public const float DEFAULT_NEAR_CULL_DISTANCE = 0.01f;
|
||||
public const float DEFAULT_FAR_CULL_DISTANCE = 1000.0f;
|
||||
public const int DEFAULT_BATCH_BUFFER_ELEMENTS = 8192;
|
||||
public const int DEFAULT_BATCH_BUFFERS = 1;
|
||||
public const int DEFAULT_BATCH_DRAWCALLS = 256;
|
||||
public const int MAX_BATCH_ACTIVE_TEXTURES = 4;
|
||||
public const int MAX_MATRIX_STACK_SIZE = 32;
|
||||
public const float RL_CULL_DISTANCE_NEAR = 0.01f;
|
||||
public const float RL_CULL_DISTANCE_FAR = 1000.0f;
|
||||
public const int RL_TEXTURE_WRAP_S = 0x2802;
|
||||
public const int RL_TEXTURE_WRAP_T = 0x2803;
|
||||
public const int RL_TEXTURE_MAG_FILTER = 0x2800;
|
||||
@ -159,11 +186,11 @@ namespace Raylib_cs
|
||||
|
||||
// Enable render texture (fbo)
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlEnableRenderTexture(uint id);
|
||||
public static extern void rlEnableFramebuffer(uint id);
|
||||
|
||||
// Disable render texture (fbo), return to default framebuffer
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlDisableRenderTexture();
|
||||
public static extern void rlDisableFramebuffer();
|
||||
|
||||
// Enable depth test
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
@ -173,6 +200,14 @@ namespace Raylib_cs
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlDisableDepthTest();
|
||||
|
||||
// Enable depth write
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlEnableDepthMask();
|
||||
|
||||
// Disable depth write
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlDisableDepthMask();
|
||||
|
||||
// Enable backface culling
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlEnableBackfaceCulling();
|
||||
@ -283,7 +318,7 @@ namespace Raylib_cs
|
||||
// Load texture in GPU
|
||||
// data refers to a void *
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern uint rlLoadTexture(IntPtr data, int width, int height, int format, int mipmapCount);
|
||||
public static extern uint rlLoadTexture(IntPtr data, int width, int height, PixelFormat format, int mipmapCount);
|
||||
|
||||
// Load depth texture/renderbuffer (to be attached to fbo)
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
@ -292,16 +327,16 @@ namespace Raylib_cs
|
||||
// Load texture cubemap
|
||||
// data refers to a void *
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern uint rlLoadTextureCubemap(IntPtr data, int size, int format);
|
||||
public static extern uint rlLoadTextureCubemap(IntPtr data, int size, PixelFormat format);
|
||||
|
||||
// Update GPU texture with new data
|
||||
// data refers to a const void *
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlUpdateTexture(uint id, int width, int height, int format, IntPtr data);
|
||||
public static extern void rlUpdateTexture(uint id, int width, int height, PixelFormat format, IntPtr data);
|
||||
|
||||
// Get OpenGL internal formats
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlGetGlTextureFormats(int format, ref uint glInternalFormat, ref uint glFormat, ref uint glType);
|
||||
public static extern void rlGetGlTextureFormats(PixelFormat format, ref uint glInternalFormat, ref uint glFormat, ref uint glType);
|
||||
|
||||
// Unload texture from GPU memory
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
@ -329,7 +364,7 @@ namespace Raylib_cs
|
||||
|
||||
// Attach texture/renderbuffer to a framebuffer
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void rlFrameBufferAttach(uint fboId, uint texId, int attachType, int texType);
|
||||
public static extern void rlFrameBufferAttach(uint fboId, uint texId, FramebufferAttachType attachType, FramebufferTexType texType);
|
||||
|
||||
// Verify framebuffer is complete
|
||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user