mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Made rlgl.odin work as a subpackage of raylib. So now you import vendor:raylib/rlgl. Instead of rl.rlBegin(rl.RL_TRIANGLES) you now type rlgl.Begin(rlgl.TRIANGLES).
This commit is contained in:
Vendored
+242
-237
@@ -105,25 +105,25 @@
|
|||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
package raylib
|
package rlgl
|
||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
|
|
||||||
RLGL_VERSION :: "4.5"
|
RLGL_VERSION :: "5.0"
|
||||||
|
|
||||||
when ODIN_OS == .Windows {
|
when ODIN_OS == .Windows {
|
||||||
foreign import lib {
|
foreign import lib {
|
||||||
"windows/raylib.lib",
|
"../windows/raylib.lib",
|
||||||
"system:Winmm.lib",
|
"system:Winmm.lib",
|
||||||
"system:Gdi32.lib",
|
"system:Gdi32.lib",
|
||||||
"system:User32.lib",
|
"system:User32.lib",
|
||||||
"system:Shell32.lib",
|
"system:Shell32.lib",
|
||||||
}
|
}
|
||||||
} else when ODIN_OS == .Linux {
|
} else when ODIN_OS == .Linux {
|
||||||
foreign import lib "linux/libraylib.a"
|
foreign import lib "../linux/libraylib.a"
|
||||||
} else when ODIN_OS == .Darwin {
|
} else when ODIN_OS == .Darwin {
|
||||||
foreign import lib {
|
foreign import lib {
|
||||||
"macos-arm64/libraylib.a" when ODIN_ARCH == .arm64 else "macos/libraylib.a",
|
"../macos-arm64/libraylib.a" when ODIN_ARCH == .arm64 else "../macos/libraylib.a",
|
||||||
"system:Cocoa.framework",
|
"system:Cocoa.framework",
|
||||||
"system:OpenGL.framework",
|
"system:OpenGL.framework",
|
||||||
"system:IOKit.framework",
|
"system:IOKit.framework",
|
||||||
@@ -132,122 +132,122 @@ when ODIN_OS == .Windows {
|
|||||||
foreign import lib "system:raylib"
|
foreign import lib "system:raylib"
|
||||||
}
|
}
|
||||||
|
|
||||||
RL_GRAPHICS_API_OPENGL_11 :: false
|
GRAPHICS_API_OPENGL_11 :: false
|
||||||
RL_GRAPHICS_API_OPENGL_21 :: true
|
GRAPHICS_API_OPENGL_21 :: true
|
||||||
RL_GRAPHICS_API_OPENGL_33 :: RL_GRAPHICS_API_OPENGL_21 // default currently
|
GRAPHICS_API_OPENGL_33 :: GRAPHICS_API_OPENGL_21 // default currently
|
||||||
RL_GRAPHICS_API_OPENGL_ES2 :: false
|
GRAPHICS_API_OPENGL_ES2 :: false
|
||||||
RL_GRAPHICS_API_OPENGL_43 :: false
|
GRAPHICS_API_OPENGL_43 :: false
|
||||||
RL_GRAPHICS_API_OPENGL_ES3 :: false
|
GRAPHICS_API_OPENGL_ES3 :: false
|
||||||
|
|
||||||
when RL_GRAPHICS_API_OPENGL_ES3 {
|
when GRAPHICS_API_OPENGL_ES3 {
|
||||||
RL_GRAPHICS_API_OPENGL_ES2 :: true
|
GRAPHICS_API_OPENGL_ES2 :: true
|
||||||
}
|
}
|
||||||
|
|
||||||
when !RL_GRAPHICS_API_OPENGL_ES2 {
|
when !GRAPHICS_API_OPENGL_ES2 {
|
||||||
// This is the maximum amount of elements (quads) per batch
|
// This is the maximum amount of elements (quads) per batch
|
||||||
// NOTE: Be careful with text, every letter maps to a quad
|
// NOTE: Be careful with text, every letter maps to a quad
|
||||||
RL_DEFAULT_BATCH_BUFFER_ELEMENTS :: 8192
|
DEFAULT_BATCH_BUFFER_ELEMENTS :: 8192
|
||||||
} else {
|
} else {
|
||||||
// We reduce memory sizes for embedded systems (RPI and HTML5)
|
// We reduce memory sizes for embedded systems (RPI and HTML5)
|
||||||
// NOTE: On HTML5 (emscripten) this is allocated on heap,
|
// NOTE: On HTML5 (emscripten) this is allocated on heap,
|
||||||
// by default it's only 16MB!...just take care...
|
// by default it's only 16MB!...just take care...
|
||||||
RL_DEFAULT_BATCH_BUFFER_ELEMENTS :: 2048
|
DEFAULT_BATCH_BUFFER_ELEMENTS :: 2048
|
||||||
}
|
}
|
||||||
|
|
||||||
RL_DEFAULT_BATCH_BUFFERS :: 1 // Default number of batch buffers (multi-buffering)
|
DEFAULT_BATCH_BUFFERS :: 1 // Default number of batch buffers (multi-buffering)
|
||||||
RL_DEFAULT_BATCH_DRAWCALLS :: 256 // Default number of batch draw calls (by state changes: mode, texture)
|
DEFAULT_BATCH_DRAWCALLS :: 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||||
RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS :: 4 // Maximum number of additional textures that can be activated on batch drawing (SetShaderValueTexture())
|
DEFAULT_BATCH_MAX_TEXTURE_UNITS :: 4 // Maximum number of additional textures that can be activated on batch drawing (SetShaderValueTexture())
|
||||||
|
|
||||||
// Internal Matrix stack
|
// Internal Matrix stack
|
||||||
RL_MAX_MATRIX_STACK_SIZE :: 32 // Maximum size of Matrix stack
|
MAX_MATRIX_STACK_SIZE :: 32 // Maximum size of Matrix stack
|
||||||
|
|
||||||
// Shader limits
|
// Shader limits
|
||||||
RL_MAX_SHADER_LOCATIONS :: 32 // Maximum number of shader locations supported
|
MAX_SHADER_LOCATIONS :: 32 // Maximum number of shader locations supported
|
||||||
|
|
||||||
// Projection matrix culling
|
// Projection matrix culling
|
||||||
RL_CULL_DISTANCE_NEAR :: 0.01 // Default near cull distance
|
CULL_DISTANCE_NEAR :: 0.01 // Default near cull distance
|
||||||
RL_CULL_DISTANCE_FAR :: 1000.0 // Default far cull distance
|
CULL_DISTANCE_FAR :: 1000.0 // Default far cull distance
|
||||||
|
|
||||||
// Texture parameters (equivalent to OpenGL defines)
|
// Texture parameters (equivalent to OpenGL defines)
|
||||||
RL_TEXTURE_WRAP_S :: 0x2802 // GL_TEXTURE_WRAP_S
|
TEXTURE_WRAP_S :: 0x2802 // GL_TEXTURE_WRAP_S
|
||||||
RL_TEXTURE_WRAP_T :: 0x2803 // GL_TEXTURE_WRAP_T
|
TEXTURE_WRAP_T :: 0x2803 // GL_TEXTURE_WRAP_T
|
||||||
RL_TEXTURE_MAG_FILTER :: 0x2800 // GL_TEXTURE_MAG_FILTER
|
TEXTURE_MAG_FILTER :: 0x2800 // GL_TEXTURE_MAG_FILTER
|
||||||
RL_TEXTURE_MIN_FILTER :: 0x2801 // GL_TEXTURE_MIN_FILTER
|
TEXTURE_MIN_FILTER :: 0x2801 // GL_TEXTURE_MIN_FILTER
|
||||||
|
|
||||||
RL_TEXTURE_FILTER_NEAREST :: 0x2600 // GL_NEAREST
|
TEXTURE_FILTER_NEAREST :: 0x2600 // GL_NEAREST
|
||||||
RL_TEXTURE_FILTER_LINEAR :: 0x2601 // GL_LINEAR
|
TEXTURE_FILTER_LINEAR :: 0x2601 // GL_LINEAR
|
||||||
RL_TEXTURE_FILTER_MIP_NEAREST :: 0x2700 // GL_NEAREST_MIPMAP_NEAREST
|
TEXTURE_FILTER_MIP_NEAREST :: 0x2700 // GL_NEAREST_MIPMAP_NEAREST
|
||||||
RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR :: 0x2702 // GL_NEAREST_MIPMAP_LINEAR
|
TEXTURE_FILTER_NEAREST_MIP_LINEAR :: 0x2702 // GL_NEAREST_MIPMAP_LINEAR
|
||||||
RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST :: 0x2701 // GL_LINEAR_MIPMAP_NEAREST
|
TEXTURE_FILTER_LINEAR_MIP_NEAREST :: 0x2701 // GL_LINEAR_MIPMAP_NEAREST
|
||||||
RL_TEXTURE_FILTER_MIP_LINEAR :: 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
TEXTURE_FILTER_MIP_LINEAR :: 0x2703 // GL_LINEAR_MIPMAP_LINEAR
|
||||||
RL_TEXTURE_FILTER_ANISOTROPIC :: 0x3000 // Anisotropic filter (custom identifier)
|
TEXTURE_FILTER_ANISOTROPIC :: 0x3000 // Anisotropic filter (custom identifier)
|
||||||
|
|
||||||
RL_TEXTURE_WRAP_REPEAT :: 0x2901 // GL_REPEAT
|
TEXTURE_WRAP_REPEAT :: 0x2901 // GL_REPEAT
|
||||||
RL_TEXTURE_WRAP_CLAMP :: 0x812F // GL_CLAMP_TO_EDGE
|
TEXTURE_WRAP_CLAMP :: 0x812F // GL_CLAMP_TO_EDGE
|
||||||
RL_TEXTURE_WRAP_MIRROR_REPEAT :: 0x8370 // GL_MIRRORED_REPEAT
|
TEXTURE_WRAP_MIRROR_REPEAT :: 0x8370 // GL_MIRRORED_REPEAT
|
||||||
RL_TEXTURE_WRAP_MIRROR_CLAMP :: 0x8742 // GL_MIRROR_CLAMP_EXT
|
TEXTURE_WRAP_MIRROR_CLAMP :: 0x8742 // GL_MIRROR_CLAMP_EXT
|
||||||
|
|
||||||
// Matrix modes (equivalent to OpenGL)
|
// Matrix modes (equivalent to OpenGL)
|
||||||
RL_MODELVIEW :: 0x1700 // GL_MODELVIEW
|
MODELVIEW :: 0x1700 // GL_MODELVIEW
|
||||||
RL_PROJECTION :: 0x1701 // GL_PROJECTION
|
PROJECTION :: 0x1701 // GL_PROJECTION
|
||||||
RL_TEXTURE :: 0x1702 // GL_TEXTURE
|
TEXTURE :: 0x1702 // GL_TEXTURE
|
||||||
|
|
||||||
// Primitive assembly draw modes
|
// Primitive assembly draw modes
|
||||||
RL_LINES :: 0x0001 // GL_LINES
|
LINES :: 0x0001 // GL_LINES
|
||||||
RL_TRIANGLES :: 0x0004 // GL_TRIANGLES
|
TRIANGLES :: 0x0004 // GL_TRIANGLES
|
||||||
RL_QUADS :: 0x0007 // GL_QUADS
|
QUADS :: 0x0007 // GL_QUADS
|
||||||
|
|
||||||
// GL equivalent data types
|
// GL equivalent data types
|
||||||
RL_UNSIGNED_BYTE :: 0x1401 // GL_UNSIGNED_BYTE
|
UNSIGNED_BYTE :: 0x1401 // GL_UNSIGNED_BYTE
|
||||||
RL_FLOAT :: 0x1406 // GL_FLOAT
|
FLOAT :: 0x1406 // GL_FLOAT
|
||||||
|
|
||||||
// Buffer usage hint
|
// Buffer usage hint
|
||||||
RL_STREAM_DRAW :: 0x88E0 // GL_STREAM_DRAW
|
STREAM_DRAW :: 0x88E0 // GL_STREAM_DRAW
|
||||||
RL_STREAM_READ :: 0x88E1 // GL_STREAM_READ
|
STREAM_READ :: 0x88E1 // GL_STREAM_READ
|
||||||
RL_STREAM_COPY :: 0x88E2 // GL_STREAM_COPY
|
STREAM_COPY :: 0x88E2 // GL_STREAM_COPY
|
||||||
RL_STATIC_DRAW :: 0x88E4 // GL_STATIC_DRAW
|
STATIC_DRAW :: 0x88E4 // GL_STATIC_DRAW
|
||||||
RL_STATIC_READ :: 0x88E5 // GL_STATIC_READ
|
STATIC_READ :: 0x88E5 // GL_STATIC_READ
|
||||||
RL_STATIC_COPY :: 0x88E6 // GL_STATIC_COPY
|
STATIC_COPY :: 0x88E6 // GL_STATIC_COPY
|
||||||
RL_DYNAMIC_DRAW :: 0x88E8 // GL_DYNAMIC_DRAW
|
DYNAMIC_DRAW :: 0x88E8 // GL_DYNAMIC_DRAW
|
||||||
RL_DYNAMIC_READ :: 0x88E9 // GL_DYNAMIC_READ
|
DYNAMIC_READ :: 0x88E9 // GL_DYNAMIC_READ
|
||||||
RL_DYNAMIC_COPY :: 0x88EA // GL_DYNAMIC_COPY
|
DYNAMIC_COPY :: 0x88EA // GL_DYNAMIC_COPY
|
||||||
|
|
||||||
// GL Shader type
|
// GL Shader type
|
||||||
RL_FRAGMENT_SHADER :: 0x8B30 // GL_FRAGMENT_SHADER
|
FRAGMENT_SHADER :: 0x8B30 // GL_FRAGMENT_SHADER
|
||||||
RL_VERTEX_SHADER :: 0x8B31 // GL_VERTEX_SHADER
|
VERTEX_SHADER :: 0x8B31 // GL_VERTEX_SHADER
|
||||||
RL_COMPUTE_SHADER :: 0x91B9 // GL_COMPUTE_SHADER
|
COMPUTE_SHADER :: 0x91B9 // GL_COMPUTE_SHADER
|
||||||
|
|
||||||
// GL blending factors
|
// GL blending factors
|
||||||
RL_ZERO :: 0 // GL_ZERO
|
ZERO :: 0 // GL_ZERO
|
||||||
RL_ONE :: 1 // GL_ONE
|
ONE :: 1 // GL_ONE
|
||||||
RL_SRC_COLOR :: 0x0300 // GL_SRC_COLOR
|
SRC_COLOR :: 0x0300 // GL_SRC_COLOR
|
||||||
RL_ONE_MINUS_SRC_COLOR :: 0x0301 // GL_ONE_MINUS_SRC_COLOR
|
ONE_MINUS_SRC_COLOR :: 0x0301 // GL_ONE_MINUS_SRC_COLOR
|
||||||
RL_SRC_ALPHA :: 0x0302 // GL_SRC_ALPHA
|
SRC_ALPHA :: 0x0302 // GL_SRC_ALPHA
|
||||||
RL_ONE_MINUS_SRC_ALPHA :: 0x0303 // GL_ONE_MINUS_SRC_ALPHA
|
ONE_MINUS_SRC_ALPHA :: 0x0303 // GL_ONE_MINUS_SRC_ALPHA
|
||||||
RL_DST_ALPHA :: 0x0304 // GL_DST_ALPHA
|
DST_ALPHA :: 0x0304 // GL_DST_ALPHA
|
||||||
RL_ONE_MINUS_DST_ALPHA :: 0x0305 // GL_ONE_MINUS_DST_ALPHA
|
ONE_MINUS_DST_ALPHA :: 0x0305 // GL_ONE_MINUS_DST_ALPHA
|
||||||
RL_DST_COLOR :: 0x0306 // GL_DST_COLOR
|
DST_COLOR :: 0x0306 // GL_DST_COLOR
|
||||||
RL_ONE_MINUS_DST_COLOR :: 0x0307 // GL_ONE_MINUS_DST_COLOR
|
ONE_MINUS_DST_COLOR :: 0x0307 // GL_ONE_MINUS_DST_COLOR
|
||||||
RL_SRC_ALPHA_SATURATE :: 0x0308 // GL_SRC_ALPHA_SATURATE
|
SRC_ALPHA_SATURATE :: 0x0308 // GL_SRC_ALPHA_SATURATE
|
||||||
RL_CONSTANT_COLOR :: 0x8001 // GL_CONSTANT_COLOR
|
CONSTANT_COLOR :: 0x8001 // GL_CONSTANT_COLOR
|
||||||
RL_ONE_MINUS_CONSTANT_COLOR :: 0x8002 // GL_ONE_MINUS_CONSTANT_COLOR
|
ONE_MINUS_CONSTANT_COLOR :: 0x8002 // GL_ONE_MINUS_CONSTANT_COLOR
|
||||||
RL_CONSTANT_ALPHA :: 0x8003 // GL_CONSTANT_ALPHA
|
CONSTANT_ALPHA :: 0x8003 // GL_CONSTANT_ALPHA
|
||||||
RL_ONE_MINUS_CONSTANT_ALPHA :: 0x8004 // GL_ONE_MINUS_CONSTANT_ALPHA
|
ONE_MINUS_CONSTANT_ALPHA :: 0x8004 // GL_ONE_MINUS_CONSTANT_ALPHA
|
||||||
|
|
||||||
// GL blending functions/equations
|
// GL blending functions/equations
|
||||||
RL_FUNC_ADD :: 0x8006 // GL_FUNC_ADD
|
FUNC_ADD :: 0x8006 // GL_FUNC_ADD
|
||||||
RL_MIN :: 0x8007 // GL_MIN
|
MIN :: 0x8007 // GL_MIN
|
||||||
RL_MAX :: 0x8008 // GL_MAX
|
MAX :: 0x8008 // GL_MAX
|
||||||
RL_FUNC_SUBTRACT :: 0x800A // GL_FUNC_SUBTRACT
|
FUNC_SUBTRACT :: 0x800A // GL_FUNC_SUBTRACT
|
||||||
RL_FUNC_REVERSE_SUBTRACT :: 0x800B // GL_FUNC_REVERSE_SUBTRACT
|
FUNC_REVERSE_SUBTRACT :: 0x800B // GL_FUNC_REVERSE_SUBTRACT
|
||||||
RL_BLEND_EQUATION :: 0x8009 // GL_BLEND_EQUATION
|
BLEND_EQUATION :: 0x8009 // GL_BLEND_EQUATION
|
||||||
RL_BLEND_EQUATION_RGB :: 0x8009 // GL_BLEND_EQUATION_RGB // (Same as BLEND_EQUATION)
|
BLEND_EQUATION_RGB :: 0x8009 // GL_BLEND_EQUATION_RGB // (Same as BLEND_EQUATION)
|
||||||
RL_BLEND_EQUATION_ALPHA :: 0x883D // GL_BLEND_EQUATION_ALPHA
|
BLEND_EQUATION_ALPHA :: 0x883D // GL_BLEND_EQUATION_ALPHA
|
||||||
RL_BLEND_DST_RGB :: 0x80C8 // GL_BLEND_DST_RGB
|
BLEND_DST_RGB :: 0x80C8 // GL_BLEND_DST_RGB
|
||||||
RL_BLEND_SRC_RGB :: 0x80C9 // GL_BLEND_SRC_RGB
|
BLEND_SRC_RGB :: 0x80C9 // GL_BLEND_SRC_RGB
|
||||||
RL_BLEND_DST_ALPHA :: 0x80CA // GL_BLEND_DST_ALPHA
|
BLEND_DST_ALPHA :: 0x80CA // GL_BLEND_DST_ALPHA
|
||||||
RL_BLEND_SRC_ALPHA :: 0x80CB // GL_BLEND_SRC_ALPHA
|
BLEND_SRC_ALPHA :: 0x80CB // GL_BLEND_SRC_ALPHA
|
||||||
RL_BLEND_COLOR :: 0x8005 // GL_BLEND_COLOR
|
BLEND_COLOR :: 0x8005 // GL_BLEND_COLOR
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@@ -255,7 +255,7 @@ RL_BLEND_COLOR :: 0x8005 // GL_BLEND_COLOR
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
VertexBufferIndexType :: c.ushort when RL_GRAPHICS_API_OPENGL_ES2 else c.uint
|
VertexBufferIndexType :: c.ushort when GRAPHICS_API_OPENGL_ES2 else c.uint
|
||||||
|
|
||||||
// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||||
VertexBuffer :: struct {
|
VertexBuffer :: struct {
|
||||||
@@ -343,36 +343,39 @@ CullMode :: enum c.int {
|
|||||||
BACK,
|
BACK,
|
||||||
}
|
}
|
||||||
|
|
||||||
@(default_calling_convention="c")
|
// Matrix type (right handed, stored row major)
|
||||||
|
Matrix :: #row_major matrix[4, 4]f32
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="rl")
|
||||||
foreign lib {
|
foreign lib {
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - Matrix operations
|
// Functions Declaration - Matrix operations
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
rlMatrixMode :: proc(mode: c.int) --- // Choose the current matrix to be transformed
|
MatrixMode :: proc(mode: c.int) --- // Choose the current matrix to be transformed
|
||||||
rlPushMatrix :: proc() --- // Push the current matrix to stack
|
PushMatrix :: proc() --- // Push the current matrix to stack
|
||||||
rlPopMatrix :: proc() --- // Pop lattest inserted matrix from stack
|
PopMatrix :: proc() --- // Pop lattest inserted matrix from stack
|
||||||
rlLoadIdentity :: proc() --- // Reset current matrix to identity matrix
|
LoadIdentity :: proc() --- // Reset current matrix to identity matrix
|
||||||
rlTranslatef :: proc(x, y, z: f32) --- // Multiply the current matrix by a translation matrix
|
Translatef :: proc(x, y, z: f32) --- // Multiply the current matrix by a translation matrix
|
||||||
rlRotatef :: proc(angleDeg: f32, x, y, z: f32) --- // Multiply the current matrix by a rotation matrix
|
Rotatef :: proc(angleDeg: f32, x, y, z: f32) --- // Multiply the current matrix by a rotation matrix
|
||||||
rlScalef :: proc(x, y, z: f32) --- // Multiply the current matrix by a scaling matrix
|
Scalef :: proc(x, y, z: f32) --- // Multiply the current matrix by a scaling matrix
|
||||||
rlMultMatrixf :: proc(matf: [^]f32) --- // Multiply the current matrix by another matrix
|
MultMatrixf :: proc(matf: [^]f32) --- // Multiply the current matrix by another matrix
|
||||||
rlFrustum :: proc(left, right, bottom, top, znear, zfar: f64) ---
|
Frustum :: proc(left, right, bottom, top, znear, zfar: f64) ---
|
||||||
rlOrtho :: proc(left, right, bottom, top, znear, zfar: f64) ---
|
Ortho :: proc(left, right, bottom, top, znear, zfar: f64) ---
|
||||||
rlViewport :: proc(x, y, width, height: c.int) --- // Set the viewport area
|
Viewport :: proc(x, y, width, height: c.int) --- // Set the viewport area
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - Vertex level operations
|
// Functions Declaration - Vertex level operations
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
rlBegin :: proc(mode: c.int) --- // Initialize drawing mode (how to organize vertex)
|
Begin :: proc(mode: c.int) --- // Initialize drawing mode (how to organize vertex)
|
||||||
rlEnd :: proc() --- // Finish vertex providing
|
End :: proc() --- // Finish vertex providing
|
||||||
rlVertex2i :: proc(x, y: c.int) --- // Define one vertex (position) - 2 int
|
Vertex2i :: proc(x, y: c.int) --- // Define one vertex (position) - 2 int
|
||||||
rlVertex2f :: proc(x, y: f32) --- // Define one vertex (position) - 2 f32
|
Vertex2f :: proc(x, y: f32) --- // Define one vertex (position) - 2 f32
|
||||||
rlVertex3f :: proc(x, y, z: f32) --- // Define one vertex (position) - 3 f32
|
Vertex3f :: proc(x, y, z: f32) --- // Define one vertex (position) - 3 f32
|
||||||
rlTexCoord2f :: proc(x, y: f32) --- // Define one vertex (texture coordinate) - 2 f32
|
TexCoord2f :: proc(x, y: f32) --- // Define one vertex (texture coordinate) - 2 f32
|
||||||
rlNormal3f :: proc(x, y, z: f32) --- // Define one vertex (normal) - 3 f32
|
Normal3f :: proc(x, y, z: f32) --- // Define one vertex (normal) - 3 f32
|
||||||
rlColor4ub :: proc(r, g, b, a: u8) --- // Define one vertex (color) - 4 byte
|
Color4ub :: proc(r, g, b, a: u8) --- // Define one vertex (color) - 4 byte
|
||||||
rlColor3f :: proc(x, y, z: f32) --- // Define one vertex (color) - 3 f32
|
Color3f :: proc(x, y, z: f32) --- // Define one vertex (color) - 3 f32
|
||||||
rlColor4f :: proc(x, y, z, w: f32) --- // Define one vertex (color) - 4 f32
|
Color4f :: proc(x, y, z, w: f32) --- // Define one vertex (color) - 4 f32
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - OpenGL style functions (common to 1.1, 3.3+, ES2)
|
// Functions Declaration - OpenGL style functions (common to 1.1, 3.3+, ES2)
|
||||||
@@ -381,175 +384,177 @@ foreign lib {
|
|||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Vertex buffers state
|
// Vertex buffers state
|
||||||
rlEnableVertexArray :: proc(vaoId: c.uint) -> bool --- // Enable vertex array (VAO, if supported)
|
EnableVertexArray :: proc(vaoId: c.uint) -> bool --- // Enable vertex array (VAO, if supported)
|
||||||
rlDisableVertexArray :: proc() --- // Disable vertex array (VAO, if supported)
|
DisableVertexArray :: proc() --- // Disable vertex array (VAO, if supported)
|
||||||
rlEnableVertexBuffer :: proc(id: c.uint) --- // Enable vertex buffer (VBO)
|
EnableVertexBuffer :: proc(id: c.uint) --- // Enable vertex buffer (VBO)
|
||||||
rlDisableVertexBuffer :: proc() --- // Disable vertex buffer (VBO)
|
DisableVertexBuffer :: proc() --- // Disable vertex buffer (VBO)
|
||||||
rlEnableVertexBufferElement :: proc(id: c.uint) --- // Enable vertex buffer element (VBO element)
|
EnableVertexBufferElement :: proc(id: c.uint) --- // Enable vertex buffer element (VBO element)
|
||||||
rlDisableVertexBufferElement :: proc() --- // Disable vertex buffer element (VBO element)
|
DisableVertexBufferElement :: proc() --- // Disable vertex buffer element (VBO element)
|
||||||
rlEnableVertexAttribute :: proc(index: c.uint) --- // Enable vertex attribute index
|
EnableVertexAttribute :: proc(index: c.uint) --- // Enable vertex attribute index
|
||||||
rlDisableVertexAttribute :: proc(index: c.uint) --- // Disable vertex attribute index
|
DisableVertexAttribute :: proc(index: c.uint) --- // Disable vertex attribute index
|
||||||
when RL_GRAPHICS_API_OPENGL_11 {
|
when GRAPHICS_API_OPENGL_11 {
|
||||||
rlEnableStatePointer :: proc(vertexAttribType: c.int, buffer: rawptr) ---
|
EnableStatePointer :: proc(vertexAttribType: c.int, buffer: rawptr) ---
|
||||||
rlDisableStatePointer :: proc(vertexAttribType: c.int) ---
|
DisableStatePointer :: proc(vertexAttribType: c.int) ---
|
||||||
}
|
}
|
||||||
|
|
||||||
// Textures state
|
// Textures state
|
||||||
rlActiveTextureSlot :: proc(slot: c.int) --- // Select and active a texture slot
|
ActiveTextureSlot :: proc(slot: c.int) --- // Select and active a texture slot
|
||||||
rlEnableTexture :: proc(id: c.uint) --- // Enable texture
|
EnableTexture :: proc(id: c.uint) --- // Enable texture
|
||||||
rlDisableTexture :: proc() --- // Disable texture
|
DisableTexture :: proc() --- // Disable texture
|
||||||
rlEnableTextureCubemap :: proc(id: c.uint) --- // Enable texture cubemap
|
EnableTextureCubemap :: proc(id: c.uint) --- // Enable texture cubemap
|
||||||
rlDisableTextureCubemap :: proc() --- // Disable texture cubemap
|
DisableTextureCubemap :: proc() --- // Disable texture cubemap
|
||||||
rlTextureParameters :: proc(id: c.uint, param: c.int, value: c.int) --- // Set texture parameters (filter, wrap)
|
TextureParameters :: proc(id: c.uint, param: c.int, value: c.int) --- // Set texture parameters (filter, wrap)
|
||||||
rlCubemapParameters :: proc(id: i32, param: c.int, value: c.int) --- // Set cubemap parameters (filter, wrap)
|
CubemapParameters :: proc(id: i32, param: c.int, value: c.int) --- // Set cubemap parameters (filter, wrap)
|
||||||
|
|
||||||
// Shader state
|
// Shader state
|
||||||
rlEnableShader :: proc(id: c.uint) --- // Enable shader program
|
EnableShader :: proc(id: c.uint) --- // Enable shader program
|
||||||
rlDisableShader :: proc() --- // Disable shader program
|
DisableShader :: proc() --- // Disable shader program
|
||||||
|
|
||||||
// Framebuffer state
|
// Framebuffer state
|
||||||
rlEnableFramebuffer :: proc(id: c.uint) --- // Enable render texture (fbo)
|
EnableFramebuffer :: proc(id: c.uint) --- // Enable render texture (fbo)
|
||||||
rlDisableFramebuffer :: proc() --- // Disable render texture (fbo), return to default framebuffer
|
DisableFramebuffer :: proc() --- // Disable render texture (fbo), return to default framebuffer
|
||||||
rlActiveDrawBuffers :: proc(count: c.int) --- // Activate multiple draw color buffers
|
ActiveDrawBuffers :: proc(count: c.int) --- // Activate multiple draw color buffers
|
||||||
rlBlitFramebuffer :: proc(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask: c.int) --- // Blit active framebuffer to main framebuffer
|
BlitFramebuffer :: proc(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask: c.int) --- // Blit active framebuffer to main framebuffer
|
||||||
|
|
||||||
// General render state
|
// General render state
|
||||||
rlDisableColorBlend :: proc() --- // Disable color blending
|
DisableColorBlend :: proc() --- // Disable color blending
|
||||||
rlEnableDepthTest :: proc() --- // Enable depth test
|
EnableDepthTest :: proc() --- // Enable depth test
|
||||||
rlDisableDepthTest :: proc() --- // Disable depth test
|
DisableDepthTest :: proc() --- // Disable depth test
|
||||||
rlEnableDepthMask :: proc() --- // Enable depth write
|
EnableDepthMask :: proc() --- // Enable depth write
|
||||||
rlDisableDepthMask :: proc() --- // Disable depth write
|
DisableDepthMask :: proc() --- // Disable depth write
|
||||||
rlEnableBackfaceCulling :: proc() --- // Enable backface culling
|
EnableBackfaceCulling :: proc() --- // Enable backface culling
|
||||||
rlDisableBackfaceCulling :: proc() --- // Disable backface culling
|
DisableBackfaceCulling :: proc() --- // Disable backface culling
|
||||||
rlSetCullFace :: proc(mode: CullMode) --- // Set face culling mode
|
SetCullFace :: proc(mode: CullMode) --- // Set face culling mode
|
||||||
rlEnableScissorTest :: proc() --- // Enable scissor test
|
EnableScissorTest :: proc() --- // Enable scissor test
|
||||||
rlDisableScissorTest :: proc() --- // Disable scissor test
|
DisableScissorTest :: proc() --- // Disable scissor test
|
||||||
rlScissor :: proc(x, y, width, height: c.int) --- // Scissor test
|
Scissor :: proc(x, y, width, height: c.int) --- // Scissor test
|
||||||
rlEnableWireMode :: proc() --- // Enable wire mode
|
EnableWireMode :: proc() --- // Enable wire mode
|
||||||
rlEnablePointMode :: proc() --- // Enable point mode
|
EnablePointMode :: proc() --- // Enable point mode
|
||||||
rlDisableWireMode :: proc() --- // Disable wire and point modes
|
DisableWireMode :: proc() --- // Disable wire and point modes
|
||||||
rlSetLineWidth :: proc(width: f32) --- // Set the line drawing width
|
SetLineWidth :: proc(width: f32) --- // Set the line drawing width
|
||||||
rlGetLineWidth :: proc() -> f32 --- // Get the line drawing width
|
GetLineWidth :: proc() -> f32 --- // Get the line drawing width
|
||||||
rlEnableSmoothLines :: proc() --- // Enable line aliasing
|
EnableSmoothLines :: proc() --- // Enable line aliasing
|
||||||
rlDisableSmoothLines :: proc() --- // Disable line aliasing
|
DisableSmoothLines :: proc() --- // Disable line aliasing
|
||||||
rlEnableStereoRender :: proc() --- // Enable stereo rendering
|
EnableStereoRender :: proc() --- // Enable stereo rendering
|
||||||
rlDisableStereoRender :: proc() --- // Disable stereo rendering
|
DisableStereoRender :: proc() --- // Disable stereo rendering
|
||||||
rlIsStereoRenderEnabled :: proc() -> bool --- // Check if stereo render is enabled
|
IsStereoRenderEnabled :: proc() -> bool --- // Check if stereo render is enabled
|
||||||
|
|
||||||
|
|
||||||
rlClearColor :: proc(r, g, b, a: u8) --- // Clear color buffer with color
|
ClearColor :: proc(r, g, b, a: u8) --- // Clear color buffer with color
|
||||||
rlClearScreenBuffers :: proc() --- // Clear used screen buffers (color and depth)
|
ClearScreenBuffers :: proc() --- // Clear used screen buffers (color and depth)
|
||||||
rlCheckErrors :: proc() --- // Check and log OpenGL error codes
|
CheckErrors :: proc() --- // Check and log OpenGL error codes
|
||||||
rlSetBlendMode :: proc(mode: c.int) --- // Set blending mode
|
SetBlendMode :: proc(mode: c.int) --- // Set blending mode
|
||||||
rlSetBlendFactors :: proc(glSrcFactor, glDstFactor, glEquation: c.int) --- // Set blending mode factor and equation (using OpenGL factors)
|
SetBlendFactors :: proc(glSrcFactor, glDstFactor, glEquation: c.int) --- // Set blending mode factor and equation (using OpenGL factors)
|
||||||
rlSetBlendFactorsSeparate :: proc(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha: c.int) --- // Set blending mode factors and equations separately (using OpenGL factors)
|
SetBlendFactorsSeparate :: proc(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha: c.int) --- // Set blending mode factors and equations separately (using OpenGL factors)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - rlgl functionality
|
// Functions Declaration - rlgl functionality
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// rlgl initialization functions
|
// rlgl initialization functions
|
||||||
rlglInit :: proc(width, height: c.int) --- // Initialize rlgl (buffers, shaders, textures, states)
|
@(link_prefix="rlgl")
|
||||||
rlglClose :: proc() --- // De-initialize rlgl (buffers, shaders, textures)
|
Init :: proc(width, height: c.int) --- // Initialize rlgl (buffers, shaders, textures, states)
|
||||||
rlLoadExtensions :: proc(loader: rawptr) --- // Load OpenGL extensions (loader function required)
|
@(link_prefix="rlgl")
|
||||||
rlGetVersion :: proc() -> GlVersion --- // Get current OpenGL version
|
Close :: proc() --- // De-initialize rlgl (buffers, shaders, textures)
|
||||||
rlSetFramebufferWidth :: proc(width: c.int) --- // Set current framebuffer width
|
LoadExtensions :: proc(loader: rawptr) --- // Load OpenGL extensions (loader function required)
|
||||||
rlGetFramebufferWidth :: proc() -> c.int --- // Get default framebuffer width
|
GetVersion :: proc() -> GlVersion --- // Get current OpenGL version
|
||||||
rlSetFramebufferHeight :: proc(height: c.int) --- // Set current framebuffer height
|
SetFramebufferWidth :: proc(width: c.int) --- // Set current framebuffer width
|
||||||
rlGetFramebufferHeight :: proc() -> c.int --- // Get default framebuffer height
|
GetFramebufferWidth :: proc() -> c.int --- // Get default framebuffer width
|
||||||
|
SetFramebufferHeight :: proc(height: c.int) --- // Set current framebuffer height
|
||||||
|
GetFramebufferHeight :: proc() -> c.int --- // Get default framebuffer height
|
||||||
|
|
||||||
|
|
||||||
rlGetTextureIdDefault :: proc() -> c.uint --- // Get default texture id
|
GetTextureIdDefault :: proc() -> c.uint --- // Get default texture id
|
||||||
rlGetShaderIdDefault :: proc() -> c.uint --- // Get default shader id
|
GetShaderIdDefault :: proc() -> c.uint --- // Get default shader id
|
||||||
rlGetShaderLocsDefault :: proc() -> [^]c.int --- // Get default shader locations
|
GetShaderLocsDefault :: proc() -> [^]c.int --- // Get default shader locations
|
||||||
|
|
||||||
// Render batch management
|
// Render batch management
|
||||||
// NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode
|
// NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode
|
||||||
// but this render batch API is exposed in case of custom batches are required
|
// but this render batch API is exposed in case of custom batches are required
|
||||||
rlLoadRenderBatch :: proc(numBuffers, bufferElements: c.int) -> RenderBatch --- // Load a render batch system
|
LoadRenderBatch :: proc(numBuffers, bufferElements: c.int) -> RenderBatch --- // Load a render batch system
|
||||||
rlUnloadRenderBatch :: proc(batch: RenderBatch) --- // Unload render batch system
|
UnloadRenderBatch :: proc(batch: RenderBatch) --- // Unload render batch system
|
||||||
rlDrawRenderBatch :: proc(batch: ^RenderBatch) --- // Draw render batch data (Update->Draw->Reset)
|
DrawRenderBatch :: proc(batch: ^RenderBatch) --- // Draw render batch data (Update->Draw->Reset)
|
||||||
rlSetRenderBatchActive :: proc(batch: ^RenderBatch) --- // Set the active render batch for rlgl (NULL for default internal)
|
SetRenderBatchActive :: proc(batch: ^RenderBatch) --- // Set the active render batch for rlgl (NULL for default internal)
|
||||||
rlDrawRenderBatchActive :: proc() --- // Update and draw internal render batch
|
DrawRenderBatchActive :: proc() --- // Update and draw internal render batch
|
||||||
rlCheckRenderBatchLimit :: proc(vCount: c.int) -> c.int --- // Check internal buffer overflow for a given number of vertex
|
CheckRenderBatchLimit :: proc(vCount: c.int) -> c.int --- // Check internal buffer overflow for a given number of vertex
|
||||||
|
|
||||||
rlSetTexture :: proc(id: c.uint) --- // Set current texture for render batch and check buffers limits
|
SetTexture :: proc(id: c.uint) --- // Set current texture for render batch and check buffers limits
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Vertex buffers management
|
// Vertex buffers management
|
||||||
rlLoadVertexArray :: proc() -> c.uint --- // Load vertex array (vao) if supported
|
LoadVertexArray :: proc() -> c.uint --- // Load vertex array (vao) if supported
|
||||||
rlLoadVertexBuffer :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> c.uint --- // Load a vertex buffer attribute
|
LoadVertexBuffer :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> c.uint --- // Load a vertex buffer attribute
|
||||||
rlLoadVertexBufferElement :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> c.uint --- // Load a new attributes element buffer
|
LoadVertexBufferElement :: proc(buffer: rawptr, size: c.int, is_dynamic: bool) -> c.uint --- // Load a new attributes element buffer
|
||||||
rlUpdateVertexBuffer :: proc(bufferId: c.uint, data: rawptr, dataSize: c.int, offset: c.int) --- // Update GPU buffer with new data
|
UpdateVertexBuffer :: proc(bufferId: c.uint, data: rawptr, dataSize: c.int, offset: c.int) --- // Update GPU buffer with new data
|
||||||
rlUpdateVertexBufferElements :: proc(id: c.uint, data: rawptr, dataSize: c.int, offset: c.int) --- // Update vertex buffer elements with new data
|
UpdateVertexBufferElements :: proc(id: c.uint, data: rawptr, dataSize: c.int, offset: c.int) --- // Update vertex buffer elements with new data
|
||||||
rlUnloadVertexArray :: proc(vaoId: c.uint) ---
|
UnloadVertexArray :: proc(vaoId: c.uint) ---
|
||||||
rlUnloadVertexBuffer :: proc(vboId: c.uint) ---
|
UnloadVertexBuffer :: proc(vboId: c.uint) ---
|
||||||
rlSetVertexAttribute :: proc(index: c.uint, compSize: c.int, type: c.int, normalized: bool, stride: c.int, pointer: rawptr) ---
|
SetVertexAttribute :: proc(index: c.uint, compSize: c.int, type: c.int, normalized: bool, stride: c.int, pointer: rawptr) ---
|
||||||
rlSetVertexAttributeDivisor :: proc(index: c.uint, divisor: c.int) ---
|
SetVertexAttributeDivisor :: proc(index: c.uint, divisor: c.int) ---
|
||||||
rlSetVertexAttributeDefault :: proc(locIndex: c.int, value: rawptr, attribType: c.int, count: c.int) --- // Set vertex attribute default value
|
SetVertexAttributeDefault :: proc(locIndex: c.int, value: rawptr, attribType: c.int, count: c.int) --- // Set vertex attribute default value
|
||||||
rlDrawVertexArray :: proc(offset: c.int, count: c.int) ---
|
DrawVertexArray :: proc(offset: c.int, count: c.int) ---
|
||||||
rlDrawVertexArrayElements :: proc(offset: c.int, count: c.int, buffer: rawptr) ---
|
DrawVertexArrayElements :: proc(offset: c.int, count: c.int, buffer: rawptr) ---
|
||||||
rlDrawVertexArrayInstanced :: proc(offset: c.int, count: c.int, instances: c.int) ---
|
DrawVertexArrayInstanced :: proc(offset: c.int, count: c.int, instances: c.int) ---
|
||||||
rlDrawVertexArrayElementsInstanced :: proc(offset: c.int, count: c.int, buffer: rawptr, instances: c.int) ---
|
DrawVertexArrayElementsInstanced :: proc(offset: c.int, count: c.int, buffer: rawptr, instances: c.int) ---
|
||||||
|
|
||||||
// Textures management
|
// Textures management
|
||||||
rlLoadTexture :: proc(data: rawptr, width, height: c.int, format: c.int, mipmapCount: c.int) -> c.uint --- // Load texture in GPU
|
LoadTexture :: proc(data: rawptr, width, height: c.int, format: c.int, mipmapCount: c.int) -> c.uint --- // Load texture in GPU
|
||||||
rlLoadTextureDepth :: proc(width, height: c.int, useRenderBuffer: bool) -> c.uint --- // Load depth texture/renderbuffer (to be attached to fbo)
|
LoadTextureDepth :: proc(width, height: c.int, useRenderBuffer: bool) -> c.uint --- // Load depth texture/renderbuffer (to be attached to fbo)
|
||||||
rlLoadTextureCubemap :: proc(data: rawptr, size: c.int, format: c.int) -> c.uint --- // Load texture cubemap
|
LoadTextureCubemap :: proc(data: rawptr, size: c.int, format: c.int) -> c.uint --- // Load texture cubemap
|
||||||
rlUpdateTexture :: proc(id: c.uint, offsetX, offsetY: c.int, width, height: c.int, format: c.int, data: rawptr) --- // Update GPU texture with new data
|
UpdateTexture :: proc(id: c.uint, offsetX, offsetY: c.int, width, height: c.int, format: c.int, data: rawptr) --- // Update GPU texture with new data
|
||||||
rlGetGlTextureFormats :: proc(format: c.int, glInternalFormat, glFormat, glType: ^c.uint) --- // Get OpenGL internal formats
|
GetGlTextureFormats :: proc(format: c.int, glInternalFormat, glFormat, glType: ^c.uint) --- // Get OpenGL internal formats
|
||||||
rlGetPixelFormatName :: proc(format: c.uint) -> cstring --- // Get name string for pixel format
|
GetPixelFormatName :: proc(format: c.uint) -> cstring --- // Get name string for pixel format
|
||||||
rlUnloadTexture :: proc(id: c.uint) --- // Unload texture from GPU memory
|
UnloadTexture :: proc(id: c.uint) --- // Unload texture from GPU memory
|
||||||
rlGenTextureMipmaps :: proc(id: c.uint, width, height: c.int, format: c.int, mipmaps: ^c.int) --- // Generate mipmap data for selected texture
|
GenTextureMipmaps :: proc(id: c.uint, width, height: c.int, format: c.int, mipmaps: ^c.int) --- // Generate mipmap data for selected texture
|
||||||
rlReadTexturePixels :: proc(id: c.uint, width, height: c.int, format: c.int) -> rawptr --- // Read texture pixel data
|
ReadTexturePixels :: proc(id: c.uint, width, height: c.int, format: c.int) -> rawptr --- // Read texture pixel data
|
||||||
rlReadScreenPixels :: proc(width, height: c.int) -> [^]byte --- // Read screen pixel data (color buffer)
|
ReadScreenPixels :: proc(width, height: c.int) -> [^]byte --- // Read screen pixel data (color buffer)
|
||||||
|
|
||||||
// Framebuffer management (fbo)
|
// Framebuffer management (fbo)
|
||||||
rlLoadFramebuffer :: proc(width, height: c.int) -> c.uint --- // Load an empty framebuffer
|
LoadFramebuffer :: proc(width, height: c.int) -> c.uint --- // Load an empty framebuffer
|
||||||
rlFramebufferAttach :: proc(fboId, texId: c.uint, attachType: c.int, texType: c.int, mipLevel: c.int) --- // Attach texture/renderbuffer to a framebuffer
|
FramebufferAttach :: proc(fboId, texId: c.uint, attachType: c.int, texType: c.int, mipLevel: c.int) --- // Attach texture/renderbuffer to a framebuffer
|
||||||
rlFramebufferComplete :: proc(id: c.uint) -> bool --- // Verify framebuffer is complete
|
FramebufferComplete :: proc(id: c.uint) -> bool --- // Verify framebuffer is complete
|
||||||
rlUnloadFramebuffer :: proc(id: c.uint) --- // Delete framebuffer from GPU
|
UnloadFramebuffer :: proc(id: c.uint) --- // Delete framebuffer from GPU
|
||||||
|
|
||||||
// Shaders management
|
// Shaders management
|
||||||
rlLoadShaderCode :: proc(vsCode, fsCode: cstring) -> c.uint --- // Load shader from code strings
|
LoadShaderCode :: proc(vsCode, fsCode: cstring) -> c.uint --- // Load shader from code strings
|
||||||
rlCompileShader :: proc(shaderCode: cstring, type: c.int) -> c.uint --- // Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)
|
CompileShader :: proc(shaderCode: cstring, type: c.int) -> c.uint --- // Compile custom shader and return shader id (type: VERTEX_SHADER, FRAGMENT_SHADER, COMPUTE_SHADER)
|
||||||
rlLoadShaderProgram :: proc(vShaderId, fShaderId: c.uint) -> c.uint --- // Load custom shader program
|
LoadShaderProgram :: proc(vShaderId, fShaderId: c.uint) -> c.uint --- // Load custom shader program
|
||||||
rlUnloadShaderProgram :: proc(id: c.uint) --- // Unload shader program
|
UnloadShaderProgram :: proc(id: c.uint) --- // Unload shader program
|
||||||
rlGetLocationUniform :: proc(shaderId: c.uint, uniformName: cstring) -> c.int --- // Get shader location uniform
|
GetLocationUniform :: proc(shaderId: c.uint, uniformName: cstring) -> c.int --- // Get shader location uniform
|
||||||
rlGetLocationAttrib :: proc(shaderId: c.uint, attribName: cstring) -> c.int --- // Get shader location attribute
|
GetLocationAttrib :: proc(shaderId: c.uint, attribName: cstring) -> c.int --- // Get shader location attribute
|
||||||
rlSetUniform :: proc(locIndex: c.int, value: rawptr, uniformType: c.int, count: c.int) --- // Set shader value uniform
|
SetUniform :: proc(locIndex: c.int, value: rawptr, uniformType: c.int, count: c.int) --- // Set shader value uniform
|
||||||
rlSetUniformMatrix :: proc(locIndex: c.int, mat: Matrix) --- // Set shader value matrix
|
SetUniformMatrix :: proc(locIndex: c.int, mat: Matrix) --- // Set shader value matrix
|
||||||
rlSetUniformSampler :: proc(locIndex: c.int, textureId: c.uint) --- // Set shader value sampler
|
SetUniformSampler :: proc(locIndex: c.int, textureId: c.uint) --- // Set shader value sampler
|
||||||
rlSetShader :: proc(id: c.uint, locs: [^]c.int) --- // Set shader currently active (id and locations)
|
SetShader :: proc(id: c.uint, locs: [^]c.int) --- // Set shader currently active (id and locations)
|
||||||
|
|
||||||
// Compute shader management
|
// Compute shader management
|
||||||
rlLoadComputeShaderProgram :: proc(shaderId: c.uint) -> c.uint --- // Load compute shader program
|
LoadComputeShaderProgram :: proc(shaderId: c.uint) -> c.uint --- // Load compute shader program
|
||||||
rlComputeShaderDispatch :: proc(groupX, groupY, groupZ: c.uint) --- // Dispatch compute shader (equivalent to *draw* for graphics pipeline)
|
ComputeShaderDispatch :: proc(groupX, groupY, groupZ: c.uint) --- // Dispatch compute shader (equivalent to *draw* for graphics pipeline)
|
||||||
|
|
||||||
// Shader buffer storage object management (ssbo)
|
// Shader buffer storage object management (ssbo)
|
||||||
rlLoadShaderBuffer :: proc(size: c.uint, data: rawptr, usageHint: c.int) -> c.uint --- // Load shader storage buffer object (SSBO)
|
LoadShaderBuffer :: proc(size: c.uint, data: rawptr, usageHint: c.int) -> c.uint --- // Load shader storage buffer object (SSBO)
|
||||||
rlUnloadShaderBuffer :: proc(ssboId: c.uint) --- // Unload shader storage buffer object (SSBO)
|
UnloadShaderBuffer :: proc(ssboId: c.uint) --- // Unload shader storage buffer object (SSBO)
|
||||||
rlUpdateShaderBuffer :: proc(id: c.uint, data: rawptr, dataSize: c.uint, offset: c.uint) --- // Update SSBO buffer data
|
UpdateShaderBuffer :: proc(id: c.uint, data: rawptr, dataSize: c.uint, offset: c.uint) --- // Update SSBO buffer data
|
||||||
rlBindShaderBuffer :: proc(id: c.uint, index: c.uint) --- // Bind SSBO buffer
|
BindShaderBuffer :: proc(id: c.uint, index: c.uint) --- // Bind SSBO buffer
|
||||||
rlReadShaderBuffer :: proc(id: c.uint, dest: rawptr, count: c.uint, offset: c.uint) --- // Read SSBO buffer data (GPU->CPU)
|
ReadShaderBuffer :: proc(id: c.uint, dest: rawptr, count: c.uint, offset: c.uint) --- // Read SSBO buffer data (GPU->CPU)
|
||||||
rlCopyShaderBuffer :: proc(destId, srcId: c.uint, destOffset, srcOffset: c.uint, count: c.uint) --- // Copy SSBO data between buffers
|
CopyShaderBuffer :: proc(destId, srcId: c.uint, destOffset, srcOffset: c.uint, count: c.uint) --- // Copy SSBO data between buffers
|
||||||
rlGetShaderBufferSize :: proc(id: c.uint) -> c.uint --- // Get SSBO buffer size
|
GetShaderBufferSize :: proc(id: c.uint) -> c.uint --- // Get SSBO buffer size
|
||||||
|
|
||||||
// Buffer management
|
// Buffer management
|
||||||
rlBindImageTexture :: proc(id: c.uint, index: c.uint, format: c.int, readonly: bool) --- // Bind image texture
|
BindImageTexture :: proc(id: c.uint, index: c.uint, format: c.int, readonly: bool) --- // Bind image texture
|
||||||
|
|
||||||
// Matrix state management
|
// Matrix state management
|
||||||
rlGetMatrixModelview :: proc() -> Matrix --- // Get internal modelview matrix
|
GetMatrixModelview :: proc() -> Matrix --- // Get internal modelview matrix
|
||||||
rlGetMatrixProjection :: proc() -> Matrix --- // Get internal projection matrix
|
GetMatrixProjection :: proc() -> Matrix --- // Get internal projection matrix
|
||||||
rlGetMatrixTransform :: proc() -> Matrix --- // Get internal accumulated transform matrix
|
GetMatrixTransform :: proc() -> Matrix --- // Get internal accumulated transform matrix
|
||||||
rlGetMatrixProjectionStereo :: proc(eye: c.int) -> Matrix --- // Get internal projection matrix for stereo render (selected eye)
|
GetMatrixProjectionStereo :: proc(eye: c.int) -> Matrix --- // Get internal projection matrix for stereo render (selected eye)
|
||||||
rlGetMatrixViewOffsetStereo :: proc(eye: c.int) -> Matrix --- // Get internal view offset matrix for stereo render (selected eye)
|
GetMatrixViewOffsetStereo :: proc(eye: c.int) -> Matrix --- // Get internal view offset matrix for stereo render (selected eye)
|
||||||
rlSetMatrixProjection :: proc(proj: Matrix) --- // Set a custom projection matrix (replaces internal projection matrix)
|
SetMatrixProjection :: proc(proj: Matrix) --- // Set a custom projection matrix (replaces internal projection matrix)
|
||||||
rlSetMatrixModelview :: proc(view: Matrix) --- // Set a custom modelview matrix (replaces internal modelview matrix)
|
SetMatrixModelview :: proc(view: Matrix) --- // Set a custom modelview matrix (replaces internal modelview matrix)
|
||||||
rlSetMatrixProjectionStereo :: proc(right, left: Matrix) --- // Set eyes projection matrices for stereo rendering
|
SetMatrixProjectionStereo :: proc(right, left: Matrix) --- // Set eyes projection matrices for stereo rendering
|
||||||
rlSetMatrixViewOffsetStereo :: proc(right, left: Matrix) --- // Set eyes view offsets matrices for stereo rendering
|
SetMatrixViewOffsetStereo :: proc(right, left: Matrix) --- // Set eyes view offsets matrices for stereo rendering
|
||||||
|
|
||||||
// Quick and dirty cube/quad buffers load->draw->unload
|
// Quick and dirty cube/quad buffers load->draw->unload
|
||||||
rlLoadDrawCube :: proc() --- // Load and draw a cube
|
LoadDrawCube :: proc() --- // Load and draw a cube
|
||||||
rlLoadDrawQuad :: proc() --- // Load and draw a quad
|
LoadDrawQuad :: proc() --- // Load and draw a quad
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user