This commit is contained in:
Judah Caruso 2025-05-11 04:24:50 -06:00
parent bcabcb1b87
commit a213e70ed4
18 changed files with 13765 additions and 0 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
.build/ .build/
**.dSYM
.DS_Store

View file

@ -0,0 +1,15 @@
main :: () {
rl.InitWindow(1280, 720, "Hello, Jai!");
defer rl.CloseWindow();
rl.SetTargetFPS(60);
while !rl.WindowShouldClose() {
rl.BeginDrawing();
rl.ClearBackground(rl.RAYWHITE);
rl.DrawText("Hello, from Jai!", 10, 10, 24, rl.BLACK);
rl.EndDrawing();
}
}
rl :: #import,file "../module.jai";

View file

@ -0,0 +1,36 @@
WIDTH :: 1280;
HEIGHT :: 720;
main :: () {
rl.InitWindow(WIDTH, HEIGHT, "Hello, from Jai!");
defer rl.CloseWindow();
rl.SetTargetFPS(60);
ball_pos := rl.Vector2.{ x = WIDTH / 2, y = HEIGHT / 2 };
while !rl.WindowShouldClose() {
dt := rl.GetFrameTime();
raw_dir: rl.Vector2;
if rl.IsKeyDown(.W) then raw_dir.y -= 1;
if rl.IsKeyDown(.S) then raw_dir.y += 1;
if rl.IsKeyDown(.A) then raw_dir.x -= 1;
if rl.IsKeyDown(.D) then raw_dir.x += 1;
dir := rl.Vector2Normalize(raw_dir);
ball_pos.x += dir.x * 200 * dt;
ball_pos.y += dir.y * 200 * dt;
rl.BeginDrawing();
rl.ClearBackground(rl.RAYWHITE);
rl.DrawText("Move the ball with WASD", 10, 10, 24, rl.BLACK);
rl.DrawCircleV(ball_pos, 50, rl.RED);
rl.EndDrawing();
}
}
#import "Basic";
rl :: #import,file "../module.jai";

139
raylib/generate.jai Normal file
View file

@ -0,0 +1,139 @@
#run {
set_build_options_dc(.{ do_output = false, write_added_strings = false });
print(".. generating bindings (platform: %)\n\n", OS);
opts: Generate_Bindings_Options;
opts.visitor = rl_enum_visitor;
opts.generate_library_declarations = false;
LIBRARY_NAME :: "raylib";
#if OS == .WINDOWS {
array_add(*opts.libpaths, "win");
} else #if OS == .LINUX {
array_add(*opts.libpaths, "linux");
} else #if OS == .MACOS {
array_add(*opts.libpaths, "mac");
array_add(*opts.system_include_paths, "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include");
} else {
assert(false, "unsupported OS: %", OS);
}
array_add(*opts.libnames, LIBRARY_NAME);
array_add(*opts.source_files, "lib/raylib.h", "lib/raymath.h");
array_add(*opts.extra_clang_arguments, "-x", "c");
array_add(*opts.system_include_paths, GENERATOR_DEFAULT_SYSTEM_INCLUDE_PATH);
assert(generate_bindings(opts, "raylib.jai"), "unable to generate bindings for raylib!");
libpaths := opts.libpaths;
opts = .{};
opts.generate_library_declarations = false;
opts.libpaths = libpaths;
array_add(*opts.strip_prefixes, "rl", "RL");
array_add(*opts.libnames, LIBRARY_NAME);
array_add(*opts.source_files, "lib/rlgl.h");
array_add(*opts.extra_clang_arguments, "-x", "c");
array_add(*opts.system_include_paths, GENERATOR_DEFAULT_SYSTEM_INCLUDE_PATH);
assert(generate_bindings(opts, "./rlgl/rlgl.jai"), "unable to generate bindings for raylib!");
}
rl_enum_visitor :: (decl: *Declaration, parent: *Declaration) -> Declaration_Visit_Result {
replace_type :: (args: []*Declaration, arg_name: string, hardcoded_type: string) {
for args if it.name == arg_name {
change_type_to_enum(it, hardcoded_type);
return;
}
}
if decl.kind == {
case .TYPEDEF;
td := decl.(*Typedef);
if td.name == {
case "TraceLogCallback";
ptr := td.type.pointer_to;
replace_type(ptr.type_of_function.arguments, "logLevel", "TraceLogLevel");
}
case .FUNCTION;
func := decl.(*Function);
ftype := func.type.type_of_function;
if func.name == {
case "IsWindowState"; #through;
case "SetWindowState"; #through;
case "ClearWindowState";
replace_type(ftype.arguments, "flags", "ConfigFlags");
case "IsKeyPressed"; #through;
case "IsKeyPressedRepeat"; #through;
case "IsKeyDown"; #through;
case "IsKeyReleased"; #through;
case "IsKeyUp"; #through;
case "SetExitKey";
replace_type(ftype.arguments, "key", "KeyboardKey");
case "IsGamepadButtonPressed"; #through;
case "IsGamepadButtonDown"; #through;
case "IsGamepadButtonReleased"; #through;
case "IsGamepadButtonUp";
replace_type(ftype.arguments, "button", "GamepadButton");
case "GetGamepadAxisMovement";
replace_type(ftype.arguments, "axis", "GamepadAxis");
case "IsMouseButtonPressed"; #through;
case "IsMouseButtonDown"; #through;
case "IsMouseButtonReleased"; #through;
case "IsMouseButtonUp";
replace_type(ftype.arguments, "button", "MouseButton");
case "IsGestureDetected";
replace_type(ftype.arguments, "gesture", "Gesture");
case "SetGesturesEnabled";
replace_type(ftype.arguments, "flags", "Gesture");
case "GetGestureDetected";
real := New(CType);
real.hardcoded_jai_string = "Gesture";
ftype.return_type = real;
case "UpdateCamera";
replace_type(ftype.arguments, "mode", "CameraMode");
case "LoadImageRaw"; #through;
case "GetPixelColor"; #through;
case "GetPixelDataSize"; #through;
case "SetPixelColor";
replace_type(ftype.arguments, "format", "PixelFormat");
case "ImageFormat";
replace_type(ftype.arguments, "newFormat", "PixelFormat");
case "LoadTextureCubemap";
replace_type(ftype.arguments, "layout", "CubemapLayout");
case "SetTextureFilter";
replace_type(ftype.arguments, "filter", "TextureFilter");
case "SetTextureWrap";
replace_type(ftype.arguments, "wrap", "TextureWrap");
case "SetMaterialTexture";
replace_type(ftype.arguments, "mapType", "MaterialMapIndex");
}
}
return .STOP;
};
#import "File";
#import "Basic";
#import "String";
#import "Compiler";
#import "Hash_Table";
#import "Bindings_Generator";

1708
raylib/lib/raylib.h Normal file

File diff suppressed because it is too large Load diff

2941
raylib/lib/raymath.h Normal file

File diff suppressed because it is too large Load diff

5262
raylib/lib/rlgl.h Normal file

File diff suppressed because it is too large Load diff

BIN
raylib/linux/raylib.a Normal file

Binary file not shown.

BIN
raylib/linux/raylib.so Executable file

Binary file not shown.

BIN
raylib/mac/raylib.a Normal file

Binary file not shown.

BIN
raylib/mac/raylib.dylib Executable file

Binary file not shown.

62
raylib/module.jai Normal file
View file

@ -0,0 +1,62 @@
#module_parameters(STATIC := false);
#scope_export
DARKGRAY :: Color.{ 80, 80, 80, 255 }; // Dark Gray
YELLOW :: Color.{ 253, 249, 0, 255 }; // Yellow
GOLD :: Color.{ 255, 203, 0, 255 }; // Gold
ORANGE :: Color.{ 255, 161, 0, 255 }; // Orange
PINK :: Color.{ 255, 109, 194, 255 }; // Pink
RED :: Color.{ 230, 41, 55, 255 }; // Red
MAROON :: Color.{ 190, 33, 55, 255 }; // Maroon
GREEN :: Color.{ 0, 228, 48, 255 }; // Green
LIME :: Color.{ 0, 158, 47, 255 }; // Lime
DARKGREEN :: Color.{ 0, 117, 44, 255 }; // Dark Green
SKYBLUE :: Color.{ 102, 191, 255, 255 }; // Sky Blue
BLUE :: Color.{ 0, 121, 241, 255 }; // Blue
DARKBLUE :: Color.{ 0, 82, 172, 255 }; // Dark Blue
PURPLE :: Color.{ 200, 122, 255, 255 }; // Purple
VIOLET :: Color.{ 135, 60, 190, 255 }; // Violet
DARKPURPLE :: Color.{ 112, 31, 126, 255 }; // Dark Purple
BEIGE :: Color.{ 211, 176, 131, 255 }; // Beige
BROWN :: Color.{ 127, 106, 79, 255 }; // Brown
DARKBROWN :: Color.{ 76, 63, 47, 255 }; // Dark Brown
WHITE :: Color.{ 255, 255, 255, 255 }; // White
BLACK :: Color.{ 0, 0, 0, 255 }; // Black
BLANK :: Color.{ 0, 0, 0, 0 }; // Blank (Transparent)
MAGENTA :: Color.{ 255, 0, 255, 255 }; // Magenta
RAYWHITE :: Color.{ 245, 245, 245, 255 }; // My own White (raylib logo)
#if STATIC {
#if OS == {
case .WINDOWS;
raylib :: #library,no_dll,link_always "win/raylib";
case .MACOS;
raylib :: #library,no_dll,link_always "mac/raylib";
case .LINUX;
raylib :: #library,no_dll,link_always "linux/raylib";
}
}
else {
#if OS == {
case .WINDOWS;
raylib :: #library "win/raylib";
case .MACOS;
raylib :: #library "mac/raylib";
case .LINUX;
raylib :: #library "linux/raylib";
}
}
#if OS == {
case .WINDOWS;
user32 :: #library,system,link_always "user32";
winmm :: #library,system,link_always "winmm";
gdi32 :: #library,system,link_always "gdi32";
shell32 :: #library,system,link_always "shell32";
case .MACOS;
cocoa :: #library,system,link_always "Cocoa";
iOKit :: #library,system,link_always "IOKit";
}
#load "raylib.jai";

2798
raylib/raylib.jai Normal file

File diff suppressed because it is too large Load diff

19
raylib/readme.md Normal file
View file

@ -0,0 +1,19 @@
# Raylib
[Raylib](https://www.raylib.com) 5.0 bindings for Jai.
## Usage
See: `examples/`
## Notes
- These are generated using Jai's `Bindings_Generator` library (`jai generate.jai`)
- `extras.jai` contains auto-generated macros for Begin/End procs
- `interop.jai` contains overloads to make calling into Raylib easier
To generate bindings for a different version:
- Place headers in `lib/` and dynamic libraries in `win/`, `mac/`, or `linux/`
- Change `LIBRARY_NAME` in `generate.jai` to match the dynamic library's name (no extension)
- Run `jai generate.jai`

24
raylib/rlgl/module.jai Normal file
View file

@ -0,0 +1,24 @@
#module_parameters(STATIC := false);
#if STATIC {
#if OS == {
case .WINDOWS;
raylib :: #library,no_dll "../win/raylib";
case .MACOS;
raylib :: #library,no_dll "../mac/raylib";
case .LINUX;
raylib :: #library,no_dll "../linux/raylib";
}
}
else {
#if OS == {
case .WINDOWS;
raylib :: #library "../win/raylib";
case .MACOS;
raylib :: #library "../mac/raylib";
case .LINUX;
raylib :: #library "../linux/raylib";
}
}
#load "rlgl.jai";

759
raylib/rlgl/rlgl.jai Normal file
View file

@ -0,0 +1,759 @@
//
// This file was auto-generated using the following command:
//
// jai /Users/judah/Main/cod/jai/jc.jai/raylib/generate.jai
//
RLGL_VERSION :: "5.0";
RL_DEFAULT_BATCH_BUFFER_ELEMENTS :: 8192;
RL_DEFAULT_BATCH_BUFFERS :: 1;
RL_DEFAULT_BATCH_DRAWCALLS :: 256;
RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS :: 4;
RL_MAX_MATRIX_STACK_SIZE :: 32;
RL_MAX_SHADER_LOCATIONS :: 32;
RL_CULL_DISTANCE_NEAR :: 0.01;
RL_CULL_DISTANCE_FAR :: 1000.0;
RL_TEXTURE_WRAP_S :: 0x2802;
RL_TEXTURE_WRAP_T :: 0x2803;
RL_TEXTURE_MAG_FILTER :: 0x2800;
RL_TEXTURE_MIN_FILTER :: 0x2801;
RL_TEXTURE_FILTER_NEAREST :: 0x2600;
RL_TEXTURE_FILTER_LINEAR :: 0x2601;
RL_TEXTURE_FILTER_MIP_NEAREST :: 0x2700;
RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR :: 0x2702;
RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST :: 0x2701;
RL_TEXTURE_FILTER_MIP_LINEAR :: 0x2703;
RL_TEXTURE_FILTER_ANISOTROPIC :: 0x3000;
RL_TEXTURE_MIPMAP_BIAS_RATIO :: 0x4000;
RL_TEXTURE_WRAP_REPEAT :: 0x2901;
RL_TEXTURE_WRAP_CLAMP :: 0x812F;
RL_TEXTURE_WRAP_MIRROR_REPEAT :: 0x8370;
RL_TEXTURE_WRAP_MIRROR_CLAMP :: 0x8742;
RL_MODELVIEW :: 0x1700;
RL_PROJECTION :: 0x1701;
RL_TEXTURE :: 0x1702;
RL_LINES :: 0x0001;
RL_TRIANGLES :: 0x0004;
RL_QUADS :: 0x0007;
RL_UNSIGNED_BYTE :: 0x1401;
RL_FLOAT :: 0x1406;
RL_STREAM_DRAW :: 0x88E0;
RL_STREAM_READ :: 0x88E1;
RL_STREAM_COPY :: 0x88E2;
RL_STATIC_DRAW :: 0x88E4;
RL_STATIC_READ :: 0x88E5;
RL_STATIC_COPY :: 0x88E6;
RL_DYNAMIC_DRAW :: 0x88E8;
RL_DYNAMIC_READ :: 0x88E9;
RL_DYNAMIC_COPY :: 0x88EA;
RL_FRAGMENT_SHADER :: 0x8B30;
RL_VERTEX_SHADER :: 0x8B31;
RL_COMPUTE_SHADER :: 0x91B9;
RL_ZERO :: 0;
RL_ONE :: 1;
RL_SRC_COLOR :: 0x0300;
RL_ONE_MINUS_SRC_COLOR :: 0x0301;
RL_SRC_ALPHA :: 0x0302;
RL_ONE_MINUS_SRC_ALPHA :: 0x0303;
RL_DST_ALPHA :: 0x0304;
RL_ONE_MINUS_DST_ALPHA :: 0x0305;
RL_DST_COLOR :: 0x0306;
RL_ONE_MINUS_DST_COLOR :: 0x0307;
RL_SRC_ALPHA_SATURATE :: 0x0308;
RL_CONSTANT_COLOR :: 0x8001;
RL_ONE_MINUS_CONSTANT_COLOR :: 0x8002;
RL_CONSTANT_ALPHA :: 0x8003;
RL_ONE_MINUS_CONSTANT_ALPHA :: 0x8004;
RL_FUNC_ADD :: 0x8006;
RL_MIN :: 0x8007;
RL_MAX :: 0x8008;
RL_FUNC_SUBTRACT :: 0x800A;
RL_FUNC_REVERSE_SUBTRACT :: 0x800B;
RL_BLEND_EQUATION :: 0x8009;
RL_BLEND_EQUATION_RGB :: 0x8009;
RL_BLEND_EQUATION_ALPHA :: 0x883D;
RL_BLEND_DST_RGB :: 0x80C8;
RL_BLEND_SRC_RGB :: 0x80C9;
RL_BLEND_DST_ALPHA :: 0x80CA;
RL_BLEND_SRC_ALPHA :: 0x80CB;
RL_BLEND_COLOR :: 0x8005;
RL_READ_FRAMEBUFFER :: 0x8CA8;
RL_DRAW_FRAMEBUFFER :: 0x8CA9;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION :: 0;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD :: 1;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL :: 2;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR :: 3;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT :: 4;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 :: 5;
RL_DEFAULT_SHADER_ATTRIB_LOCATION_INDICES :: 6;
// Matrix, 4x4 components, column major, OpenGL style, right handed
Matrix :: struct {
m0: float; // Matrix first row (4 components)
m4: float; // Matrix first row (4 components)
m8: float; // Matrix first row (4 components)
m12: float; // Matrix first row (4 components)
m1: float; // Matrix second row (4 components)
m5: float; // Matrix second row (4 components)
m9: float; // Matrix second row (4 components)
m13: float; // Matrix second row (4 components)
m2: float; // Matrix third row (4 components)
m6: float; // Matrix third row (4 components)
m10: float; // Matrix third row (4 components)
m14: float; // Matrix third row (4 components)
m3: float; // Matrix fourth row (4 components)
m7: float; // Matrix fourth row (4 components)
m11: float; // Matrix fourth row (4 components)
m15: float; // Matrix fourth row (4 components)
}
// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
VertexBuffer :: struct {
elementCount: s32; // Number of elements in the buffer (QUADS)
vertices: *float; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
texcoords: *float; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
normals: *float; // Vertex normal (XYZ - 3 components per vertex) (shader-location = 2)
colors: *u8; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
indices: *u32; // Vertex indices (in case vertex data comes indexed) (6 indices per quad)
vaoId: u32; // OpenGL Vertex Array Object id
vboId: [5] u32; // OpenGL Vertex Buffer Objects id (5 types of vertex data)
}
// 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)
DrawCall :: struct {
mode: s32; // Drawing mode: LINES, TRIANGLES, QUADS
vertexCount: s32; // Number of vertex of the draw
vertexAlignment: s32; // Number of vertex required for index alignment (LINES, TRIANGLES)
textureId: u32; // Texture id to be used on the draw -> Use to create new draw call if changes
}
// rlRenderBatch type
RenderBatch :: struct {
bufferCount: s32; // Number of vertex buffers (multi-buffering support)
currentBuffer: s32; // Current buffer tracking in case of multi-buffering
vertexBuffer: *VertexBuffer; // Dynamic buffer(s) for vertex data
draws: *DrawCall; // Draw calls array, depends on textureId
drawCounter: s32; // Draw calls counter
currentDepth: float; // Current depth value for next draw
}
// OpenGL version
GlVersion :: enum u32 {
_11 :: 1;
_21 :: 2;
_33 :: 3;
_43 :: 4;
ES_20 :: 5;
ES_30 :: 6;
RL_OPENGL_11 :: _11;
RL_OPENGL_21 :: _21;
RL_OPENGL_33 :: _33;
RL_OPENGL_43 :: _43;
RL_OPENGL_ES_20 :: ES_20;
RL_OPENGL_ES_30 :: ES_30;
}
// Trace log level
// NOTE: Organized by priority level
TraceLogLevel :: enum u32 {
ALL :: 0;
TRACE :: 1;
DEBUG :: 2;
INFO :: 3;
WARNING :: 4;
ERROR :: 5;
FATAL :: 6;
NONE :: 7;
RL_LOG_ALL :: ALL;
RL_LOG_TRACE :: TRACE;
RL_LOG_DEBUG :: DEBUG;
RL_LOG_INFO :: INFO;
RL_LOG_WARNING :: WARNING;
RL_LOG_ERROR :: ERROR;
RL_LOG_FATAL :: FATAL;
RL_LOG_NONE :: NONE;
}
// Texture pixel formats
// NOTE: Support depends on OpenGL version
PixelFormat :: enum u32 {
UNCOMPRESSED_GRAYSCALE :: 1;
UNCOMPRESSED_GRAY_ALPHA :: 2;
UNCOMPRESSED_R5G6B5 :: 3;
UNCOMPRESSED_R8G8B8 :: 4;
UNCOMPRESSED_R5G5B5A1 :: 5;
UNCOMPRESSED_R4G4B4A4 :: 6;
UNCOMPRESSED_R8G8B8A8 :: 7;
UNCOMPRESSED_R32 :: 8;
UNCOMPRESSED_R32G32B32 :: 9;
UNCOMPRESSED_R32G32B32A32 :: 10;
UNCOMPRESSED_R16 :: 11;
UNCOMPRESSED_R16G16B16 :: 12;
UNCOMPRESSED_R16G16B16A16 :: 13;
COMPRESSED_DXT1_RGB :: 14;
COMPRESSED_DXT1_RGBA :: 15;
COMPRESSED_DXT3_RGBA :: 16;
COMPRESSED_DXT5_RGBA :: 17;
COMPRESSED_ETC1_RGB :: 18;
COMPRESSED_ETC2_RGB :: 19;
COMPRESSED_ETC2_EAC_RGBA :: 20;
COMPRESSED_PVRT_RGB :: 21;
COMPRESSED_PVRT_RGBA :: 22;
COMPRESSED_ASTC_4x4_RGBA :: 23;
COMPRESSED_ASTC_8x8_RGBA :: 24;
RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE :: UNCOMPRESSED_GRAYSCALE;
RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA :: UNCOMPRESSED_GRAY_ALPHA;
RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 :: UNCOMPRESSED_R5G6B5;
RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 :: UNCOMPRESSED_R8G8B8;
RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 :: UNCOMPRESSED_R5G5B5A1;
RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 :: UNCOMPRESSED_R4G4B4A4;
RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 :: UNCOMPRESSED_R8G8B8A8;
RL_PIXELFORMAT_UNCOMPRESSED_R32 :: UNCOMPRESSED_R32;
RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 :: UNCOMPRESSED_R32G32B32;
RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 :: UNCOMPRESSED_R32G32B32A32;
RL_PIXELFORMAT_UNCOMPRESSED_R16 :: UNCOMPRESSED_R16;
RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16 :: UNCOMPRESSED_R16G16B16;
RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16A16 :: UNCOMPRESSED_R16G16B16A16;
RL_PIXELFORMAT_COMPRESSED_DXT1_RGB :: COMPRESSED_DXT1_RGB;
RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA :: COMPRESSED_DXT1_RGBA;
RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA :: COMPRESSED_DXT3_RGBA;
RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA :: COMPRESSED_DXT5_RGBA;
RL_PIXELFORMAT_COMPRESSED_ETC1_RGB :: COMPRESSED_ETC1_RGB;
RL_PIXELFORMAT_COMPRESSED_ETC2_RGB :: COMPRESSED_ETC2_RGB;
RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA :: COMPRESSED_ETC2_EAC_RGBA;
RL_PIXELFORMAT_COMPRESSED_PVRT_RGB :: COMPRESSED_PVRT_RGB;
RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA :: COMPRESSED_PVRT_RGBA;
RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA :: COMPRESSED_ASTC_4x4_RGBA;
RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA :: COMPRESSED_ASTC_8x8_RGBA;
}
// Texture parameters: filter mode
// NOTE 1: Filtering considers mipmaps if available in the texture
// NOTE 2: Filter is accordingly set for minification and magnification
TextureFilter :: enum u32 {
POINT :: 0;
BILINEAR :: 1;
TRILINEAR :: 2;
ANISOTROPIC_4X :: 3;
ANISOTROPIC_8X :: 4;
ANISOTROPIC_16X :: 5;
RL_TEXTURE_FILTER_POINT :: POINT;
RL_TEXTURE_FILTER_BILINEAR :: BILINEAR;
RL_TEXTURE_FILTER_TRILINEAR :: TRILINEAR;
RL_TEXTURE_FILTER_ANISOTROPIC_4X :: ANISOTROPIC_4X;
RL_TEXTURE_FILTER_ANISOTROPIC_8X :: ANISOTROPIC_8X;
RL_TEXTURE_FILTER_ANISOTROPIC_16X :: ANISOTROPIC_16X;
}
// Color blending modes (pre-defined)
BlendMode :: enum u32 {
ALPHA :: 0;
ADDITIVE :: 1;
MULTIPLIED :: 2;
ADD_COLORS :: 3;
SUBTRACT_COLORS :: 4;
ALPHA_PREMULTIPLY :: 5;
CUSTOM :: 6;
CUSTOM_SEPARATE :: 7;
RL_BLEND_ALPHA :: ALPHA;
RL_BLEND_ADDITIVE :: ADDITIVE;
RL_BLEND_MULTIPLIED :: MULTIPLIED;
RL_BLEND_ADD_COLORS :: ADD_COLORS;
RL_BLEND_SUBTRACT_COLORS :: SUBTRACT_COLORS;
RL_BLEND_ALPHA_PREMULTIPLY :: ALPHA_PREMULTIPLY;
RL_BLEND_CUSTOM :: CUSTOM;
RL_BLEND_CUSTOM_SEPARATE :: CUSTOM_SEPARATE;
}
// Shader location point type
ShaderLocationIndex :: enum u32 {
VERTEX_POSITION :: 0;
VERTEX_TEXCOORD01 :: 1;
VERTEX_TEXCOORD02 :: 2;
VERTEX_NORMAL :: 3;
VERTEX_TANGENT :: 4;
VERTEX_COLOR :: 5;
MATRIX_MVP :: 6;
MATRIX_VIEW :: 7;
MATRIX_PROJECTION :: 8;
MATRIX_MODEL :: 9;
MATRIX_NORMAL :: 10;
VECTOR_VIEW :: 11;
COLOR_DIFFUSE :: 12;
COLOR_SPECULAR :: 13;
COLOR_AMBIENT :: 14;
MAP_ALBEDO :: 15;
MAP_METALNESS :: 16;
MAP_NORMAL :: 17;
MAP_ROUGHNESS :: 18;
MAP_OCCLUSION :: 19;
MAP_EMISSION :: 20;
MAP_HEIGHT :: 21;
MAP_CUBEMAP :: 22;
MAP_IRRADIANCE :: 23;
MAP_PREFILTER :: 24;
MAP_BRDF :: 25;
RL_SHADER_LOC_VERTEX_POSITION :: VERTEX_POSITION;
RL_SHADER_LOC_VERTEX_TEXCOORD01 :: VERTEX_TEXCOORD01;
RL_SHADER_LOC_VERTEX_TEXCOORD02 :: VERTEX_TEXCOORD02;
RL_SHADER_LOC_VERTEX_NORMAL :: VERTEX_NORMAL;
RL_SHADER_LOC_VERTEX_TANGENT :: VERTEX_TANGENT;
RL_SHADER_LOC_VERTEX_COLOR :: VERTEX_COLOR;
RL_SHADER_LOC_MATRIX_MVP :: MATRIX_MVP;
RL_SHADER_LOC_MATRIX_VIEW :: MATRIX_VIEW;
RL_SHADER_LOC_MATRIX_PROJECTION :: MATRIX_PROJECTION;
RL_SHADER_LOC_MATRIX_MODEL :: MATRIX_MODEL;
RL_SHADER_LOC_MATRIX_NORMAL :: MATRIX_NORMAL;
RL_SHADER_LOC_VECTOR_VIEW :: VECTOR_VIEW;
RL_SHADER_LOC_COLOR_DIFFUSE :: COLOR_DIFFUSE;
RL_SHADER_LOC_COLOR_SPECULAR :: COLOR_SPECULAR;
RL_SHADER_LOC_COLOR_AMBIENT :: COLOR_AMBIENT;
RL_SHADER_LOC_MAP_ALBEDO :: MAP_ALBEDO;
RL_SHADER_LOC_MAP_METALNESS :: MAP_METALNESS;
RL_SHADER_LOC_MAP_NORMAL :: MAP_NORMAL;
RL_SHADER_LOC_MAP_ROUGHNESS :: MAP_ROUGHNESS;
RL_SHADER_LOC_MAP_OCCLUSION :: MAP_OCCLUSION;
RL_SHADER_LOC_MAP_EMISSION :: MAP_EMISSION;
RL_SHADER_LOC_MAP_HEIGHT :: MAP_HEIGHT;
RL_SHADER_LOC_MAP_CUBEMAP :: MAP_CUBEMAP;
RL_SHADER_LOC_MAP_IRRADIANCE :: MAP_IRRADIANCE;
RL_SHADER_LOC_MAP_PREFILTER :: MAP_PREFILTER;
RL_SHADER_LOC_MAP_BRDF :: MAP_BRDF;
}
// Shader uniform data type
ShaderUniformDataType :: enum u32 {
FLOAT :: 0;
VEC2 :: 1;
VEC3 :: 2;
VEC4 :: 3;
INT :: 4;
IVEC2 :: 5;
IVEC3 :: 6;
IVEC4 :: 7;
UINT :: 8;
UIVEC2 :: 9;
UIVEC3 :: 10;
UIVEC4 :: 11;
SAMPLER2D :: 12;
RL_SHADER_UNIFORM_FLOAT :: FLOAT;
RL_SHADER_UNIFORM_VEC2 :: VEC2;
RL_SHADER_UNIFORM_VEC3 :: VEC3;
RL_SHADER_UNIFORM_VEC4 :: VEC4;
RL_SHADER_UNIFORM_INT :: INT;
RL_SHADER_UNIFORM_IVEC2 :: IVEC2;
RL_SHADER_UNIFORM_IVEC3 :: IVEC3;
RL_SHADER_UNIFORM_IVEC4 :: IVEC4;
RL_SHADER_UNIFORM_UINT :: UINT;
RL_SHADER_UNIFORM_UIVEC2 :: UIVEC2;
RL_SHADER_UNIFORM_UIVEC3 :: UIVEC3;
RL_SHADER_UNIFORM_UIVEC4 :: UIVEC4;
RL_SHADER_UNIFORM_SAMPLER2D :: SAMPLER2D;
}
// Shader attribute data types
ShaderAttributeDataType :: enum u32 {
FLOAT :: 0;
VEC2 :: 1;
VEC3 :: 2;
VEC4 :: 3;
RL_SHADER_ATTRIB_FLOAT :: FLOAT;
RL_SHADER_ATTRIB_VEC2 :: VEC2;
RL_SHADER_ATTRIB_VEC3 :: VEC3;
RL_SHADER_ATTRIB_VEC4 :: VEC4;
}
// Framebuffer attachment type
// NOTE: By default up to 8 color channels defined, but it can be more
FramebufferAttachType :: enum u32 {
COLOR_CHANNEL0 :: 0;
COLOR_CHANNEL1 :: 1;
COLOR_CHANNEL2 :: 2;
COLOR_CHANNEL3 :: 3;
COLOR_CHANNEL4 :: 4;
COLOR_CHANNEL5 :: 5;
COLOR_CHANNEL6 :: 6;
COLOR_CHANNEL7 :: 7;
DEPTH :: 100;
STENCIL :: 200;
RL_ATTACHMENT_COLOR_CHANNEL0 :: COLOR_CHANNEL0;
RL_ATTACHMENT_COLOR_CHANNEL1 :: COLOR_CHANNEL1;
RL_ATTACHMENT_COLOR_CHANNEL2 :: COLOR_CHANNEL2;
RL_ATTACHMENT_COLOR_CHANNEL3 :: COLOR_CHANNEL3;
RL_ATTACHMENT_COLOR_CHANNEL4 :: COLOR_CHANNEL4;
RL_ATTACHMENT_COLOR_CHANNEL5 :: COLOR_CHANNEL5;
RL_ATTACHMENT_COLOR_CHANNEL6 :: COLOR_CHANNEL6;
RL_ATTACHMENT_COLOR_CHANNEL7 :: COLOR_CHANNEL7;
RL_ATTACHMENT_DEPTH :: DEPTH;
RL_ATTACHMENT_STENCIL :: STENCIL;
}
// Framebuffer texture attachment type
FramebufferAttachTextureType :: enum u32 {
CUBEMAP_POSITIVE_X :: 0;
CUBEMAP_NEGATIVE_X :: 1;
CUBEMAP_POSITIVE_Y :: 2;
CUBEMAP_NEGATIVE_Y :: 3;
CUBEMAP_POSITIVE_Z :: 4;
CUBEMAP_NEGATIVE_Z :: 5;
TEXTURE2D :: 100;
RENDERBUFFER :: 200;
RL_ATTACHMENT_CUBEMAP_POSITIVE_X :: CUBEMAP_POSITIVE_X;
RL_ATTACHMENT_CUBEMAP_NEGATIVE_X :: CUBEMAP_NEGATIVE_X;
RL_ATTACHMENT_CUBEMAP_POSITIVE_Y :: CUBEMAP_POSITIVE_Y;
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y :: CUBEMAP_NEGATIVE_Y;
RL_ATTACHMENT_CUBEMAP_POSITIVE_Z :: CUBEMAP_POSITIVE_Z;
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z :: CUBEMAP_NEGATIVE_Z;
RL_ATTACHMENT_TEXTURE2D :: TEXTURE2D;
RL_ATTACHMENT_RENDERBUFFER :: RENDERBUFFER;
}
// Face culling mode
CullMode :: enum u32 {
FRONT :: 0;
BACK :: 1;
RL_CULL_FACE_FRONT :: FRONT;
RL_CULL_FACE_BACK :: BACK;
}
MatrixMode :: (mode: s32) -> void #foreign raylib "rlMatrixMode";
PushMatrix :: () -> void #foreign raylib "rlPushMatrix";
PopMatrix :: () -> void #foreign raylib "rlPopMatrix";
LoadIdentity :: () -> void #foreign raylib "rlLoadIdentity";
Translatef :: (x: float, y: float, z: float) -> void #foreign raylib "rlTranslatef";
Rotatef :: (angle: float, x: float, y: float, z: float) -> void #foreign raylib "rlRotatef";
Scalef :: (x: float, y: float, z: float) -> void #foreign raylib "rlScalef";
MultMatrixf :: (matf: *float) -> void #foreign raylib "rlMultMatrixf";
Frustum :: (left: float64, right: float64, bottom: float64, top: float64, znear: float64, zfar: float64) -> void #foreign raylib "rlFrustum";
Ortho :: (left: float64, right: float64, bottom: float64, top: float64, znear: float64, zfar: float64) -> void #foreign raylib "rlOrtho";
Viewport :: (x: s32, y: s32, width: s32, height: s32) -> void #foreign raylib "rlViewport";
SetClipPlanes :: (nearPlane: float64, farPlane: float64) -> void #foreign raylib "rlSetClipPlanes";
GetCullDistanceNear :: () -> float64 #foreign raylib "rlGetCullDistanceNear";
GetCullDistanceFar :: () -> float64 #foreign raylib "rlGetCullDistanceFar";
//------------------------------------------------------------------------------------
// Functions Declaration - Vertex level operations
//------------------------------------------------------------------------------------
Begin :: (mode: s32) -> void #foreign raylib "rlBegin";
End :: () -> void #foreign raylib "rlEnd";
Vertex2i :: (x: s32, y: s32) -> void #foreign raylib "rlVertex2i";
Vertex2f :: (x: float, y: float) -> void #foreign raylib "rlVertex2f";
Vertex3f :: (x: float, y: float, z: float) -> void #foreign raylib "rlVertex3f";
TexCoord2f :: (x: float, y: float) -> void #foreign raylib "rlTexCoord2f";
Normal3f :: (x: float, y: float, z: float) -> void #foreign raylib "rlNormal3f";
Color4ub :: (r: u8, g: u8, b: u8, a: u8) -> void #foreign raylib "rlColor4ub";
Color3f :: (x: float, y: float, z: float) -> void #foreign raylib "rlColor3f";
Color4f :: (x: float, y: float, z: float, w: float) -> void #foreign raylib "rlColor4f";
// Vertex buffers state
EnableVertexArray :: (vaoId: u32) -> bool #foreign raylib "rlEnableVertexArray";
DisableVertexArray :: () -> void #foreign raylib "rlDisableVertexArray";
EnableVertexBuffer :: (id: u32) -> void #foreign raylib "rlEnableVertexBuffer";
DisableVertexBuffer :: () -> void #foreign raylib "rlDisableVertexBuffer";
EnableVertexBufferElement :: (id: u32) -> void #foreign raylib "rlEnableVertexBufferElement";
DisableVertexBufferElement :: () -> void #foreign raylib "rlDisableVertexBufferElement";
EnableVertexAttribute :: (index: u32) -> void #foreign raylib "rlEnableVertexAttribute";
DisableVertexAttribute :: (index: u32) -> void #foreign raylib "rlDisableVertexAttribute";
// Textures state
ActiveTextureSlot :: (slot: s32) -> void #foreign raylib "rlActiveTextureSlot";
EnableTexture :: (id: u32) -> void #foreign raylib "rlEnableTexture";
DisableTexture :: () -> void #foreign raylib "rlDisableTexture";
EnableTextureCubemap :: (id: u32) -> void #foreign raylib "rlEnableTextureCubemap";
DisableTextureCubemap :: () -> void #foreign raylib "rlDisableTextureCubemap";
TextureParameters :: (id: u32, param: s32, value: s32) -> void #foreign raylib "rlTextureParameters";
CubemapParameters :: (id: u32, param: s32, value: s32) -> void #foreign raylib "rlCubemapParameters";
// Shader state
EnableShader :: (id: u32) -> void #foreign raylib "rlEnableShader";
DisableShader :: () -> void #foreign raylib "rlDisableShader";
// Framebuffer state
EnableFramebuffer :: (id: u32) -> void #foreign raylib "rlEnableFramebuffer";
DisableFramebuffer :: () -> void #foreign raylib "rlDisableFramebuffer";
GetActiveFramebuffer :: () -> u32 #foreign raylib "rlGetActiveFramebuffer";
ActiveDrawBuffers :: (count: s32) -> void #foreign raylib "rlActiveDrawBuffers";
BlitFramebuffer :: (srcX: s32, srcY: s32, srcWidth: s32, srcHeight: s32, dstX: s32, dstY: s32, dstWidth: s32, dstHeight: s32, bufferMask: s32) -> void #foreign raylib "rlBlitFramebuffer";
BindFramebuffer :: (target: u32, framebuffer: u32) -> void #foreign raylib "rlBindFramebuffer";
// General render state
EnableColorBlend :: () -> void #foreign raylib "rlEnableColorBlend";
DisableColorBlend :: () -> void #foreign raylib "rlDisableColorBlend";
EnableDepthTest :: () -> void #foreign raylib "rlEnableDepthTest";
DisableDepthTest :: () -> void #foreign raylib "rlDisableDepthTest";
EnableDepthMask :: () -> void #foreign raylib "rlEnableDepthMask";
DisableDepthMask :: () -> void #foreign raylib "rlDisableDepthMask";
EnableBackfaceCulling :: () -> void #foreign raylib "rlEnableBackfaceCulling";
DisableBackfaceCulling :: () -> void #foreign raylib "rlDisableBackfaceCulling";
ColorMask :: (r: bool, g: bool, b: bool, a: bool) -> void #foreign raylib "rlColorMask";
SetCullFace :: (mode: s32) -> void #foreign raylib "rlSetCullFace";
EnableScissorTest :: () -> void #foreign raylib "rlEnableScissorTest";
DisableScissorTest :: () -> void #foreign raylib "rlDisableScissorTest";
Scissor :: (x: s32, y: s32, width: s32, height: s32) -> void #foreign raylib "rlScissor";
EnableWireMode :: () -> void #foreign raylib "rlEnableWireMode";
EnablePointMode :: () -> void #foreign raylib "rlEnablePointMode";
DisableWireMode :: () -> void #foreign raylib "rlDisableWireMode";
SetLineWidth :: (width: float) -> void #foreign raylib "rlSetLineWidth";
GetLineWidth :: () -> float #foreign raylib "rlGetLineWidth";
EnableSmoothLines :: () -> void #foreign raylib "rlEnableSmoothLines";
DisableSmoothLines :: () -> void #foreign raylib "rlDisableSmoothLines";
EnableStereoRender :: () -> void #foreign raylib "rlEnableStereoRender";
DisableStereoRender :: () -> void #foreign raylib "rlDisableStereoRender";
IsStereoRenderEnabled :: () -> bool #foreign raylib "rlIsStereoRenderEnabled";
ClearColor :: (r: u8, g: u8, b: u8, a: u8) -> void #foreign raylib "rlClearColor";
ClearScreenBuffers :: () -> void #foreign raylib "rlClearScreenBuffers";
CheckErrors :: () -> void #foreign raylib "rlCheckErrors";
SetBlendMode :: (mode: s32) -> void #foreign raylib "rlSetBlendMode";
SetBlendFactors :: (glSrcFactor: s32, glDstFactor: s32, glEquation: s32) -> void #foreign raylib "rlSetBlendFactors";
SetBlendFactorsSeparate :: (glSrcRGB: s32, glDstRGB: s32, glSrcAlpha: s32, glDstAlpha: s32, glEqRGB: s32, glEqAlpha: s32) -> void #foreign raylib "rlSetBlendFactorsSeparate";
//------------------------------------------------------------------------------------
// Functions Declaration - rlgl functionality
//------------------------------------------------------------------------------------
// rlgl initialization functions
glInit :: (width: s32, height: s32) -> void #foreign raylib "rlglInit";
glClose :: () -> void #foreign raylib "rlglClose";
LoadExtensions :: (loader: *void) -> void #foreign raylib "rlLoadExtensions";
GetVersion :: () -> s32 #foreign raylib "rlGetVersion";
SetFramebufferWidth :: (width: s32) -> void #foreign raylib "rlSetFramebufferWidth";
GetFramebufferWidth :: () -> s32 #foreign raylib "rlGetFramebufferWidth";
SetFramebufferHeight :: (height: s32) -> void #foreign raylib "rlSetFramebufferHeight";
GetFramebufferHeight :: () -> s32 #foreign raylib "rlGetFramebufferHeight";
GetTextureIdDefault :: () -> u32 #foreign raylib "rlGetTextureIdDefault";
GetShaderIdDefault :: () -> u32 #foreign raylib "rlGetShaderIdDefault";
GetShaderLocsDefault :: () -> *s32 #foreign raylib "rlGetShaderLocsDefault";
// Render batch management
// 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
LoadRenderBatch :: (numBuffers: s32, bufferElements: s32) -> RenderBatch #foreign raylib "rlLoadRenderBatch";
UnloadRenderBatch :: (batch: RenderBatch) -> void #foreign raylib "rlUnloadRenderBatch";
DrawRenderBatch :: (batch: *RenderBatch) -> void #foreign raylib "rlDrawRenderBatch";
SetRenderBatchActive :: (batch: *RenderBatch) -> void #foreign raylib "rlSetRenderBatchActive";
DrawRenderBatchActive :: () -> void #foreign raylib "rlDrawRenderBatchActive";
CheckRenderBatchLimit :: (vCount: s32) -> bool #foreign raylib "rlCheckRenderBatchLimit";
SetTexture :: (id: u32) -> void #foreign raylib "rlSetTexture";
// Vertex buffers management
LoadVertexArray :: () -> u32 #foreign raylib "rlLoadVertexArray";
LoadVertexBuffer :: (buffer: *void, size: s32, dynamic: bool) -> u32 #foreign raylib "rlLoadVertexBuffer";
LoadVertexBufferElement :: (buffer: *void, size: s32, dynamic: bool) -> u32 #foreign raylib "rlLoadVertexBufferElement";
UpdateVertexBuffer :: (bufferId: u32, data: *void, dataSize: s32, offset: s32) -> void #foreign raylib "rlUpdateVertexBuffer";
UpdateVertexBufferElements :: (id: u32, data: *void, dataSize: s32, offset: s32) -> void #foreign raylib "rlUpdateVertexBufferElements";
UnloadVertexArray :: (vaoId: u32) -> void #foreign raylib "rlUnloadVertexArray";
UnloadVertexBuffer :: (vboId: u32) -> void #foreign raylib "rlUnloadVertexBuffer";
SetVertexAttribute :: (index: u32, compSize: s32, type: s32, normalized: bool, stride: s32, offset: s32) -> void #foreign raylib "rlSetVertexAttribute";
SetVertexAttributeDivisor :: (index: u32, divisor: s32) -> void #foreign raylib "rlSetVertexAttributeDivisor";
SetVertexAttributeDefault :: (locIndex: s32, value: *void, attribType: s32, count: s32) -> void #foreign raylib "rlSetVertexAttributeDefault";
DrawVertexArray :: (offset: s32, count: s32) -> void #foreign raylib "rlDrawVertexArray";
DrawVertexArrayElements :: (offset: s32, count: s32, buffer: *void) -> void #foreign raylib "rlDrawVertexArrayElements";
DrawVertexArrayInstanced :: (offset: s32, count: s32, instances: s32) -> void #foreign raylib "rlDrawVertexArrayInstanced";
DrawVertexArrayElementsInstanced :: (offset: s32, count: s32, buffer: *void, instances: s32) -> void #foreign raylib "rlDrawVertexArrayElementsInstanced";
// Textures management
LoadTexture :: (data: *void, width: s32, height: s32, format: s32, mipmapCount: s32) -> u32 #foreign raylib "rlLoadTexture";
LoadTextureDepth :: (width: s32, height: s32, useRenderBuffer: bool) -> u32 #foreign raylib "rlLoadTextureDepth";
LoadTextureCubemap :: (data: *void, size: s32, format: s32, mipmapCount: s32) -> u32 #foreign raylib "rlLoadTextureCubemap";
UpdateTexture :: (id: u32, offsetX: s32, offsetY: s32, width: s32, height: s32, format: s32, data: *void) -> void #foreign raylib "rlUpdateTexture";
GetGlTextureFormats :: (format: s32, glInternalFormat: *u32, glFormat: *u32, glType: *u32) -> void #foreign raylib "rlGetGlTextureFormats";
GetPixelFormatName :: (format: u32) -> *u8 #foreign raylib "rlGetPixelFormatName";
UnloadTexture :: (id: u32) -> void #foreign raylib "rlUnloadTexture";
GenTextureMipmaps :: (id: u32, width: s32, height: s32, format: s32, mipmaps: *s32) -> void #foreign raylib "rlGenTextureMipmaps";
ReadTexturePixels :: (id: u32, width: s32, height: s32, format: s32) -> *void #foreign raylib "rlReadTexturePixels";
ReadScreenPixels :: (width: s32, height: s32) -> *u8 #foreign raylib "rlReadScreenPixels";
// Framebuffer management (fbo)
LoadFramebuffer :: () -> u32 #foreign raylib "rlLoadFramebuffer";
FramebufferAttach :: (fboId: u32, texId: u32, attachType: s32, texType: s32, mipLevel: s32) -> void #foreign raylib "rlFramebufferAttach";
FramebufferComplete :: (id: u32) -> bool #foreign raylib "rlFramebufferComplete";
UnloadFramebuffer :: (id: u32) -> void #foreign raylib "rlUnloadFramebuffer";
// Shaders management
LoadShaderCode :: (vsCode: *u8, fsCode: *u8) -> u32 #foreign raylib "rlLoadShaderCode";
CompileShader :: (shaderCode: *u8, type: s32) -> u32 #foreign raylib "rlCompileShader";
LoadShaderProgram :: (vShaderId: u32, fShaderId: u32) -> u32 #foreign raylib "rlLoadShaderProgram";
UnloadShaderProgram :: (id: u32) -> void #foreign raylib "rlUnloadShaderProgram";
GetLocationUniform :: (shaderId: u32, uniformName: *u8) -> s32 #foreign raylib "rlGetLocationUniform";
GetLocationAttrib :: (shaderId: u32, attribName: *u8) -> s32 #foreign raylib "rlGetLocationAttrib";
SetUniform :: (locIndex: s32, value: *void, uniformType: s32, count: s32) -> void #foreign raylib "rlSetUniform";
SetUniformMatrix :: (locIndex: s32, mat: Matrix) -> void #foreign raylib "rlSetUniformMatrix";
SetUniformMatrices :: (locIndex: s32, mat: *Matrix, count: s32) -> void #foreign raylib "rlSetUniformMatrices";
SetUniformSampler :: (locIndex: s32, textureId: u32) -> void #foreign raylib "rlSetUniformSampler";
SetShader :: (id: u32, locs: *s32) -> void #foreign raylib "rlSetShader";
// Compute shader management
LoadComputeShaderProgram :: (shaderId: u32) -> u32 #foreign raylib "rlLoadComputeShaderProgram";
ComputeShaderDispatch :: (groupX: u32, groupY: u32, groupZ: u32) -> void #foreign raylib "rlComputeShaderDispatch";
// Shader buffer storage object management (ssbo)
LoadShaderBuffer :: (size: u32, data: *void, usageHint: s32) -> u32 #foreign raylib "rlLoadShaderBuffer";
UnloadShaderBuffer :: (ssboId: u32) -> void #foreign raylib "rlUnloadShaderBuffer";
UpdateShaderBuffer :: (id: u32, data: *void, dataSize: u32, offset: u32) -> void #foreign raylib "rlUpdateShaderBuffer";
BindShaderBuffer :: (id: u32, index: u32) -> void #foreign raylib "rlBindShaderBuffer";
ReadShaderBuffer :: (id: u32, dest: *void, count: u32, offset: u32) -> void #foreign raylib "rlReadShaderBuffer";
CopyShaderBuffer :: (destId: u32, srcId: u32, destOffset: u32, srcOffset: u32, count: u32) -> void #foreign raylib "rlCopyShaderBuffer";
GetShaderBufferSize :: (id: u32) -> u32 #foreign raylib "rlGetShaderBufferSize";
// Buffer management
BindImageTexture :: (id: u32, index: u32, format: s32, readonly: bool) -> void #foreign raylib "rlBindImageTexture";
// Matrix state management
GetMatrixModelview :: () -> Matrix #foreign raylib "rlGetMatrixModelview";
GetMatrixProjection :: () -> Matrix #foreign raylib "rlGetMatrixProjection";
GetMatrixTransform :: () -> Matrix #foreign raylib "rlGetMatrixTransform";
GetMatrixProjectionStereo :: (eye: s32) -> Matrix #foreign raylib "rlGetMatrixProjectionStereo";
GetMatrixViewOffsetStereo :: (eye: s32) -> Matrix #foreign raylib "rlGetMatrixViewOffsetStereo";
SetMatrixProjection :: (proj: Matrix) -> void #foreign raylib "rlSetMatrixProjection";
SetMatrixModelview :: (view: Matrix) -> void #foreign raylib "rlSetMatrixModelview";
SetMatrixProjectionStereo :: (right: Matrix, left: Matrix) -> void #foreign raylib "rlSetMatrixProjectionStereo";
SetMatrixViewOffsetStereo :: (right: Matrix, left: Matrix) -> void #foreign raylib "rlSetMatrixViewOffsetStereo";
// Quick and dirty cube/quad buffers load->draw->unload
LoadDrawCube :: () -> void #foreign raylib "rlLoadDrawCube";
LoadDrawQuad :: () -> void #foreign raylib "rlLoadDrawQuad";
#scope_file
#import "Basic"; // For assert
#run {
{
instance: Matrix;
assert(((cast(*void)(*instance.m0)) - cast(*void)(*instance)) == 0, "Matrix.m0 has unexpected offset % instead of 0", ((cast(*void)(*instance.m0)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m0)) == 4, "Matrix.m0 has unexpected size % instead of 4", size_of(type_of(Matrix.m0)));
assert(((cast(*void)(*instance.m4)) - cast(*void)(*instance)) == 4, "Matrix.m4 has unexpected offset % instead of 4", ((cast(*void)(*instance.m4)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m4)) == 4, "Matrix.m4 has unexpected size % instead of 4", size_of(type_of(Matrix.m4)));
assert(((cast(*void)(*instance.m8)) - cast(*void)(*instance)) == 8, "Matrix.m8 has unexpected offset % instead of 8", ((cast(*void)(*instance.m8)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m8)) == 4, "Matrix.m8 has unexpected size % instead of 4", size_of(type_of(Matrix.m8)));
assert(((cast(*void)(*instance.m12)) - cast(*void)(*instance)) == 12, "Matrix.m12 has unexpected offset % instead of 12", ((cast(*void)(*instance.m12)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m12)) == 4, "Matrix.m12 has unexpected size % instead of 4", size_of(type_of(Matrix.m12)));
assert(((cast(*void)(*instance.m1)) - cast(*void)(*instance)) == 16, "Matrix.m1 has unexpected offset % instead of 16", ((cast(*void)(*instance.m1)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m1)) == 4, "Matrix.m1 has unexpected size % instead of 4", size_of(type_of(Matrix.m1)));
assert(((cast(*void)(*instance.m5)) - cast(*void)(*instance)) == 20, "Matrix.m5 has unexpected offset % instead of 20", ((cast(*void)(*instance.m5)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m5)) == 4, "Matrix.m5 has unexpected size % instead of 4", size_of(type_of(Matrix.m5)));
assert(((cast(*void)(*instance.m9)) - cast(*void)(*instance)) == 24, "Matrix.m9 has unexpected offset % instead of 24", ((cast(*void)(*instance.m9)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m9)) == 4, "Matrix.m9 has unexpected size % instead of 4", size_of(type_of(Matrix.m9)));
assert(((cast(*void)(*instance.m13)) - cast(*void)(*instance)) == 28, "Matrix.m13 has unexpected offset % instead of 28", ((cast(*void)(*instance.m13)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m13)) == 4, "Matrix.m13 has unexpected size % instead of 4", size_of(type_of(Matrix.m13)));
assert(((cast(*void)(*instance.m2)) - cast(*void)(*instance)) == 32, "Matrix.m2 has unexpected offset % instead of 32", ((cast(*void)(*instance.m2)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m2)) == 4, "Matrix.m2 has unexpected size % instead of 4", size_of(type_of(Matrix.m2)));
assert(((cast(*void)(*instance.m6)) - cast(*void)(*instance)) == 36, "Matrix.m6 has unexpected offset % instead of 36", ((cast(*void)(*instance.m6)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m6)) == 4, "Matrix.m6 has unexpected size % instead of 4", size_of(type_of(Matrix.m6)));
assert(((cast(*void)(*instance.m10)) - cast(*void)(*instance)) == 40, "Matrix.m10 has unexpected offset % instead of 40", ((cast(*void)(*instance.m10)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m10)) == 4, "Matrix.m10 has unexpected size % instead of 4", size_of(type_of(Matrix.m10)));
assert(((cast(*void)(*instance.m14)) - cast(*void)(*instance)) == 44, "Matrix.m14 has unexpected offset % instead of 44", ((cast(*void)(*instance.m14)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m14)) == 4, "Matrix.m14 has unexpected size % instead of 4", size_of(type_of(Matrix.m14)));
assert(((cast(*void)(*instance.m3)) - cast(*void)(*instance)) == 48, "Matrix.m3 has unexpected offset % instead of 48", ((cast(*void)(*instance.m3)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m3)) == 4, "Matrix.m3 has unexpected size % instead of 4", size_of(type_of(Matrix.m3)));
assert(((cast(*void)(*instance.m7)) - cast(*void)(*instance)) == 52, "Matrix.m7 has unexpected offset % instead of 52", ((cast(*void)(*instance.m7)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m7)) == 4, "Matrix.m7 has unexpected size % instead of 4", size_of(type_of(Matrix.m7)));
assert(((cast(*void)(*instance.m11)) - cast(*void)(*instance)) == 56, "Matrix.m11 has unexpected offset % instead of 56", ((cast(*void)(*instance.m11)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m11)) == 4, "Matrix.m11 has unexpected size % instead of 4", size_of(type_of(Matrix.m11)));
assert(((cast(*void)(*instance.m15)) - cast(*void)(*instance)) == 60, "Matrix.m15 has unexpected offset % instead of 60", ((cast(*void)(*instance.m15)) - cast(*void)(*instance)));
assert(size_of(type_of(Matrix.m15)) == 4, "Matrix.m15 has unexpected size % instead of 4", size_of(type_of(Matrix.m15)));
assert(size_of(Matrix) == 64, "Matrix has size % instead of 64", size_of(Matrix));
}
{
instance: VertexBuffer;
assert(((cast(*void)(*instance.elementCount)) - cast(*void)(*instance)) == 0, "VertexBuffer.elementCount has unexpected offset % instead of 0", ((cast(*void)(*instance.elementCount)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.elementCount)) == 4, "VertexBuffer.elementCount has unexpected size % instead of 4", size_of(type_of(VertexBuffer.elementCount)));
assert(((cast(*void)(*instance.vertices)) - cast(*void)(*instance)) == 8, "VertexBuffer.vertices has unexpected offset % instead of 8", ((cast(*void)(*instance.vertices)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.vertices)) == 8, "VertexBuffer.vertices has unexpected size % instead of 8", size_of(type_of(VertexBuffer.vertices)));
assert(((cast(*void)(*instance.texcoords)) - cast(*void)(*instance)) == 16, "VertexBuffer.texcoords has unexpected offset % instead of 16", ((cast(*void)(*instance.texcoords)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.texcoords)) == 8, "VertexBuffer.texcoords has unexpected size % instead of 8", size_of(type_of(VertexBuffer.texcoords)));
assert(((cast(*void)(*instance.normals)) - cast(*void)(*instance)) == 24, "VertexBuffer.normals has unexpected offset % instead of 24", ((cast(*void)(*instance.normals)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.normals)) == 8, "VertexBuffer.normals has unexpected size % instead of 8", size_of(type_of(VertexBuffer.normals)));
assert(((cast(*void)(*instance.colors)) - cast(*void)(*instance)) == 32, "VertexBuffer.colors has unexpected offset % instead of 32", ((cast(*void)(*instance.colors)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.colors)) == 8, "VertexBuffer.colors has unexpected size % instead of 8", size_of(type_of(VertexBuffer.colors)));
assert(((cast(*void)(*instance.indices)) - cast(*void)(*instance)) == 40, "VertexBuffer.indices has unexpected offset % instead of 40", ((cast(*void)(*instance.indices)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.indices)) == 8, "VertexBuffer.indices has unexpected size % instead of 8", size_of(type_of(VertexBuffer.indices)));
assert(((cast(*void)(*instance.vaoId)) - cast(*void)(*instance)) == 48, "VertexBuffer.vaoId has unexpected offset % instead of 48", ((cast(*void)(*instance.vaoId)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.vaoId)) == 4, "VertexBuffer.vaoId has unexpected size % instead of 4", size_of(type_of(VertexBuffer.vaoId)));
assert(((cast(*void)(*instance.vboId)) - cast(*void)(*instance)) == 52, "VertexBuffer.vboId has unexpected offset % instead of 52", ((cast(*void)(*instance.vboId)) - cast(*void)(*instance)));
assert(size_of(type_of(VertexBuffer.vboId)) == 20, "VertexBuffer.vboId has unexpected size % instead of 20", size_of(type_of(VertexBuffer.vboId)));
assert(size_of(VertexBuffer) == 72, "VertexBuffer has size % instead of 72", size_of(VertexBuffer));
}
{
instance: DrawCall;
assert(((cast(*void)(*instance.mode)) - cast(*void)(*instance)) == 0, "DrawCall.mode has unexpected offset % instead of 0", ((cast(*void)(*instance.mode)) - cast(*void)(*instance)));
assert(size_of(type_of(DrawCall.mode)) == 4, "DrawCall.mode has unexpected size % instead of 4", size_of(type_of(DrawCall.mode)));
assert(((cast(*void)(*instance.vertexCount)) - cast(*void)(*instance)) == 4, "DrawCall.vertexCount has unexpected offset % instead of 4", ((cast(*void)(*instance.vertexCount)) - cast(*void)(*instance)));
assert(size_of(type_of(DrawCall.vertexCount)) == 4, "DrawCall.vertexCount has unexpected size % instead of 4", size_of(type_of(DrawCall.vertexCount)));
assert(((cast(*void)(*instance.vertexAlignment)) - cast(*void)(*instance)) == 8, "DrawCall.vertexAlignment has unexpected offset % instead of 8", ((cast(*void)(*instance.vertexAlignment)) - cast(*void)(*instance)));
assert(size_of(type_of(DrawCall.vertexAlignment)) == 4, "DrawCall.vertexAlignment has unexpected size % instead of 4", size_of(type_of(DrawCall.vertexAlignment)));
assert(((cast(*void)(*instance.textureId)) - cast(*void)(*instance)) == 12, "DrawCall.textureId has unexpected offset % instead of 12", ((cast(*void)(*instance.textureId)) - cast(*void)(*instance)));
assert(size_of(type_of(DrawCall.textureId)) == 4, "DrawCall.textureId has unexpected size % instead of 4", size_of(type_of(DrawCall.textureId)));
assert(size_of(DrawCall) == 16, "DrawCall has size % instead of 16", size_of(DrawCall));
}
{
instance: RenderBatch;
assert(((cast(*void)(*instance.bufferCount)) - cast(*void)(*instance)) == 0, "RenderBatch.bufferCount has unexpected offset % instead of 0", ((cast(*void)(*instance.bufferCount)) - cast(*void)(*instance)));
assert(size_of(type_of(RenderBatch.bufferCount)) == 4, "RenderBatch.bufferCount has unexpected size % instead of 4", size_of(type_of(RenderBatch.bufferCount)));
assert(((cast(*void)(*instance.currentBuffer)) - cast(*void)(*instance)) == 4, "RenderBatch.currentBuffer has unexpected offset % instead of 4", ((cast(*void)(*instance.currentBuffer)) - cast(*void)(*instance)));
assert(size_of(type_of(RenderBatch.currentBuffer)) == 4, "RenderBatch.currentBuffer has unexpected size % instead of 4", size_of(type_of(RenderBatch.currentBuffer)));
assert(((cast(*void)(*instance.vertexBuffer)) - cast(*void)(*instance)) == 8, "RenderBatch.vertexBuffer has unexpected offset % instead of 8", ((cast(*void)(*instance.vertexBuffer)) - cast(*void)(*instance)));
assert(size_of(type_of(RenderBatch.vertexBuffer)) == 8, "RenderBatch.vertexBuffer has unexpected size % instead of 8", size_of(type_of(RenderBatch.vertexBuffer)));
assert(((cast(*void)(*instance.draws)) - cast(*void)(*instance)) == 16, "RenderBatch.draws has unexpected offset % instead of 16", ((cast(*void)(*instance.draws)) - cast(*void)(*instance)));
assert(size_of(type_of(RenderBatch.draws)) == 8, "RenderBatch.draws has unexpected size % instead of 8", size_of(type_of(RenderBatch.draws)));
assert(((cast(*void)(*instance.drawCounter)) - cast(*void)(*instance)) == 24, "RenderBatch.drawCounter has unexpected offset % instead of 24", ((cast(*void)(*instance.drawCounter)) - cast(*void)(*instance)));
assert(size_of(type_of(RenderBatch.drawCounter)) == 4, "RenderBatch.drawCounter has unexpected size % instead of 4", size_of(type_of(RenderBatch.drawCounter)));
assert(((cast(*void)(*instance.currentDepth)) - cast(*void)(*instance)) == 28, "RenderBatch.currentDepth has unexpected offset % instead of 28", ((cast(*void)(*instance.currentDepth)) - cast(*void)(*instance)));
assert(size_of(type_of(RenderBatch.currentDepth)) == 4, "RenderBatch.currentDepth has unexpected size % instead of 4", size_of(type_of(RenderBatch.currentDepth)));
assert(size_of(RenderBatch) == 32, "RenderBatch has size % instead of 32", size_of(RenderBatch));
}
}

BIN
raylib/win/raylib.dll Normal file

Binary file not shown.

BIN
raylib/win/raylib.lib Normal file

Binary file not shown.