mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-08 19:47:28 +00:00
Bump to raylib 5.5-dev
This commit is contained in:
parent
2176d37bcc
commit
e3e3a7518a
@ -1,9 +1,9 @@
|
||||
.{
|
||||
.name = "raylib-zig",
|
||||
.version = "5.1.0",
|
||||
.version = "5.5.0",
|
||||
.dependencies = .{
|
||||
.raylib = .{
|
||||
.url = "https://github.com/raysan5/raylib/archive/5767c4cd059e07355ae5588966d0aee97038a86b.tar.gz",
|
||||
.url = "https://github.com/raysan5/raylib/archive/5f49ec3d6448502d798d4d404e08e354ec48012a.tar.gz",
|
||||
.hash = "1220aa75240ee6459499456ef520ab7e8bddffaed8a5055441da457b198fc4e92b26",
|
||||
},
|
||||
.raygui = .{
|
||||
|
@ -34,9 +34,6 @@ IGNORE_TYPES = [
|
||||
"[*c]ModelAnimation",
|
||||
"[*c]f32",
|
||||
]
|
||||
MAKE_CONST = [
|
||||
"points"
|
||||
]
|
||||
# Some C types have a different sizes on different systems and Zig
|
||||
# knows that so we tell it to get the system specific size for us.
|
||||
def c_to_zig_type(c: str) -> str:
|
||||
@ -61,7 +58,8 @@ def ziggify_type(name: str, t: str, func_name) -> str:
|
||||
"wave", "v1", "v2", "outAxis", "outAngle", "fileSize",
|
||||
"AutomationEventList", "list", "batch", "glInternalFormat", "glFormat",
|
||||
"glType", "mipmaps", "active", "scroll", "view", "checked", "mouseCell",
|
||||
"scrollIndex", "focus", "secretViewActive", "color", "alpha", "colorHsv"
|
||||
"scrollIndex", "focus", "secretViewActive", "color", "alpha", "colorHsv",
|
||||
"translation", "rotation", "scale"
|
||||
]
|
||||
multi = [
|
||||
"data", "compData", "points", "fileData", "colors", "pixels",
|
||||
@ -144,8 +142,6 @@ def fix_pointer(name: str, t: str):
|
||||
name = name[1:]
|
||||
pre += "[*c]"
|
||||
|
||||
if name in MAKE_CONST:
|
||||
pre += "const "
|
||||
t = pre + t
|
||||
|
||||
if t == "[*c]const void":
|
||||
|
@ -1956,9 +1956,9 @@ pub const SaveFileTextCallback = *const fn ([*c]const u8, [*c]u8) callconv(.C) b
|
||||
pub const AudioCallback = ?*const fn (?*anyopaque, c_uint) callconv(.C) void;
|
||||
|
||||
pub const RAYLIB_VERSION_MAJOR = @as(i32, 5);
|
||||
pub const RAYLIB_VERSION_MINOR = @as(i32, 1);
|
||||
pub const RAYLIB_VERSION_MINOR = @as(i32, 5);
|
||||
pub const RAYLIB_VERSION_PATCH = @as(i32, 0);
|
||||
pub const RAYLIB_VERSION = "5.1-dev";
|
||||
pub const RAYLIB_VERSION = "5.5-dev";
|
||||
|
||||
pub const MAX_TOUCH_POINTS = 10;
|
||||
pub const MAX_MATERIAL_MAPS = 12;
|
||||
@ -2271,8 +2271,8 @@ pub fn checkCollisionPointPoly(point: Vector2, points: []const Vector2) bool {
|
||||
return cdef.CheckCollisionPointPoly(point, @as([*c]const Vector2, @ptrCast(points)), @as(c_int, @intCast(points.len)));
|
||||
}
|
||||
|
||||
pub fn imageKernelConvolution(image: *Image, kernel: []f32) void {
|
||||
cdef.ImageKernelConvolution(@as([*c]Image, @ptrCast(image)), @as([*c]f32, @ptrCast(kernel)), @as(c_int, @intCast(kernel.len)));
|
||||
pub fn imageKernelConvolution(image: *Image, kernel: []const f32) void {
|
||||
cdef.ImageKernelConvolution(@as([*c]Image, @ptrCast(image)), @as([*c]const f32, @ptrCast(kernel)), @as(c_int, @intCast(kernel.len)));
|
||||
}
|
||||
|
||||
/// Generate image font atlas using chars info
|
||||
|
@ -142,7 +142,11 @@ pub const rlShaderUniformDataType = enum(c_uint) {
|
||||
rl_shader_uniform_ivec2 = 5,
|
||||
rl_shader_uniform_ivec3 = 6,
|
||||
rl_shader_uniform_ivec4 = 7,
|
||||
rl_shader_uniform_sampler2d = 8,
|
||||
rl_shader_uniform_uint = 8,
|
||||
rl_shader_uniform_uivec2 = 9,
|
||||
rl_shader_uniform_uivec3 = 10,
|
||||
rl_shader_uniform_uivec4 = 11,
|
||||
rl_shader_uniform_sampler2d = 12,
|
||||
};
|
||||
|
||||
pub const rlShaderAttributeDataType = enum(c_uint) {
|
||||
|
@ -217,7 +217,7 @@ pub extern "c" fn DrawLineBezier(startPos: rl.Vector2, endPos: rl.Vector2, thick
|
||||
pub extern "c" fn DrawCircle(centerX: c_int, centerY: c_int, radius: f32, color: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleSector(center: rl.Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleSectorLines(center: rl.Vector2, radius: f32, startAngle: f32, endAngle: f32, segments: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleGradient(centerX: c_int, centerY: c_int, radius: f32, color1: rl.Color, color2: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleGradient(centerX: c_int, centerY: c_int, radius: f32, inner: rl.Color, outer: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleV(center: rl.Vector2, radius: f32, color: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleLines(centerX: c_int, centerY: c_int, radius: f32, color: rl.Color) void;
|
||||
pub extern "c" fn DrawCircleLinesV(center: rl.Vector2, radius: f32, color: rl.Color) void;
|
||||
@ -229,9 +229,9 @@ pub extern "c" fn DrawRectangle(posX: c_int, posY: c_int, width: c_int, height:
|
||||
pub extern "c" fn DrawRectangleV(position: rl.Vector2, size: rl.Vector2, color: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleRec(rec: rl.Rectangle, color: rl.Color) void;
|
||||
pub extern "c" fn DrawRectanglePro(rec: rl.Rectangle, origin: rl.Vector2, rotation: f32, color: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleGradientV(posX: c_int, posY: c_int, width: c_int, height: c_int, color1: rl.Color, color2: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleGradientH(posX: c_int, posY: c_int, width: c_int, height: c_int, color1: rl.Color, color2: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleGradientEx(rec: rl.Rectangle, col1: rl.Color, col2: rl.Color, col3: rl.Color, col4: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleGradientV(posX: c_int, posY: c_int, width: c_int, height: c_int, top: rl.Color, bottom: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleGradientH(posX: c_int, posY: c_int, width: c_int, height: c_int, left: rl.Color, right: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleGradientEx(rec: rl.Rectangle, topLeft: rl.Color, bottomLeft: rl.Color, topRight: rl.Color, bottomRight: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleLines(posX: c_int, posY: c_int, width: c_int, height: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleLinesEx(rec: rl.Rectangle, lineThick: f32, color: rl.Color) void;
|
||||
pub extern "c" fn DrawRectangleRounded(rec: rl.Rectangle, roundness: f32, segments: c_int, color: rl.Color) void;
|
||||
@ -294,6 +294,7 @@ pub extern "c" fn GenImageCellular(width: c_int, height: c_int, tileSize: c_int)
|
||||
pub extern "c" fn GenImageText(width: c_int, height: c_int, text: [*c]const u8) rl.Image;
|
||||
pub extern "c" fn ImageCopy(image: rl.Image) rl.Image;
|
||||
pub extern "c" fn ImageFromImage(image: rl.Image, rec: rl.Rectangle) rl.Image;
|
||||
pub extern "c" fn ImageFromChannel(image: rl.Image, selectedChannel: c_int) rl.Image;
|
||||
pub extern "c" fn ImageText(text: [*c]const u8, fontSize: c_int, color: rl.Color) rl.Image;
|
||||
pub extern "c" fn ImageTextEx(font: rl.Font, text: [*c]const u8, fontSize: f32, spacing: f32, tint: rl.Color) rl.Image;
|
||||
pub extern "c" fn ImageFormat(image: [*c]rl.Image, newFormat: rl.PixelFormat) void;
|
||||
@ -304,7 +305,7 @@ pub extern "c" fn ImageAlphaClear(image: [*c]rl.Image, color: rl.Color, threshol
|
||||
pub extern "c" fn ImageAlphaMask(image: [*c]rl.Image, alphaMask: rl.Image) void;
|
||||
pub extern "c" fn ImageAlphaPremultiply(image: [*c]rl.Image) void;
|
||||
pub extern "c" fn ImageBlurGaussian(image: [*c]rl.Image, blurSize: c_int) void;
|
||||
pub extern "c" fn ImageKernelConvolution(image: [*c]rl.Image, kernel: [*c]f32, kernelSize: c_int) void;
|
||||
pub extern "c" fn ImageKernelConvolution(image: [*c]rl.Image, kernel: [*c]const f32, kernelSize: c_int) void;
|
||||
pub extern "c" fn ImageResize(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int) void;
|
||||
pub extern "c" fn ImageResizeNN(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int) void;
|
||||
pub extern "c" fn ImageResizeCanvas(image: [*c]rl.Image, newWidth: c_int, newHeight: c_int, offsetX: c_int, offsetY: c_int, fill: rl.Color) void;
|
||||
@ -332,6 +333,7 @@ pub extern "c" fn ImageDrawPixel(dst: [*c]rl.Image, posX: c_int, posY: c_int, co
|
||||
pub extern "c" fn ImageDrawPixelV(dst: [*c]rl.Image, position: rl.Vector2, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawLine(dst: [*c]rl.Image, startPosX: c_int, startPosY: c_int, endPosX: c_int, endPosY: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawLineV(dst: [*c]rl.Image, start: rl.Vector2, end: rl.Vector2, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawLineEx(dst: [*c]rl.Image, start: rl.Vector2, end: rl.Vector2, thick: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawCircle(dst: [*c]rl.Image, centerX: c_int, centerY: c_int, radius: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawCircleV(dst: [*c]rl.Image, center: rl.Vector2, radius: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawCircleLines(dst: [*c]rl.Image, centerX: c_int, centerY: c_int, radius: c_int, color: rl.Color) void;
|
||||
@ -340,6 +342,11 @@ pub extern "c" fn ImageDrawRectangle(dst: [*c]rl.Image, posX: c_int, posY: c_int
|
||||
pub extern "c" fn ImageDrawRectangleV(dst: [*c]rl.Image, position: rl.Vector2, size: rl.Vector2, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawRectangleRec(dst: [*c]rl.Image, rec: rl.Rectangle, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawRectangleLines(dst: [*c]rl.Image, rec: rl.Rectangle, thick: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawTriangle(dst: [*c]rl.Image, v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawTriangleEx(dst: [*c]rl.Image, v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, c1: rl.Color, c2: rl.Color, c3: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawTriangleLines(dst: [*c]rl.Image, v1: rl.Vector2, v2: rl.Vector2, v3: rl.Vector2, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawTriangleFan(dst: [*c]rl.Image, points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawTriangleStrip(dst: [*c]rl.Image, points: [*c]rl.Vector2, pointCount: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDraw(dst: [*c]rl.Image, src: rl.Image, srcRec: rl.Rectangle, dstRec: rl.Rectangle, tint: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawText(dst: [*c]rl.Image, text: [*c]const u8, posX: c_int, posY: c_int, fontSize: c_int, color: rl.Color) void;
|
||||
pub extern "c" fn ImageDrawTextEx(dst: [*c]rl.Image, font: rl.Font, text: [*c]const u8, position: rl.Vector2, fontSize: f32, spacing: f32, tint: rl.Color) void;
|
||||
@ -458,8 +465,10 @@ pub extern "c" fn DrawModel(model: rl.Model, position: rl.Vector3, scale: f32, t
|
||||
pub extern "c" fn DrawModelEx(model: rl.Model, position: rl.Vector3, rotationAxis: rl.Vector3, rotationAngle: f32, scale: rl.Vector3, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawModelWires(model: rl.Model, position: rl.Vector3, scale: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawModelWiresEx(model: rl.Model, position: rl.Vector3, rotationAxis: rl.Vector3, rotationAngle: f32, scale: rl.Vector3, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawModelPoints(model: rl.Model, position: rl.Vector3, scale: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawModelPointsEx(model: rl.Model, position: rl.Vector3, rotationAxis: rl.Vector3, rotationAngle: f32, scale: rl.Vector3, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawBoundingBox(box: rl.BoundingBox, color: rl.Color) void;
|
||||
pub extern "c" fn DrawBillboard(camera: rl.Camera, texture: rl.Texture2D, position: rl.Vector3, size: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawBillboard(camera: rl.Camera, texture: rl.Texture2D, position: rl.Vector3, scale: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawBillboardRec(camera: rl.Camera, texture: rl.Texture2D, source: rl.Rectangle, position: rl.Vector3, size: rl.Vector2, tint: rl.Color) void;
|
||||
pub extern "c" fn DrawBillboardPro(camera: rl.Camera, texture: rl.Texture2D, source: rl.Rectangle, position: rl.Vector3, up: rl.Vector3, size: rl.Vector2, origin: rl.Vector2, rotation: f32, tint: rl.Color) void;
|
||||
pub extern "c" fn UploadMesh(mesh: [*c]rl.Mesh, dynamic: bool) void;
|
||||
|
59
lib/raylib.h
vendored
59
lib/raylib.h
vendored
@ -1,6 +1,6 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raylib v5.1-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
* raylib v5.5-dev - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)
|
||||
*
|
||||
* FEATURES:
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
@ -82,9 +82,9 @@
|
||||
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
|
||||
|
||||
#define RAYLIB_VERSION_MAJOR 5
|
||||
#define RAYLIB_VERSION_MINOR 1
|
||||
#define RAYLIB_VERSION_MINOR 5
|
||||
#define RAYLIB_VERSION_PATCH 0
|
||||
#define RAYLIB_VERSION "5.1-dev"
|
||||
#define RAYLIB_VERSION "5.5-dev"
|
||||
|
||||
// Function specifiers in case library is build/used as a shared library
|
||||
// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
|
||||
@ -421,7 +421,7 @@ typedef struct ModelAnimation {
|
||||
// Ray, ray for raycasting
|
||||
typedef struct Ray {
|
||||
Vector3 position; // Ray position (origin)
|
||||
Vector3 direction; // Ray direction
|
||||
Vector3 direction; // Ray direction (normalized)
|
||||
} Ray;
|
||||
|
||||
// RayCollision, ray hit information
|
||||
@ -968,8 +968,8 @@ RLAPI bool IsWindowResized(void); // Check if wi
|
||||
RLAPI bool IsWindowState(unsigned int flag); // Check if one specific window flag is enabled
|
||||
RLAPI void SetWindowState(unsigned int flags); // Set window configuration state using flags (only PLATFORM_DESKTOP)
|
||||
RLAPI void ClearWindowState(unsigned int flags); // Clear window configuration state flags
|
||||
RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
|
||||
RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
|
||||
RLAPI void ToggleFullscreen(void); // Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP)
|
||||
RLAPI void ToggleBorderlessWindowed(void); // Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP)
|
||||
RLAPI void MaximizeWindow(void); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
|
||||
RLAPI void MinimizeWindow(void); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
|
||||
RLAPI void RestoreWindow(void); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
|
||||
@ -1141,7 +1141,7 @@ RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize
|
||||
|
||||
// Automation events functionality
|
||||
RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
|
||||
RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
|
||||
RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
|
||||
RLAPI bool ExportAutomationEventList(AutomationEventList list, const char *fileName); // Export automation events list as text file
|
||||
RLAPI void SetAutomationEventList(AutomationEventList *list); // Set automation event list to record to
|
||||
RLAPI void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
|
||||
@ -1233,12 +1233,12 @@ RLAPI void DrawPixelV(Vector2 position, Color color);
|
||||
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
|
||||
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (using gl lines)
|
||||
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line (using triangles/quads)
|
||||
RLAPI void DrawLineStrip(Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
||||
RLAPI void DrawLineStrip(const Vector2 *points, int pointCount, Color color); // Draw lines sequence (using gl lines)
|
||||
RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw line segment cubic-bezier in-out interpolation
|
||||
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
|
||||
RLAPI void DrawCircleSector(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw a piece of a circle
|
||||
RLAPI void DrawCircleSectorLines(Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color); // Draw circle sector outline
|
||||
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
|
||||
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color inner, Color outer); // Draw a gradient-filled circle
|
||||
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
|
||||
RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color); // Draw circle outline
|
||||
RLAPI void DrawCircleLinesV(Vector2 center, float radius, Color color); // Draw circle outline (Vector version)
|
||||
@ -1250,9 +1250,9 @@ RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color)
|
||||
RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color); // Draw a color-filled rectangle (Vector version)
|
||||
RLAPI void DrawRectangleRec(Rectangle rec, Color color); // Draw a color-filled rectangle
|
||||
RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters
|
||||
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a vertical-gradient-filled rectangle
|
||||
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2);// Draw a horizontal-gradient-filled rectangle
|
||||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors
|
||||
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle
|
||||
RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle
|
||||
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color topRight, Color bottomRight); // Draw a gradient-filled rectangle with custom vertex colors
|
||||
RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline
|
||||
RLAPI void DrawRectangleLinesEx(Rectangle rec, float lineThick, Color color); // Draw rectangle outline with extended parameters
|
||||
RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges
|
||||
@ -1260,18 +1260,18 @@ RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segment
|
||||
RLAPI void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float lineThick, Color color); // Draw rectangle with rounded edges outline
|
||||
RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
||||
RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!)
|
||||
RLAPI void DrawTriangleFan(Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
||||
RLAPI void DrawTriangleStrip(Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||
RLAPI void DrawTriangleFan(const Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points (first vertex is the center)
|
||||
RLAPI void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||
RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version)
|
||||
RLAPI void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides
|
||||
RLAPI void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, float lineThick, Color color); // Draw a polygon outline of n sides with extended parameters
|
||||
|
||||
// Splines drawing functions
|
||||
RLAPI void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||
RLAPI void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
|
||||
RLAPI void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
|
||||
RLAPI void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
RLAPI void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
RLAPI void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Linear, minimum 2 points
|
||||
RLAPI void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: B-Spline, minimum 4 points
|
||||
RLAPI void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Catmull-Rom, minimum 4 points
|
||||
RLAPI void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]
|
||||
RLAPI void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color); // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]
|
||||
RLAPI void DrawSplineSegmentLinear(Vector2 p1, Vector2 p2, float thick, Color color); // Draw spline segment: Linear, 2 points
|
||||
RLAPI void DrawSplineSegmentBasis(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: B-Spline, 4 points
|
||||
RLAPI void DrawSplineSegmentCatmullRom(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, float thick, Color color); // Draw spline segment: Catmull-Rom, 4 points
|
||||
@ -1292,7 +1292,7 @@ RLAPI bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
|
||||
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
|
||||
RLAPI bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius); // Check if point is inside circle
|
||||
RLAPI bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3); // Check if point is inside a triangle
|
||||
RLAPI bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
|
||||
RLAPI bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount); // Check if point is within a polygon described by array of vertices
|
||||
RLAPI bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, Vector2 *collisionPoint); // Check the collision between two lines defined by two points each, returns collision point by reference
|
||||
RLAPI bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold); // Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
|
||||
RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2); // Check if circle collides with a line created betweeen two points [p1] and [p2]
|
||||
@ -1332,6 +1332,7 @@ RLAPI Image GenImageText(int width, int height, const char *text);
|
||||
// Image manipulation functions
|
||||
RLAPI Image ImageCopy(Image image); // Create an image duplicate (useful for transformations)
|
||||
RLAPI Image ImageFromImage(Image image, Rectangle rec); // Create an image from another image piece
|
||||
RLAPI Image ImageFromChannel(Image image, int selectedChannel); // Create an image from a selected channel of another image (GRAYSCALE)
|
||||
RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
|
||||
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
|
||||
RLAPI void ImageFormat(Image *image, int newFormat); // Convert image data to desired format
|
||||
@ -1342,10 +1343,10 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold);
|
||||
RLAPI void ImageAlphaMask(Image *image, Image alphaMask); // Apply alpha mask to image
|
||||
RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
|
||||
RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation
|
||||
RLAPI void ImageKernelConvolution(Image *image, float* kernel, int kernelSize); // Apply Custom Square image convolution kernel
|
||||
RLAPI void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize); // Apply custom square convolution kernel to image
|
||||
RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
|
||||
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
|
||||
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
|
||||
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color
|
||||
RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image
|
||||
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
RLAPI void ImageFlipVertical(Image *image); // Flip image vertically
|
||||
@ -1373,6 +1374,7 @@ RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color);
|
||||
RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version)
|
||||
RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image
|
||||
RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version)
|
||||
RLAPI void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color color); // Draw a line defining thickness within an image
|
||||
RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image
|
||||
RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version)
|
||||
RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image
|
||||
@ -1381,6 +1383,11 @@ RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int hei
|
||||
RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color); // Draw rectangle within an image (Vector version)
|
||||
RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image
|
||||
RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image
|
||||
RLAPI void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle within an image
|
||||
RLAPI void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c1, Color c2, Color c3); // Draw triangle with interpolated colors within an image
|
||||
RLAPI void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline within an image
|
||||
RLAPI void ImageDrawTriangleFan(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||
RLAPI void ImageDrawTriangleStrip(Image *dst, Vector2 *points, int pointCount, Color color); // Draw a triangle strip defined by points within an image
|
||||
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source)
|
||||
RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination)
|
||||
RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination)
|
||||
@ -1436,7 +1443,7 @@ RLAPI int GetPixelDataSize(int width, int height, int format); // G
|
||||
// Font loading/unloading functions
|
||||
RLAPI Font GetFontDefault(void); // Get the default Font
|
||||
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set
|
||||
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // Load font from file with extended parameters, use NULL for codepoints and 0 for codepointCount to load the default character set, font size is provided in pixels height
|
||||
RLAPI Font LoadFontFromImage(Image image, Color key, int firstChar); // Load font from Image (XNA style)
|
||||
RLAPI Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *codepoints, int codepointCount); // Load font from memory buffer, fileType refers to extension: i.e. '.ttf'
|
||||
RLAPI bool IsFontReady(Font font); // Check if a font is ready
|
||||
@ -1504,7 +1511,7 @@ RLAPI void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color);
|
||||
RLAPI void DrawPoint3D(Vector3 position, Color color); // Draw a point in 3D space, actually a small line
|
||||
RLAPI void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color); // Draw a circle in 3D world space
|
||||
RLAPI void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!)
|
||||
RLAPI void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||
RLAPI void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color); // Draw a triangle strip defined by points
|
||||
RLAPI void DrawCube(Vector3 position, float width, float height, float length, Color color); // Draw cube
|
||||
RLAPI void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
|
||||
RLAPI void DrawCubeWires(Vector3 position, float width, float height, float length, Color color); // Draw cube wires
|
||||
@ -1538,8 +1545,10 @@ RLAPI void DrawModel(Model model, Vector3 position, float scale, Color tint);
|
||||
RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters
|
||||
RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set)
|
||||
RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
|
||||
RLAPI void DrawModelPoints(Model model, Vector3 position, float scale, Color tint); // Draw a model as points
|
||||
RLAPI void DrawModelPointsEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model as points with extended parameters
|
||||
RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires)
|
||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture
|
||||
RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint); // Draw a billboard texture
|
||||
RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source
|
||||
RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation
|
||||
|
||||
|
@ -1956,9 +1956,9 @@ pub const SaveFileTextCallback = *const fn ([*c]const u8, [*c]u8) callconv(.C) b
|
||||
pub const AudioCallback = ?*const fn (?*anyopaque, c_uint) callconv(.C) void;
|
||||
|
||||
pub const RAYLIB_VERSION_MAJOR = @as(i32, 5);
|
||||
pub const RAYLIB_VERSION_MINOR = @as(i32, 1);
|
||||
pub const RAYLIB_VERSION_MINOR = @as(i32, 5);
|
||||
pub const RAYLIB_VERSION_PATCH = @as(i32, 0);
|
||||
pub const RAYLIB_VERSION = "5.1-dev";
|
||||
pub const RAYLIB_VERSION = "5.5-dev";
|
||||
|
||||
pub const MAX_TOUCH_POINTS = 10;
|
||||
pub const MAX_MATERIAL_MAPS = 12;
|
||||
@ -2271,8 +2271,8 @@ pub fn checkCollisionPointPoly(point: Vector2, points: []const Vector2) bool {
|
||||
return cdef.CheckCollisionPointPoly(point, @as([*c]const Vector2, @ptrCast(points)), @as(c_int, @intCast(points.len)));
|
||||
}
|
||||
|
||||
pub fn imageKernelConvolution(image: *Image, kernel: []f32) void {
|
||||
cdef.ImageKernelConvolution(@as([*c]Image, @ptrCast(image)), @as([*c]f32, @ptrCast(kernel)), @as(c_int, @intCast(kernel.len)));
|
||||
pub fn imageKernelConvolution(image: *Image, kernel: []const f32) void {
|
||||
cdef.ImageKernelConvolution(@as([*c]Image, @ptrCast(image)), @as([*c]const f32, @ptrCast(kernel)), @as(c_int, @intCast(kernel.len)));
|
||||
}
|
||||
|
||||
/// Generate image font atlas using chars info
|
||||
@ -2396,12 +2396,12 @@ pub fn clearWindowState(flags: ConfigFlags) void {
|
||||
cdef.ClearWindowState(flags);
|
||||
}
|
||||
|
||||
/// Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
|
||||
/// Toggle window state: fullscreen/windowed [resizes monitor to match window resolution] (only PLATFORM_DESKTOP)
|
||||
pub fn toggleFullscreen() void {
|
||||
cdef.ToggleFullscreen();
|
||||
}
|
||||
|
||||
/// Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
|
||||
/// Toggle window state: borderless windowed [resizes window to match monitor resolution] (only PLATFORM_DESKTOP)
|
||||
pub fn toggleBorderlessWindowed() void {
|
||||
cdef.ToggleBorderlessWindowed();
|
||||
}
|
||||
@ -3347,8 +3347,8 @@ pub fn drawCircleSectorLines(center: Vector2, radius: f32, startAngle: f32, endA
|
||||
}
|
||||
|
||||
/// Draw a gradient-filled circle
|
||||
pub fn drawCircleGradient(centerX: i32, centerY: i32, radius: f32, color1: Color, color2: Color) void {
|
||||
cdef.DrawCircleGradient(@as(c_int, centerX), @as(c_int, centerY), radius, color1, color2);
|
||||
pub fn drawCircleGradient(centerX: i32, centerY: i32, radius: f32, inner: Color, outer: Color) void {
|
||||
cdef.DrawCircleGradient(@as(c_int, centerX), @as(c_int, centerY), radius, inner, outer);
|
||||
}
|
||||
|
||||
/// Draw a color-filled circle (Vector version)
|
||||
@ -3407,18 +3407,18 @@ pub fn drawRectanglePro(rec: Rectangle, origin: Vector2, rotation: f32, color: C
|
||||
}
|
||||
|
||||
/// Draw a vertical-gradient-filled rectangle
|
||||
pub fn drawRectangleGradientV(posX: i32, posY: i32, width: i32, height: i32, color1: Color, color2: Color) void {
|
||||
cdef.DrawRectangleGradientV(@as(c_int, posX), @as(c_int, posY), @as(c_int, width), @as(c_int, height), color1, color2);
|
||||
pub fn drawRectangleGradientV(posX: i32, posY: i32, width: i32, height: i32, top: Color, bottom: Color) void {
|
||||
cdef.DrawRectangleGradientV(@as(c_int, posX), @as(c_int, posY), @as(c_int, width), @as(c_int, height), top, bottom);
|
||||
}
|
||||
|
||||
/// Draw a horizontal-gradient-filled rectangle
|
||||
pub fn drawRectangleGradientH(posX: i32, posY: i32, width: i32, height: i32, color1: Color, color2: Color) void {
|
||||
cdef.DrawRectangleGradientH(@as(c_int, posX), @as(c_int, posY), @as(c_int, width), @as(c_int, height), color1, color2);
|
||||
pub fn drawRectangleGradientH(posX: i32, posY: i32, width: i32, height: i32, left: Color, right: Color) void {
|
||||
cdef.DrawRectangleGradientH(@as(c_int, posX), @as(c_int, posY), @as(c_int, width), @as(c_int, height), left, right);
|
||||
}
|
||||
|
||||
/// Draw a gradient-filled rectangle with custom vertex colors
|
||||
pub fn drawRectangleGradientEx(rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color) void {
|
||||
cdef.DrawRectangleGradientEx(rec, col1, col2, col3, col4);
|
||||
pub fn drawRectangleGradientEx(rec: Rectangle, topLeft: Color, bottomLeft: Color, topRight: Color, bottomRight: Color) void {
|
||||
cdef.DrawRectangleGradientEx(rec, topLeft, bottomLeft, topRight, bottomRight);
|
||||
}
|
||||
|
||||
/// Draw rectangle outline
|
||||
@ -3681,6 +3681,11 @@ pub fn imageFromImage(image: Image, rec: Rectangle) Image {
|
||||
return cdef.ImageFromImage(image, rec);
|
||||
}
|
||||
|
||||
/// Create an image from a selected channel of another image (GRAYSCALE)
|
||||
pub fn imageFromChannel(image: Image, selectedChannel: i32) Image {
|
||||
return cdef.ImageFromChannel(image, @as(c_int, selectedChannel));
|
||||
}
|
||||
|
||||
/// Create an image from text (default font)
|
||||
pub fn imageText(text: [*:0]const u8, fontSize: i32, color: Color) Image {
|
||||
return cdef.ImageText(@as([*c]const u8, @ptrCast(text)), @as(c_int, fontSize), color);
|
||||
@ -3856,6 +3861,11 @@ pub fn imageDrawLineV(dst: *Image, start: Vector2, end: Vector2, color: Color) v
|
||||
cdef.ImageDrawLineV(@as([*c]Image, @ptrCast(dst)), start, end, color);
|
||||
}
|
||||
|
||||
/// Draw a line defining thickness within an image
|
||||
pub fn imageDrawLineEx(dst: *Image, start: Vector2, end: Vector2, thick: i32, color: Color) void {
|
||||
cdef.ImageDrawLineEx(@as([*c]Image, @ptrCast(dst)), start, end, @as(c_int, thick), color);
|
||||
}
|
||||
|
||||
/// Draw a filled circle within an image
|
||||
pub fn imageDrawCircle(dst: *Image, centerX: i32, centerY: i32, radius: i32, color: Color) void {
|
||||
cdef.ImageDrawCircle(@as([*c]Image, @ptrCast(dst)), @as(c_int, centerX), @as(c_int, centerY), @as(c_int, radius), color);
|
||||
@ -3896,6 +3906,31 @@ pub fn imageDrawRectangleLines(dst: *Image, rec: Rectangle, thick: i32, color: C
|
||||
cdef.ImageDrawRectangleLines(@as([*c]Image, @ptrCast(dst)), rec, @as(c_int, thick), color);
|
||||
}
|
||||
|
||||
/// Draw triangle within an image
|
||||
pub fn imageDrawTriangle(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2, color: Color) void {
|
||||
cdef.ImageDrawTriangle(@as([*c]Image, @ptrCast(dst)), v1, v2, v3, color);
|
||||
}
|
||||
|
||||
/// Draw triangle with interpolated colors within an image
|
||||
pub fn imageDrawTriangleEx(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2, c1: Color, c2: Color, c3: Color) void {
|
||||
cdef.ImageDrawTriangleEx(@as([*c]Image, @ptrCast(dst)), v1, v2, v3, c1, c2, c3);
|
||||
}
|
||||
|
||||
/// Draw triangle outline within an image
|
||||
pub fn imageDrawTriangleLines(dst: *Image, v1: Vector2, v2: Vector2, v3: Vector2, color: Color) void {
|
||||
cdef.ImageDrawTriangleLines(@as([*c]Image, @ptrCast(dst)), v1, v2, v3, color);
|
||||
}
|
||||
|
||||
/// Draw a triangle fan defined by points within an image (first vertex is the center)
|
||||
pub fn imageDrawTriangleFan(dst: *Image, points: []Vector2, pointCount: i32, color: Color) void {
|
||||
cdef.ImageDrawTriangleFan(@as([*c]Image, @ptrCast(dst)), @as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), color);
|
||||
}
|
||||
|
||||
/// Draw a triangle strip defined by points within an image
|
||||
pub fn imageDrawTriangleStrip(dst: *Image, points: []Vector2, pointCount: i32, color: Color) void {
|
||||
cdef.ImageDrawTriangleStrip(@as([*c]Image, @ptrCast(dst)), @as([*c]Vector2, @ptrCast(points)), @as(c_int, pointCount), color);
|
||||
}
|
||||
|
||||
/// Draw a source image within a destination image (tint applied to source)
|
||||
pub fn imageDraw(dst: *Image, src: Image, srcRec: Rectangle, dstRec: Rectangle, tint: Color) void {
|
||||
cdef.ImageDraw(@as([*c]Image, @ptrCast(dst)), src, srcRec, dstRec, tint);
|
||||
@ -4426,14 +4461,24 @@ pub fn drawModelWiresEx(model: Model, position: Vector3, rotationAxis: Vector3,
|
||||
cdef.DrawModelWiresEx(model, position, rotationAxis, rotationAngle, scale, tint);
|
||||
}
|
||||
|
||||
/// Draw a model as points
|
||||
pub fn drawModelPoints(model: Model, position: Vector3, scale: f32, tint: Color) void {
|
||||
cdef.DrawModelPoints(model, position, scale, tint);
|
||||
}
|
||||
|
||||
/// Draw a model as points with extended parameters
|
||||
pub fn drawModelPointsEx(model: Model, position: Vector3, rotationAxis: Vector3, rotationAngle: f32, scale: Vector3, tint: Color) void {
|
||||
cdef.DrawModelPointsEx(model, position, rotationAxis, rotationAngle, scale, tint);
|
||||
}
|
||||
|
||||
/// Draw bounding box (wires)
|
||||
pub fn drawBoundingBox(box: BoundingBox, color: Color) void {
|
||||
cdef.DrawBoundingBox(box, color);
|
||||
}
|
||||
|
||||
/// Draw a billboard texture
|
||||
pub fn drawBillboard(camera: Camera, texture: Texture2D, position: Vector3, size: f32, tint: Color) void {
|
||||
cdef.DrawBillboard(camera, texture, position, size, tint);
|
||||
pub fn drawBillboard(camera: Camera, texture: Texture2D, position: Vector3, scale: f32, tint: Color) void {
|
||||
cdef.DrawBillboard(camera, texture, position, scale, tint);
|
||||
}
|
||||
|
||||
/// Draw a billboard texture defined by source
|
||||
|
@ -116,7 +116,7 @@ pub extern "c" fn MatrixRotateZ(angle: f32) rl.Matrix;
|
||||
pub extern "c" fn MatrixRotateXYZ(angle: rl.Vector3) rl.Matrix;
|
||||
pub extern "c" fn MatrixRotateZYX(angle: rl.Vector3) rl.Matrix;
|
||||
pub extern "c" fn MatrixScale(x: f32, y: f32, z: f32) rl.Matrix;
|
||||
pub extern "c" fn MatrixFrustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixFrustum(left: f64, right: f64, bottom: f64, top: f64, nearPlane: f64, farPlane: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixPerspective(fovY: f64, aspect: f64, nearPlane: f64, farPlane: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixOrtho(left: f64, right: f64, bottom: f64, top: f64, nearPlane: f64, farPlane: f64) rl.Matrix;
|
||||
pub extern "c" fn MatrixLookAt(eye: rl.Vector3, target: rl.Vector3, up: rl.Vector3) rl.Matrix;
|
||||
@ -145,3 +145,4 @@ pub extern "c" fn QuaternionFromEuler(pitch: f32, yaw: f32, roll: f32) rl.Quater
|
||||
pub extern "c" fn QuaternionToEuler(q: rl.Quaternion) rl.Vector3;
|
||||
pub extern "c" fn QuaternionTransform(q: rl.Quaternion, mat: rl.Matrix) rl.Quaternion;
|
||||
pub extern "c" fn QuaternionEquals(p: rl.Quaternion, q: rl.Quaternion) c_int;
|
||||
pub extern "c" fn MatrixDecompose(mat: rl.Matrix, translation: [*c]rl.Vector3, rotation: [*c]rl.Quaternion, scale: [*c]rl.Vector3) void;
|
||||
|
91
lib/raymath.h
vendored
91
lib/raymath.h
vendored
@ -175,7 +175,7 @@ typedef struct float16 {
|
||||
// Clamp float value
|
||||
RMAPI float Clamp(float value, float min, float max)
|
||||
{
|
||||
float result = (value < min) ? min : value;
|
||||
float result = (value < min)? min : value;
|
||||
|
||||
if (result > max) result = max;
|
||||
|
||||
@ -962,12 +962,12 @@ RMAPI Vector3 Vector3CubicHermite(Vector3 v1, Vector3 tangent1, Vector3 v2, Vect
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
float amountPow2 = amount * amount;
|
||||
float amountPow3 = amount * amount * amount;
|
||||
float amountPow2 = amount*amount;
|
||||
float amountPow3 = amount*amount*amount;
|
||||
|
||||
result.x = (2 * amountPow3 - 3 * amountPow2 + 1) * v1.x + (amountPow3 - 2 * amountPow2 + amount) * tangent1.x + (-2 * amountPow3 + 3 * amountPow2) * v2.x + (amountPow3 - amountPow2) * tangent2.x;
|
||||
result.y = (2 * amountPow3 - 3 * amountPow2 + 1) * v1.y + (amountPow3 - 2 * amountPow2 + amount) * tangent1.y + (-2 * amountPow3 + 3 * amountPow2) * v2.y + (amountPow3 - amountPow2) * tangent2.y;
|
||||
result.z = (2 * amountPow3 - 3 * amountPow2 + 1) * v1.z + (amountPow3 - 2 * amountPow2 + amount) * tangent1.z + (-2 * amountPow3 + 3 * amountPow2) * v2.z + (amountPow3 - amountPow2) * tangent2.z;
|
||||
result.x = (2*amountPow3 - 3*amountPow2 + 1)*v1.x + (amountPow3 - 2*amountPow2 + amount)*tangent1.x + (-2*amountPow3 + 3*amountPow2)*v2.x + (amountPow3 - amountPow2)*tangent2.x;
|
||||
result.y = (2*amountPow3 - 3*amountPow2 + 1)*v1.y + (amountPow3 - 2*amountPow2 + amount)*tangent1.y + (-2*amountPow3 + 3*amountPow2)*v2.y + (amountPow3 - amountPow2)*tangent2.y;
|
||||
result.z = (2*amountPow3 - 3*amountPow2 + 1)*v1.z + (amountPow3 - 2*amountPow2 + amount)*tangent1.z + (-2*amountPow3 + 3*amountPow2)*v2.z + (amountPow3 - amountPow2)*tangent2.z;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1837,32 +1837,32 @@ RMAPI Matrix MatrixScale(float x, float y, float z)
|
||||
}
|
||||
|
||||
// Get perspective projection matrix
|
||||
RMAPI Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far)
|
||||
RMAPI Matrix MatrixFrustum(double left, double right, double bottom, double top, double nearPlane, double farPlane)
|
||||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(far - near);
|
||||
float fn = (float)(farPlane - nearPlane);
|
||||
|
||||
result.m0 = ((float)near*2.0f)/rl;
|
||||
result.m0 = ((float)nearPlane*2.0f)/rl;
|
||||
result.m1 = 0.0f;
|
||||
result.m2 = 0.0f;
|
||||
result.m3 = 0.0f;
|
||||
|
||||
result.m4 = 0.0f;
|
||||
result.m5 = ((float)near*2.0f)/tb;
|
||||
result.m5 = ((float)nearPlane*2.0f)/tb;
|
||||
result.m6 = 0.0f;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
result.m8 = ((float)right + (float)left)/rl;
|
||||
result.m9 = ((float)top + (float)bottom)/tb;
|
||||
result.m10 = -((float)far + (float)near)/fn;
|
||||
result.m10 = -((float)farPlane + (float)nearPlane)/fn;
|
||||
result.m11 = -1.0f;
|
||||
|
||||
result.m12 = 0.0f;
|
||||
result.m13 = 0.0f;
|
||||
result.m14 = -((float)far*(float)near*2.0f)/fn;
|
||||
result.m14 = -((float)farPlane*(float)nearPlane*2.0f)/fn;
|
||||
result.m15 = 0.0f;
|
||||
|
||||
return result;
|
||||
@ -2218,12 +2218,12 @@ RMAPI Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount)
|
||||
// as described in the GLTF 2.0 specification: https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#interpolation-cubic
|
||||
RMAPI Quaternion QuaternionCubicHermiteSpline(Quaternion q1, Quaternion outTangent1, Quaternion q2, Quaternion inTangent2, float t)
|
||||
{
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
float h00 = 2 * t3 - 3 * t2 + 1;
|
||||
float h10 = t3 - 2 * t2 + t;
|
||||
float h01 = -2 * t3 + 3 * t2;
|
||||
float h11 = t3 - t2;
|
||||
float t2 = t*t;
|
||||
float t3 = t2*t;
|
||||
float h00 = 2*t3 - 3*t2 + 1;
|
||||
float h10 = t3 - 2*t2 + t;
|
||||
float h01 = -2*t3 + 3*t2;
|
||||
float h11 = t3 - t2;
|
||||
|
||||
Quaternion p0 = QuaternionScale(q1, h00);
|
||||
Quaternion m0 = QuaternionScale(outTangent1, h10);
|
||||
@ -2525,4 +2525,59 @@ RMAPI int QuaternionEquals(Quaternion p, Quaternion q)
|
||||
return result;
|
||||
}
|
||||
|
||||
// Decompose a transformation matrix into its rotational, translational and scaling components
|
||||
RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale)
|
||||
{
|
||||
// Extract translation.
|
||||
translation->x = mat.m12;
|
||||
translation->y = mat.m13;
|
||||
translation->z = mat.m14;
|
||||
|
||||
// Extract upper-left for determinant computation
|
||||
const float a = mat.m0;
|
||||
const float b = mat.m4;
|
||||
const float c = mat.m8;
|
||||
const float d = mat.m1;
|
||||
const float e = mat.m5;
|
||||
const float f = mat.m9;
|
||||
const float g = mat.m2;
|
||||
const float h = mat.m6;
|
||||
const float i = mat.m10;
|
||||
const float A = e*i - f*h;
|
||||
const float B = f*g - d*i;
|
||||
const float C = d*h - e*g;
|
||||
|
||||
// Extract scale
|
||||
const float det = a*A + b*B + c*C;
|
||||
Vector3 abc = { a, b, c };
|
||||
Vector3 def = { d, e, f };
|
||||
Vector3 ghi = { g, h, i };
|
||||
|
||||
float scalex = Vector3Length(abc);
|
||||
float scaley = Vector3Length(def);
|
||||
float scalez = Vector3Length(ghi);
|
||||
Vector3 s = { scalex, scaley, scalez };
|
||||
|
||||
if (det < 0) s = Vector3Negate(s);
|
||||
|
||||
*scale = s;
|
||||
|
||||
// Remove scale from the matrix if it is not close to zero
|
||||
Matrix clone = mat;
|
||||
if (!FloatEquals(det, 0))
|
||||
{
|
||||
clone.m0 /= s.x;
|
||||
clone.m5 /= s.y;
|
||||
clone.m10 /= s.z;
|
||||
|
||||
// Extract rotation
|
||||
*rotation = QuaternionFromMatrix(clone);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set to identity if close to zero
|
||||
*rotation = QuaternionIdentity();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // RAYMATH_H
|
||||
|
@ -474,8 +474,8 @@ pub fn matrixScale(x: f32, y: f32, z: f32) Matrix {
|
||||
return cdef.MatrixScale(x, y, z);
|
||||
}
|
||||
|
||||
pub fn matrixFrustum(left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64) Matrix {
|
||||
return cdef.MatrixFrustum(left, right, bottom, top, near, far);
|
||||
pub fn matrixFrustum(left: f64, right: f64, bottom: f64, top: f64, nearPlane: f64, farPlane: f64) Matrix {
|
||||
return cdef.MatrixFrustum(left, right, bottom, top, nearPlane, farPlane);
|
||||
}
|
||||
|
||||
pub fn matrixPerspective(fovY: f64, aspect: f64, nearPlane: f64, farPlane: f64) Matrix {
|
||||
@ -589,3 +589,7 @@ pub fn quaternionTransform(q: Quaternion, mat: Matrix) Quaternion {
|
||||
pub fn quaternionEquals(p: Quaternion, q: Quaternion) i32 {
|
||||
return @as(i32, cdef.QuaternionEquals(p, q));
|
||||
}
|
||||
|
||||
pub fn matrixDecompose(mat: Matrix, translation: *Vector3, rotation: *Quaternion, scale: *Vector3) void {
|
||||
cdef.MatrixDecompose(mat, @as([*c]Vector3, @ptrCast(translation)), @as([*c]Quaternion, @ptrCast(rotation)), @as([*c]Vector3, @ptrCast(scale)));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub extern "c" fn rlMultMatrixf(matf: [*c]const f32) void;
|
||||
pub extern "c" fn rlFrustum(left: f64, right: f64, bottom: f64, top: f64, znear: f64, zfar: f64) void;
|
||||
pub extern "c" fn rlOrtho(left: f64, right: f64, bottom: f64, top: f64, znear: f64, zfar: f64) void;
|
||||
pub extern "c" fn rlViewport(x: c_int, y: c_int, width: c_int, height: c_int) void;
|
||||
pub extern "c" fn rlSetClipPlanes(near: f64, far: f64) void;
|
||||
pub extern "c" fn rlSetClipPlanes(nearPlane: f64, farPlane: f64) void;
|
||||
pub extern "c" fn rlGetCullDistanceNear() f64;
|
||||
pub extern "c" fn rlGetCullDistanceFar() f64;
|
||||
pub extern "c" fn rlBegin(mode: c_int) void;
|
||||
|
108
lib/rlgl.h
vendored
108
lib/rlgl.h
vendored
@ -527,6 +527,10 @@ typedef enum {
|
||||
RL_SHADER_UNIFORM_IVEC2, // Shader uniform type: ivec2 (2 int)
|
||||
RL_SHADER_UNIFORM_IVEC3, // Shader uniform type: ivec3 (3 int)
|
||||
RL_SHADER_UNIFORM_IVEC4, // Shader uniform type: ivec4 (4 int)
|
||||
RL_SHADER_UNIFORM_UINT, // Shader uniform type: unsigned int
|
||||
RL_SHADER_UNIFORM_UIVEC2, // Shader uniform type: uivec2 (2 unsigned int)
|
||||
RL_SHADER_UNIFORM_UIVEC3, // Shader uniform type: uivec3 (3 unsigned int)
|
||||
RL_SHADER_UNIFORM_UIVEC4, // Shader uniform type: uivec4 (4 unsigned int)
|
||||
RL_SHADER_UNIFORM_SAMPLER2D // Shader uniform type: sampler2d
|
||||
} rlShaderUniformDataType;
|
||||
|
||||
@ -590,7 +594,7 @@ RLAPI void rlMultMatrixf(const float *matf); // Multiply the current
|
||||
RLAPI void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
|
||||
RLAPI void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar);
|
||||
RLAPI void rlViewport(int x, int y, int width, int height); // Set the viewport area
|
||||
RLAPI void rlSetClipPlanes(double near, double far); // Set clip planes distances
|
||||
RLAPI void rlSetClipPlanes(double nearPlane, double farPlane); // Set clip planes distances
|
||||
RLAPI double rlGetCullDistanceNear(void); // Get cull plane distance near
|
||||
RLAPI double rlGetCullDistanceFar(void); // Get cull plane distance far
|
||||
|
||||
@ -665,7 +669,7 @@ RLAPI void rlDisableScissorTest(void); // Disable scissor test
|
||||
RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test
|
||||
RLAPI void rlEnableWireMode(void); // Enable wire mode
|
||||
RLAPI void rlEnablePointMode(void); // Enable point mode
|
||||
RLAPI void rlDisableWireMode(void); // Disable wire mode ( and point ) maybe rename
|
||||
RLAPI void rlDisableWireMode(void); // Disable wire (and point) mode
|
||||
RLAPI void rlSetLineWidth(float width); // Set the line drawing width
|
||||
RLAPI float rlGetLineWidth(void); // Get the line drawing width
|
||||
RLAPI void rlEnableSmoothLines(void); // Enable line aliasing
|
||||
@ -844,9 +848,9 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES2/gl2ext.h> // OpenGL ES 2.0 extensions library
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// NOTE: OpenGL ES 2.0 can be enabled on PLATFORM_DESKTOP,
|
||||
// NOTE: OpenGL ES 2.0 can be enabled on Desktop platforms,
|
||||
// in that case, functions are loaded from a custom glad for OpenGL ES 2.0
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL)
|
||||
#if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL)
|
||||
#define GLAD_GLES2_IMPLEMENTATION
|
||||
#include "external/glad_gles2.h"
|
||||
#else
|
||||
@ -1371,10 +1375,10 @@ void rlViewport(int x, int y, int width, int height)
|
||||
}
|
||||
|
||||
// Set clip planes distances
|
||||
void rlSetClipPlanes(double near, double far)
|
||||
void rlSetClipPlanes(double nearPlane, double farPlane)
|
||||
{
|
||||
rlCullDistanceNear = near;
|
||||
rlCullDistanceFar = far;
|
||||
rlCullDistanceNear = nearPlane;
|
||||
rlCullDistanceFar = farPlane;
|
||||
}
|
||||
|
||||
// Get cull plane distance near
|
||||
@ -1406,7 +1410,7 @@ void rlBegin(int mode)
|
||||
}
|
||||
}
|
||||
|
||||
void rlEnd() { glEnd(); }
|
||||
void rlEnd(void) { glEnd(); }
|
||||
void rlVertex2i(int x, int y) { glVertex2i(x, y); }
|
||||
void rlVertex2f(float x, float y) { glVertex2f(x, y); }
|
||||
void rlVertex3f(float x, float y, float z) { glVertex3f(x, y, z); }
|
||||
@ -1560,7 +1564,7 @@ void rlNormal3f(float x, float y, float z)
|
||||
float length = sqrtf(normalx*normalx + normaly*normaly + normalz*normalz);
|
||||
if (length != 0.0f)
|
||||
{
|
||||
float ilength = 1.0f / length;
|
||||
float ilength = 1.0f/length;
|
||||
normalx *= ilength;
|
||||
normaly *= ilength;
|
||||
normalz *= ilength;
|
||||
@ -1948,6 +1952,7 @@ void rlEnableWireMode(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Enable point mode
|
||||
void rlEnablePointMode(void)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
|
||||
@ -1956,6 +1961,7 @@ void rlEnablePointMode(void)
|
||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Disable wire mode
|
||||
void rlDisableWireMode(void)
|
||||
{
|
||||
@ -2390,7 +2396,7 @@ void rlLoadExtensions(void *loader)
|
||||
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL)
|
||||
#if defined(PLATFORM_DESKTOP_GLFW) || defined(PLATFORM_DESKTOP_SDL)
|
||||
// TODO: Support GLAD loader for OpenGL ES 3.0
|
||||
if (gladLoadGLES2((GLADloadfunc)loader) == 0) TRACELOG(RL_LOG_WARNING, "GLAD: Cannot load OpenGL ES2.0 functions");
|
||||
else TRACELOG(RL_LOG_INFO, "GLAD: OpenGL ES 2.0 loaded successfully");
|
||||
@ -3945,7 +3951,9 @@ void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool norma
|
||||
// Additional types (depends on OpenGL version or extensions):
|
||||
// - GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE, GL_FIXED,
|
||||
// - GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_10F_11F_11F_REV
|
||||
glVertexAttribPointer(index, compSize, type, normalized, stride, (void *)offset);
|
||||
|
||||
size_t offsetNative = offset;
|
||||
glVertexAttribPointer(index, compSize, type, normalized, stride, (void *)offsetNative);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3992,18 +4000,18 @@ unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
|
||||
unsigned int fragmentShaderId = 0;
|
||||
|
||||
// Compile vertex shader (if provided)
|
||||
// NOTE: If not vertex shader is provided, use default one
|
||||
if (vsCode != NULL) vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
|
||||
// In case no vertex shader was provided or compilation failed, we use default vertex shader
|
||||
if (vertexShaderId == 0) vertexShaderId = RLGL.State.defaultVShaderId;
|
||||
else vertexShaderId = RLGL.State.defaultVShaderId;
|
||||
|
||||
// Compile fragment shader (if provided)
|
||||
// NOTE: If not vertex shader is provided, use default one
|
||||
if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
|
||||
// In case no fragment shader was provided or compilation failed, we use default fragment shader
|
||||
if (fragmentShaderId == 0) fragmentShaderId = RLGL.State.defaultFShaderId;
|
||||
else fragmentShaderId = RLGL.State.defaultFShaderId;
|
||||
|
||||
// In case vertex and fragment shader are the default ones, no need to recompile, we can just assign the default shader program id
|
||||
if ((vertexShaderId == RLGL.State.defaultVShaderId) && (fragmentShaderId == RLGL.State.defaultFShaderId)) id = RLGL.State.defaultShaderId;
|
||||
else
|
||||
else if ((vertexShaderId > 0) && (fragmentShaderId > 0))
|
||||
{
|
||||
// One of or both shader are new, we need to compile a new shader program
|
||||
id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId);
|
||||
@ -4081,6 +4089,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type)
|
||||
//case GL_GEOMETRY_SHADER:
|
||||
#if defined(GRAPHICS_API_OPENGL_43)
|
||||
case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Failed to compile compute shader code", shader); break;
|
||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
||||
case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43", shader); break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
@ -4096,6 +4106,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type)
|
||||
TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shader, log);
|
||||
RL_FREE(log);
|
||||
}
|
||||
|
||||
shader = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4106,6 +4118,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type)
|
||||
//case GL_GEOMETRY_SHADER:
|
||||
#if defined(GRAPHICS_API_OPENGL_43)
|
||||
case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader compiled successfully", shader); break;
|
||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
||||
case GL_COMPUTE_SHADER: TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43", shader); break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
@ -4226,8 +4240,16 @@ void rlSetUniform(int locIndex, const void *value, int uniformType, int count)
|
||||
case RL_SHADER_UNIFORM_IVEC2: glUniform2iv(locIndex, count, (int *)value); break;
|
||||
case RL_SHADER_UNIFORM_IVEC3: glUniform3iv(locIndex, count, (int *)value); break;
|
||||
case RL_SHADER_UNIFORM_IVEC4: glUniform4iv(locIndex, count, (int *)value); break;
|
||||
#if !defined(GRAPHICS_API_OPENGL_ES2)
|
||||
case RL_SHADER_UNIFORM_UINT: glUniform1uiv(locIndex, count, (unsigned int *)value); break;
|
||||
case RL_SHADER_UNIFORM_UIVEC2: glUniform2uiv(locIndex, count, (unsigned int *)value); break;
|
||||
case RL_SHADER_UNIFORM_UIVEC3: glUniform3uiv(locIndex, count, (unsigned int *)value); break;
|
||||
case RL_SHADER_UNIFORM_UIVEC4: glUniform4uiv(locIndex, count, (unsigned int *)value); break;
|
||||
#endif
|
||||
case RL_SHADER_UNIFORM_SAMPLER2D: glUniform1iv(locIndex, count, (int *)value); break;
|
||||
default: TRACELOG(RL_LOG_WARNING, "SHADER: Failed to set uniform value, data type not recognized");
|
||||
|
||||
// TODO: Support glUniform1uiv(), glUniform2uiv(), glUniform3uiv(), glUniform4uiv()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -4346,6 +4368,8 @@ unsigned int rlLoadComputeShaderProgram(unsigned int shaderId)
|
||||
|
||||
TRACELOG(RL_LOG_INFO, "SHADER: [ID %i] Compute shader program loaded successfully", program);
|
||||
}
|
||||
#else
|
||||
TRACELOG(RL_LOG_WARNING, "SHADER: Compute shaders not enabled. Define GRAPHICS_API_OPENGL_43");
|
||||
#endif
|
||||
|
||||
return program;
|
||||
@ -4370,6 +4394,8 @@ unsigned int rlLoadShaderBuffer(unsigned int size, const void *data, int usageHi
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, size, data, usageHint? usageHint : RL_STREAM_COPY);
|
||||
if (data == NULL) glClearBufferData(GL_SHADER_STORAGE_BUFFER, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL); // Clear buffer data to 0
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||
#else
|
||||
TRACELOG(RL_LOG_WARNING, "SSBO: SSBO not enabled. Define GRAPHICS_API_OPENGL_43");
|
||||
#endif
|
||||
|
||||
return ssbo;
|
||||
@ -4380,7 +4406,10 @@ void rlUnloadShaderBuffer(unsigned int ssboId)
|
||||
{
|
||||
#if defined(GRAPHICS_API_OPENGL_43)
|
||||
glDeleteBuffers(1, &ssboId);
|
||||
#else
|
||||
TRACELOG(RL_LOG_WARNING, "SSBO: SSBO not enabled. Define GRAPHICS_API_OPENGL_43");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// Update SSBO buffer data
|
||||
@ -4395,14 +4424,14 @@ void rlUpdateShaderBuffer(unsigned int id, const void *data, unsigned int dataSi
|
||||
// Get SSBO buffer size
|
||||
unsigned int rlGetShaderBufferSize(unsigned int id)
|
||||
{
|
||||
long long size = 0;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_43)
|
||||
GLint64 size = 0;
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, id);
|
||||
glGetInteger64v(GL_SHADER_STORAGE_BUFFER_SIZE, &size);
|
||||
#endif
|
||||
|
||||
glGetBufferParameteri64v(GL_SHADER_STORAGE_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
return (size > 0)? (unsigned int)size : 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Read SSBO buffer data (GPU->CPU)
|
||||
@ -4440,6 +4469,8 @@ void rlBindImageTexture(unsigned int id, unsigned int index, int format, bool re
|
||||
|
||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||
glBindImageTexture(index, id, 0, 0, 0, readonly? GL_READ_ONLY : GL_READ_WRITE, glInternalFormat);
|
||||
#else
|
||||
TRACELOG(RL_LOG_WARNING, "TEXTURE: Image texture binding not enabled. Define GRAPHICS_API_OPENGL_43");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -4518,7 +4549,7 @@ Matrix rlGetMatrixTransform(void)
|
||||
}
|
||||
|
||||
// Get internal projection matrix for stereo render (selected eye)
|
||||
RLAPI Matrix rlGetMatrixProjectionStereo(int eye)
|
||||
Matrix rlGetMatrixProjectionStereo(int eye)
|
||||
{
|
||||
Matrix mat = rlMatrixIdentity();
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
@ -4528,7 +4559,7 @@ RLAPI Matrix rlGetMatrixProjectionStereo(int eye)
|
||||
}
|
||||
|
||||
// Get internal view offset matrix for stereo render (selected eye)
|
||||
RLAPI Matrix rlGetMatrixViewOffsetStereo(int eye)
|
||||
Matrix rlGetMatrixViewOffsetStereo(int eye)
|
||||
{
|
||||
Matrix mat = rlMatrixIdentity();
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
@ -4754,7 +4785,16 @@ static void rlLoadShaderDefault(void)
|
||||
"out vec2 fragTexCoord; \n"
|
||||
"out vec4 fragColor; \n"
|
||||
#endif
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||
"#version 300 es \n"
|
||||
"precision mediump float; \n" // Precision required for OpenGL ES3 (WebGL 2) (on some browsers)
|
||||
"in vec3 vertexPosition; \n"
|
||||
"in vec2 vertexTexCoord; \n"
|
||||
"in vec4 vertexColor; \n"
|
||||
"out vec2 fragTexCoord; \n"
|
||||
"out vec4 fragColor; \n"
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||
"#version 100 \n"
|
||||
"precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL) (on some browsers)
|
||||
"attribute vec3 vertexPosition; \n"
|
||||
@ -4763,6 +4803,7 @@ static void rlLoadShaderDefault(void)
|
||||
"varying vec2 fragTexCoord; \n"
|
||||
"varying vec4 fragColor; \n"
|
||||
#endif
|
||||
|
||||
"uniform mat4 mvp; \n"
|
||||
"void main() \n"
|
||||
"{ \n"
|
||||
@ -4797,7 +4838,21 @@ static void rlLoadShaderDefault(void)
|
||||
" finalColor = texelColor*colDiffuse*fragColor; \n"
|
||||
"} \n";
|
||||
#endif
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||
"#version 300 es \n"
|
||||
"precision mediump float; \n" // Precision required for OpenGL ES3 (WebGL 2)
|
||||
"in vec2 fragTexCoord; \n"
|
||||
"in vec4 fragColor; \n"
|
||||
"out vec4 finalColor; \n"
|
||||
"uniform sampler2D texture0; \n"
|
||||
"uniform vec4 colDiffuse; \n"
|
||||
"void main() \n"
|
||||
"{ \n"
|
||||
" vec4 texelColor = texture(texture0, fragTexCoord); \n"
|
||||
" finalColor = texelColor*colDiffuse*fragColor; \n"
|
||||
"} \n";
|
||||
#elif defined(GRAPHICS_API_OPENGL_ES2)
|
||||
"#version 100 \n"
|
||||
"precision mediump float; \n" // Precision required for OpenGL ES2 (WebGL)
|
||||
"varying vec2 fragTexCoord; \n"
|
||||
@ -4967,7 +5022,8 @@ static int rlGetPixelDataSize(int width, int height, int format)
|
||||
default: break;
|
||||
}
|
||||
|
||||
dataSize = width*height*bpp/8; // Total data size in bytes
|
||||
double bytesPerPixel = (double)bpp/8.0;
|
||||
dataSize = (int)(bytesPerPixel*width*height); // Total data size in bytes
|
||||
|
||||
// Most compressed formats works on 4x4 blocks,
|
||||
// if texture is smaller, minimum dataSize is 8 or 16
|
||||
|
12
lib/rlgl.zig
12
lib/rlgl.zig
@ -142,7 +142,11 @@ pub const rlShaderUniformDataType = enum(c_uint) {
|
||||
rl_shader_uniform_ivec2 = 5,
|
||||
rl_shader_uniform_ivec3 = 6,
|
||||
rl_shader_uniform_ivec4 = 7,
|
||||
rl_shader_uniform_sampler2d = 8,
|
||||
rl_shader_uniform_uint = 8,
|
||||
rl_shader_uniform_uivec2 = 9,
|
||||
rl_shader_uniform_uivec3 = 10,
|
||||
rl_shader_uniform_uivec4 = 11,
|
||||
rl_shader_uniform_sampler2d = 12,
|
||||
};
|
||||
|
||||
pub const rlShaderAttributeDataType = enum(c_uint) {
|
||||
@ -242,8 +246,8 @@ pub fn rlViewport(x: i32, y: i32, width: i32, height: i32) void {
|
||||
}
|
||||
|
||||
/// Set clip planes distances
|
||||
pub fn rlSetClipPlanes(near: f64, far: f64) void {
|
||||
cdef.rlSetClipPlanes(near, far);
|
||||
pub fn rlSetClipPlanes(nearPlane: f64, farPlane: f64) void {
|
||||
cdef.rlSetClipPlanes(nearPlane, farPlane);
|
||||
}
|
||||
|
||||
/// Get cull plane distance near
|
||||
@ -506,7 +510,7 @@ pub fn rlEnablePointMode() void {
|
||||
cdef.rlEnablePointMode();
|
||||
}
|
||||
|
||||
/// Disable wire mode ( and point ) maybe rename
|
||||
/// Disable wire (and point) mode
|
||||
pub fn rlDisableWireMode() void {
|
||||
cdef.rlDisableWireMode();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user