using System.Runtime.InteropServices; namespace Raylib_cs; /// /// RenderBatch type /// [StructLayout(LayoutKind.Sequential)] public unsafe partial struct RenderBatch { /// /// Number of vertex buffers (multi-buffering support) /// public int BufferCount; /// /// Current buffer tracking in case of multi-buffering /// public int CurrentBuffer; /// /// Dynamic buffer(s) for vertex data /// public VertexBuffer* VertexBuffer; /// /// Draw calls array, depends on textureId /// public DrawCall* Draws; /// /// Current depth value for next draw /// public float CurrentDepth; } /// /// Dynamic vertex buffers (position + texcoords + colors + indices arrays) /// [StructLayout(LayoutKind.Sequential)] public unsafe partial struct VertexBuffer { /// /// Number of elements in the buffer (QUADS) /// public int ElementCount; /// /// Vertex position (XYZ - 3 components per vertex) (shader-location = 0) /// public float* Vertices; /// /// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) /// public float* TexCoords; /// /// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) /// public byte* Colors; /// /// Vertex indices (in case vertex data comes indexed) (6 indices per quad)
/// unsigned int* for GRAPHICS_API_OPENGL_11 or GRAPHICS_API_OPENGL_33
/// unsigned short* for GRAPHICS_API_OPENGL_ES2 ///
public void* Indices; /// /// OpenGL Vertex Array Object id /// public uint VaoId; /// /// OpenGL Vertex Buffer Objects id (4 types of vertex data) /// public fixed uint VboId[4]; } /// /// Draw call type
/// NOTE: Only texture changes register a new draw, other state-change-related elements are not /// used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any /// of those state-change happens (this is done in core module) ///
[StructLayout(LayoutKind.Sequential)] public partial struct DrawCall { /// /// Drawing mode: LINES, TRIANGLES, QUADS /// public DrawMode Mode; /// /// Number of vertices for the draw call /// public int VertexCount; /// /// Number of vertices required for index alignment (LINES, TRIANGLES) /// public int VertexAlignment; /// /// Texture id to be used on the draw -> Use to create new draw call if changes /// public uint TextureId; } public enum GlVersion { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_43, 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 FramebufferAttachTextureType { 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, } /// /// Matrix Modes (equivalent to OpenGL) /// public enum MatrixMode { /// /// GL_MODELVIEW /// MODELVIEW = 0x1700, /// /// GL_PROJECTION /// PROJECTION = 0x1701, /// /// GL_TEXTURE /// TEXTURE = 0x1702 } /// /// Primitive assembly draw modes /// public enum DrawMode { /// /// GL_LINES /// LINES = 0x0001, /// /// GL_TRIANGLES /// TRIANGLES = 0x0004, /// /// GL_QUADS /// QUADS = 0x0007 } /// /// Texture parameters (equivalent to OpenGL defines) /// public enum TextureFilters { /// /// RL_TEXTURE_FILTER_NEAREST ///
/// GL_NEAREST ///
NEAREST = 0x2600, /// /// RL_TEXTURE_FILTER_LINEAR ///
/// GL_LINEAR ///
LINEAR = 0x2601, /// /// RL_TEXTURE_FILTER_MIP_NEAREST ///
/// GL_NEAREST_MIPMAP_NEAREST ///
MIP_NEAREST = 0x2700, /// /// RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR ///
/// GL_NEAREST_MIPMAP_LINEAR ///
NEAREST_MIP_LINEAR = 0x2702, /// /// RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST ///
/// GL_LINEAR_MIPMAP_NEAREST ///
LINEAR_MIP_NEAREST = 0x2701, /// /// RL_TEXTURE_FILTER_MIP_LINEAR ///
/// GL_LINEAR_MIPMAP_LINEAR ///
MIP_LINEAR = 0x2703, /// /// RL_TEXTURE_FILTER_ANISOTROPIC ///
/// Anisotropic filter (custom identifier) ///
ANISOTROPIC = 0x3000 } /// /// GL Shader type /// public enum ShaderType { /// /// RL_FRAGMENT_SHADER ///
/// GL_FRAGMENT_SHADER ///
FRAGMENT = 0x8B30, /// /// RL_VERTEX_SHADER ///
/// GL_VERTEX_SHADER ///
VERTEX = 0x8B31, /// /// RL_COMPUTE_SHADER ///
/// GL_COMPUTE_SHADER ///
COMPUTE = 0x91b9 }