Merge branch 'raysan5:master' into embedded-optimizations-pico
This commit is contained in:
commit
2e4436edda
18 changed files with 2897 additions and 2603 deletions
|
|
@ -103,7 +103,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | **5.5-dev** | [Lean4](https://lean-lang.org) | BSD-3-Clause |
|
||||
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
|
||||
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |
|
||||
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **5.5** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
|
||||
| [raylib-jai](https://github.com/ahmedqarmout2/raylib-jai) | **6.0** | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | MIT |
|
||||
| [fnl-raylib](https://github.com/0riginaln0/fnl-raylib) | **5.5** | [Fennel](https://fennel-lang.org/) | MIT |
|
||||
| [Rayua](https://github.com/uiua-lang/rayua) | **5.5** | [Uiua](https://www.uiua.org/) | **???** |
|
||||
| [Target](https://github.com/FinnDemonCat/Target/tree/main/libs/raylib) | **5.5** | [Dart](https://dart.dev/) | Apache-2.0 license |
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.22)
|
||||
#this change avoid the warning that appear when we include raylib using Cmake fatch content
|
||||
project(raylib)
|
||||
|
||||
# Avoid excessive expansion of variables in conditionals. In particular, if
|
||||
|
|
|
|||
4340
src/external/RGFW/RGFW.h
vendored
4340
src/external/RGFW/RGFW.h
vendored
File diff suppressed because it is too large
Load diff
6
src/external/rlsw.h
vendored
6
src/external/rlsw.h
vendored
|
|
@ -1249,8 +1249,8 @@ static inline float sw_fract(float x)
|
|||
|
||||
// Xtensa architecture optimization
|
||||
// Fast reciprocal: 1-ULP accurate in ~7 instructions using the
|
||||
// hardware `recip0.s` seed + two Newton-Raphson refinement steps
|
||||
// All work stays in FPU registers — no `__divsf3` software call
|
||||
// hardware `recip0.s` seed + two Newton-Raphson refinement steps
|
||||
// All work stays in FPU registers — no `__divsf3` software call
|
||||
// Hot-path divisions in the rasterizer (span/triangle setup, perspective divide, etc.) call this
|
||||
// On non-Xtensa targets it transparently expands to `1.0f / x`, so generated code is identical to before
|
||||
#if defined(__XTENSA__)
|
||||
|
|
@ -5434,7 +5434,7 @@ static void SW_RASTER_TRIANGLE_SPAN(const sw_vertex_t *start, const sw_vertex_t
|
|||
if (xLoopStart >= xLoopEnd) return; // Nothing to draw
|
||||
|
||||
// Get the current row and skip if outside the framebuffer
|
||||
// Maybe this check is better suited elsewhere?
|
||||
// Maybe this check is better suited elsewhere?
|
||||
int y = (int)start->position[1];
|
||||
if (y < 0 || y >= RLSW.colorBuffer->height) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1078,7 +1078,7 @@ Image GetClipboardImage(void)
|
|||
XID window = glfwGetX11Window(platform.handle);
|
||||
|
||||
// Lazy-load X11 atoms
|
||||
if(clipboard == 0)
|
||||
if (clipboard == 0)
|
||||
{
|
||||
clipboard = XInternAtom(display, "CLIPBOARD", False);
|
||||
targetType = XInternAtom(display, "image/png", False);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -56,7 +56,7 @@
|
|||
#include "SDL3/SDL.h"
|
||||
#elif defined(USING_SDL2_PROJECT)
|
||||
#include "SDL2/SDL.h"
|
||||
#include "SDL2/SDL_syswm.h" // Required to get window handlers
|
||||
#include "SDL2/SDL_syswm.h" // Required to get window handlers
|
||||
#else
|
||||
#include "SDL.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -566,100 +566,100 @@ static KeyboardKey GetKeyFromWparam(WPARAM wparam)
|
|||
case 'X': return KEY_X;
|
||||
case 'Y': return KEY_Y;
|
||||
case 'Z': return KEY_Z;
|
||||
/* case VK_LWIN: return KEY_; */
|
||||
/* case VK_RWIN: return KEY_; */
|
||||
/* case VK_APPS: return KEY_; */
|
||||
/* case VK_SLEEP: return KEY_; */
|
||||
/* case VK_NUMPAD0: return KEY_; */
|
||||
/* case VK_NUMPAD1: return KEY_; */
|
||||
/* case VK_NUMPAD2: return KEY_; */
|
||||
/* case VK_NUMPAD3: return KEY_; */
|
||||
/* case VK_NUMPAD4: return KEY_; */
|
||||
/* case VK_NUMPAD5: return KEY_; */
|
||||
/* case VK_NUMPAD6: return KEY_; */
|
||||
/* case VK_NUMPAD7: return KEY_; */
|
||||
/* case VK_NUMPAD8: return KEY_; */
|
||||
/* case VK_NUMPAD9: return KEY_; */
|
||||
/* case VK_MULTIPLY: return KEY_; */
|
||||
/* case VK_ADD: return KEY_; */
|
||||
/* case VK_SEPARATOR: return KEY_; */
|
||||
/* case VK_SUBTRACT: return KEY_; */
|
||||
/* case VK_DECIMAL: return KEY_; */
|
||||
/* case VK_DIVIDE: return KEY_; */
|
||||
/* case VK_F1: return KEY_; */
|
||||
/* case VK_F2: return KEY_; */
|
||||
/* case VK_F3: return KEY_; */
|
||||
/* case VK_F4: return KEY_; */
|
||||
/* case VK_F5: return KEY_; */
|
||||
/* case VK_F6: return KEY_; */
|
||||
/* case VK_F7: return KEY_; */
|
||||
/* case VK_F8: return KEY_; */
|
||||
/* case VK_F9: return KEY_; */
|
||||
/* case VK_F10: return KEY_; */
|
||||
/* case VK_F11: return KEY_; */
|
||||
/* case VK_F12: return KEY_; */
|
||||
/* case VK_F13: return KEY_; */
|
||||
/* case VK_F14: return KEY_; */
|
||||
/* case VK_F15: return KEY_; */
|
||||
/* case VK_F16: return KEY_; */
|
||||
/* case VK_F17: return KEY_; */
|
||||
/* case VK_F18: return KEY_; */
|
||||
/* case VK_F19: return KEY_; */
|
||||
/* case VK_F20: return KEY_; */
|
||||
/* case VK_F21: return KEY_; */
|
||||
/* case VK_F22: return KEY_; */
|
||||
/* case VK_F23: return KEY_; */
|
||||
/* case VK_F24: return KEY_; */
|
||||
/* case VK_NUMLOCK: return KEY_; */
|
||||
/* case VK_SCROLL: return KEY_; */
|
||||
/* case VK_LSHIFT: return KEY_; */
|
||||
/* case VK_RSHIFT: return KEY_; */
|
||||
/* case VK_LCONTROL: return KEY_; */
|
||||
/* case VK_RCONTROL: return KEY_; */
|
||||
/* case VK_LMENU: return KEY_; */
|
||||
/* case VK_RMENU: return KEY_; */
|
||||
/* case VK_BROWSER_BACK: return KEY_; */
|
||||
/* case VK_BROWSER_FORWARD: return KEY_; */
|
||||
/* case VK_BROWSER_REFRESH: return KEY_; */
|
||||
/* case VK_BROWSER_STOP: return KEY_; */
|
||||
/* case VK_BROWSER_SEARCH: return KEY_; */
|
||||
/* case VK_BROWSER_FAVORITES: return KEY_; */
|
||||
/* case VK_BROWSER_HOME: return KEY_; */
|
||||
/* case VK_VOLUME_MUTE: return KEY_; */
|
||||
/* case VK_VOLUME_DOWN: return KEY_; */
|
||||
/* case VK_VOLUME_UP: return KEY_; */
|
||||
/* case VK_MEDIA_NEXT_TRACK: return KEY_; */
|
||||
/* case VK_MEDIA_PREV_TRACK: return KEY_; */
|
||||
/* case VK_MEDIA_STOP: return KEY_; */
|
||||
/* case VK_MEDIA_PLAY_PAUSE: return KEY_; */
|
||||
/* case VK_LAUNCH_MAIL: return KEY_; */
|
||||
/* case VK_LAUNCH_MEDIA_SELECT: return KEY_; */
|
||||
/* case VK_LAUNCH_APP1: return KEY_; */
|
||||
/* case VK_LAUNCH_APP2: return KEY_; */
|
||||
/* case VK_OEM_1: return KEY_; */
|
||||
/* case VK_OEM_PLUS: return KEY_; */
|
||||
/* case VK_OEM_COMMA: return KEY_; */
|
||||
/* case VK_OEM_MINUS: return KEY_; */
|
||||
/* case VK_OEM_PERIOD: return KEY_; */
|
||||
/* case VK_OEM_2: return KEY_; */
|
||||
/* case VK_OEM_3: return KEY_; */
|
||||
/* case VK_OEM_4: return KEY_; */
|
||||
/* case VK_OEM_5: return KEY_; */
|
||||
/* case VK_OEM_6: return KEY_; */
|
||||
/* case VK_OEM_7: return KEY_; */
|
||||
/* case VK_OEM_8: return KEY_; */
|
||||
/* case VK_OEM_102: return KEY_; */
|
||||
/* case VK_PROCESSKEY: return KEY_; */
|
||||
/* case VK_PACKET: return KEY_; */
|
||||
/* case VK_ATTN: return KEY_; */
|
||||
/* case VK_CRSEL: return KEY_; */
|
||||
/* case VK_EXSEL: return KEY_; */
|
||||
/* case VK_EREOF: return KEY_; */
|
||||
/* case VK_PLAY: return KEY_; */
|
||||
/* case VK_ZOOM: return KEY_; */
|
||||
/* case VK_NONAME: return KEY_; */
|
||||
/* case VK_PA1: return KEY_; */
|
||||
/* case VK_OEM_CLEAR: return KEY_; */
|
||||
//case VK_LWIN: return KEY_;
|
||||
//case VK_RWIN: return KEY_;
|
||||
//case VK_APPS: return KEY_;
|
||||
//case VK_SLEEP: return KEY_;
|
||||
//case VK_NUMPAD0: return KEY_;
|
||||
//case VK_NUMPAD1: return KEY_;
|
||||
//case VK_NUMPAD2: return KEY_;
|
||||
//case VK_NUMPAD3: return KEY_;
|
||||
//case VK_NUMPAD4: return KEY_;
|
||||
//case VK_NUMPAD5: return KEY_;
|
||||
//case VK_NUMPAD6: return KEY_;
|
||||
//case VK_NUMPAD7: return KEY_;
|
||||
//case VK_NUMPAD8: return KEY_;
|
||||
//case VK_NUMPAD9: return KEY_;
|
||||
//case VK_MULTIPLY: return KEY_;
|
||||
//case VK_ADD: return KEY_;
|
||||
//case VK_SEPARATOR: return KEY_;
|
||||
//case VK_SUBTRACT: return KEY_;
|
||||
//case VK_DECIMAL: return KEY_;
|
||||
//case VK_DIVIDE: return KEY_;
|
||||
//case VK_F1: return KEY_;
|
||||
//case VK_F2: return KEY_;
|
||||
//case VK_F3: return KEY_;
|
||||
//case VK_F4: return KEY_;
|
||||
//case VK_F5: return KEY_;
|
||||
//case VK_F6: return KEY_;
|
||||
//case VK_F7: return KEY_;
|
||||
//case VK_F8: return KEY_;
|
||||
//case VK_F9: return KEY_;
|
||||
//case VK_F10: return KEY_;
|
||||
//case VK_F11: return KEY_;
|
||||
//case VK_F12: return KEY_;
|
||||
//case VK_F13: return KEY_;
|
||||
//case VK_F14: return KEY_;
|
||||
//case VK_F15: return KEY_;
|
||||
//case VK_F16: return KEY_;
|
||||
//case VK_F17: return KEY_;
|
||||
//case VK_F18: return KEY_;
|
||||
//case VK_F19: return KEY_;
|
||||
//case VK_F20: return KEY_;
|
||||
//case VK_F21: return KEY_;
|
||||
//case VK_F22: return KEY_;
|
||||
//case VK_F23: return KEY_;
|
||||
//case VK_F24: return KEY_;
|
||||
//case VK_NUMLOCK: return KEY_;
|
||||
//case VK_SCROLL: return KEY_;
|
||||
//case VK_LSHIFT: return KEY_;
|
||||
//case VK_RSHIFT: return KEY_;
|
||||
//case VK_LCONTROL: return KEY_;
|
||||
//case VK_RCONTROL: return KEY_;
|
||||
//case VK_LMENU: return KEY_;
|
||||
//case VK_RMENU: return KEY_;
|
||||
//case VK_BROWSER_BACK: return KEY_;
|
||||
//case VK_BROWSER_FORWARD: return KEY_;
|
||||
//case VK_BROWSER_REFRESH: return KEY_;
|
||||
//case VK_BROWSER_STOP: return KEY_;
|
||||
//case VK_BROWSER_SEARCH: return KEY_;
|
||||
//case VK_BROWSER_FAVORITES: return KEY_;
|
||||
//case VK_BROWSER_HOME: return KEY_;
|
||||
//case VK_VOLUME_MUTE: return KEY_;
|
||||
//case VK_VOLUME_DOWN: return KEY_;
|
||||
//case VK_VOLUME_UP: return KEY_;
|
||||
//case VK_MEDIA_NEXT_TRACK: return KEY_;
|
||||
//case VK_MEDIA_PREV_TRACK: return KEY_;
|
||||
//case VK_MEDIA_STOP: return KEY_;
|
||||
//case VK_MEDIA_PLAY_PAUSE: return KEY_;
|
||||
//case VK_LAUNCH_MAIL: return KEY_;
|
||||
//case VK_LAUNCH_MEDIA_SELECT: return KEY_;
|
||||
//case VK_LAUNCH_APP1: return KEY_;
|
||||
//case VK_LAUNCH_APP2: return KEY_;
|
||||
//case VK_OEM_1: return KEY_;
|
||||
//case VK_OEM_PLUS: return KEY_;
|
||||
//case VK_OEM_COMMA: return KEY_;
|
||||
//case VK_OEM_MINUS: return KEY_;
|
||||
//case VK_OEM_PERIOD: return KEY_;
|
||||
//case VK_OEM_2: return KEY_;
|
||||
//case VK_OEM_3: return KEY_;
|
||||
//case VK_OEM_4: return KEY_;
|
||||
//case VK_OEM_5: return KEY_;
|
||||
//case VK_OEM_6: return KEY_;
|
||||
//case VK_OEM_7: return KEY_;
|
||||
//case VK_OEM_8: return KEY_;
|
||||
//case VK_OEM_102: return KEY_;
|
||||
//case VK_PROCESSKEY: return KEY_;
|
||||
//case VK_PACKET: return KEY_;
|
||||
//case VK_ATTN: return KEY_;
|
||||
//case VK_CRSEL: return KEY_;
|
||||
//case VK_EXSEL: return KEY_;
|
||||
//case VK_EREOF: return KEY_;
|
||||
//case VK_PLAY: return KEY_;
|
||||
//case VK_ZOOM: return KEY_;
|
||||
//case VK_NONAME: return KEY_;
|
||||
//case VK_PA1: return KEY_;
|
||||
//case VK_OEM_CLEAR: return KEY_;
|
||||
default: return KEY_NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ double GetTime(void)
|
|||
#if defined(_WIN32)
|
||||
LARGE_INTEGER currentTicks = { 0 };
|
||||
QueryPerformanceCounter(¤tTicks);
|
||||
|
||||
|
||||
time = (double)(currentTicks.QuadPart - CORE.Time.base)/(double)platform.timerFrequency.QuadPart;
|
||||
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__)
|
||||
struct timespec ts = { 0 };
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ void SetWindowSize(int width, int height)
|
|||
// When resizing the canvas, several elements must be considered:
|
||||
// - CSS canvas size: Web layout size, logical pixels
|
||||
// - Canvas contained framebuffer resolution
|
||||
// * Browser monitor, device pixel ratio (HighDPI)
|
||||
// - Browser monitor, device pixel ratio (HighDPI)
|
||||
|
||||
double canvasCssWidth = 0.0;
|
||||
double canvasCssHeight = 0.0;
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ typedef enum {
|
|||
// Audio buffer struct
|
||||
struct rAudioBuffer {
|
||||
ma_data_converter converter; // Audio data converter
|
||||
unsigned char* converterResidual; // Cached residual input frames for use by the converter
|
||||
unsigned char *converterResidual; // Cached residual input frames for use by the converter
|
||||
unsigned int converterResidualCount; // The number of valid frames sitting in converterResidual
|
||||
|
||||
AudioCallback callback; // Audio buffer callback for buffer filling on audio threads
|
||||
|
|
|
|||
|
|
@ -2714,13 +2714,13 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
|
|||
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].y));
|
||||
stabilizer = fmaxf(stabilizer, fabsf(matColumns[i].z));
|
||||
}
|
||||
matColumns[0] = Vector3Scale(matColumns[0], 1.0f / stabilizer);
|
||||
matColumns[1] = Vector3Scale(matColumns[1], 1.0f / stabilizer);
|
||||
matColumns[2] = Vector3Scale(matColumns[2], 1.0f / stabilizer);
|
||||
matColumns[0] = Vector3Scale(matColumns[0], 1.0f/stabilizer);
|
||||
matColumns[1] = Vector3Scale(matColumns[1], 1.0f/stabilizer);
|
||||
matColumns[2] = Vector3Scale(matColumns[2], 1.0f/stabilizer);
|
||||
|
||||
// X Scale
|
||||
scl.x = Vector3Length(matColumns[0]);
|
||||
if (scl.x > eps) matColumns[0] = Vector3Scale(matColumns[0], 1.0f / scl.x);
|
||||
if (scl.x > eps) matColumns[0] = Vector3Scale(matColumns[0], 1.0f/scl.x);
|
||||
|
||||
// Compute XY shear and make col2 orthogonal
|
||||
shear[0] = Vector3DotProduct(matColumns[0], matColumns[1]);
|
||||
|
|
@ -2730,7 +2730,7 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
|
|||
scl.y = Vector3Length(matColumns[1]);
|
||||
if (scl.y > eps)
|
||||
{
|
||||
matColumns[1] = Vector3Scale(matColumns[1], 1.0f / scl.y);
|
||||
matColumns[1] = Vector3Scale(matColumns[1], 1.0f/scl.y);
|
||||
shear[0] /= scl.y; // Correct XY shear
|
||||
}
|
||||
|
||||
|
|
@ -2744,7 +2744,7 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
|
|||
scl.z = Vector3Length(matColumns[2]);
|
||||
if (scl.z > eps)
|
||||
{
|
||||
matColumns[2] = Vector3Scale(matColumns[2], 1.0f / scl.z);
|
||||
matColumns[2] = Vector3Scale(matColumns[2], 1.0f/scl.z);
|
||||
shear[1] /= scl.z; // Correct XZ shear
|
||||
shear[2] /= scl.z; // Correct YZ shear
|
||||
}
|
||||
|
|
|
|||
22
src/rcore.c
22
src/rcore.c
|
|
@ -2246,10 +2246,10 @@ int FileCopy(const char *srcPath, const char *dstPath)
|
|||
unsigned char *srcFileData = LoadFileData(srcPath, &srcDataSize);
|
||||
|
||||
// Create required paths if they do not exist
|
||||
if (!DirectoryExists(GetDirectoryPath(dstPath)))
|
||||
result = MakeDirectory(GetDirectoryPath(dstPath));
|
||||
if (DirectoryExists(GetDirectoryPath(dstPath))) result = 0; // Already exists
|
||||
else result = MakeDirectory(GetDirectoryPath(dstPath));
|
||||
|
||||
if (result == 0) // Directory created successfully (or already exists)
|
||||
if (result == 0) // Directory created successfully or already exists
|
||||
{
|
||||
if ((srcFileData != NULL) && (srcDataSize > 0))
|
||||
{
|
||||
|
|
@ -2272,11 +2272,11 @@ int FileMove(const char *srcPath, const char *dstPath)
|
|||
if (FileExists(srcPath))
|
||||
{
|
||||
result = FileCopy(srcPath, dstPath);
|
||||
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
// Make sure file has been correctly copied before removing
|
||||
if (FileExists(dstPath) && (GetFileLength(srcPath) == GetFileLength(dstPath)))
|
||||
if (FileExists(dstPath) && (GetFileLength(srcPath) == GetFileLength(dstPath)))
|
||||
{
|
||||
result = FileRemove(srcPath);
|
||||
if (result != 0) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to remove source file after copy", srcPath);
|
||||
|
|
@ -3943,7 +3943,11 @@ bool IsGamepadAvailable(int gamepad)
|
|||
// Get gamepad internal name id
|
||||
const char *GetGamepadName(int gamepad)
|
||||
{
|
||||
return CORE.Input.Gamepad.name[gamepad];
|
||||
const char *name = NULL;
|
||||
|
||||
if ((gamepad >= 0) && (gamepad < MAX_GAMEPADS)) name = CORE.Input.Gamepad.name[gamepad];
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// Check if gamepad button has been pressed once
|
||||
|
|
@ -4008,7 +4012,11 @@ int GetGamepadButtonPressed(void)
|
|||
// Get gamepad axis count
|
||||
int GetGamepadAxisCount(int gamepad)
|
||||
{
|
||||
return CORE.Input.Gamepad.axisCount[gamepad];
|
||||
int result = 0;
|
||||
|
||||
if ((gamepad >= 0) && (gamepad < MAX_GAMEPADS)) result = CORE.Input.Gamepad.axisCount[gamepad];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get axis movement vector for a gamepad
|
||||
|
|
|
|||
14
src/rlgl.h
14
src/rlgl.h
|
|
@ -1237,7 +1237,11 @@ void rlMatrixMode(int mode)
|
|||
// Push the current matrix into RLGL.State.stack
|
||||
void rlPushMatrix(void)
|
||||
{
|
||||
if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE) TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)");
|
||||
if (RLGL.State.stackCounter >= RL_MAX_MATRIX_STACK_SIZE)
|
||||
{
|
||||
TRACELOG(RL_LOG_ERROR, "RLGL: Matrix stack overflow (RL_MAX_MATRIX_STACK_SIZE)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (RLGL.State.currentMatrixMode == RL_MODELVIEW)
|
||||
{
|
||||
|
|
@ -3777,9 +3781,17 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
|
|||
// Attach our texture to FBO
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0);
|
||||
|
||||
#if defined(FBO_READ_TEXTURE_AS_RGBA)
|
||||
// Reading data as RGBA because FBO texture is configured as RGBA, despite binding another texture format
|
||||
pixels = RL_CALLOC(rlGetPixelDataSize(width, height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8), 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
#else
|
||||
// Reading data as original texture format, in some platforms (RPI, Wasm) it works
|
||||
pixels = (unsigned char *)RL_MALLOC(GetPixelDataSize(width, height, format));
|
||||
unsigned int glInternalFormat = 0, glFormat = 0, glType = 0;
|
||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||
glReadPixels(0, 0, width, height, glFormat, glType, pixels);
|
||||
#endif
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -3142,6 +3142,8 @@ Mesh GenMeshCone(float radius, float height, int slices)
|
|||
}
|
||||
|
||||
// Generate torus mesh
|
||||
// NOTE: The distance between the center of the hole and the center of the
|
||||
// tube is half size of the radius of the tube (radius*size/2)
|
||||
Mesh GenMeshTorus(float radius, float size, int radSeg, int sides)
|
||||
{
|
||||
Mesh mesh = { 0 };
|
||||
|
|
@ -7212,7 +7214,7 @@ static Model LoadM3D(const char *fileName)
|
|||
return model;
|
||||
}
|
||||
|
||||
#define M3D_ANIMDELAY 17 // Animation frames delay, (~1000 ms/60 FPS = 16.666666* ms)
|
||||
#define M3D_ANIMDELAY 17 // Animation frames delay, (~1000 ms/60 FPS = 16.666666 ms)
|
||||
|
||||
// Load M3D animation data
|
||||
static ModelAnimation *LoadModelAnimationsM3D(const char *fileName, int *animCount)
|
||||
|
|
|
|||
16
src/rtext.c
16
src/rtext.c
|
|
@ -580,7 +580,7 @@ Font LoadFontFromMemory(const char *fileType, const unsigned char *fileData, int
|
|||
|
||||
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", font.baseSize, font.glyphCount);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "FONT: Font is not supported by LoadFontEx/LoadFontFromMemory or no glyphs found, reverted to default font");
|
||||
font = GetFontDefault();
|
||||
|
|
@ -947,8 +947,8 @@ Image GenImageFontAtlas(const GlyphInfo *glyphs, Rectangle **glyphRecs, int glyp
|
|||
// Security fix: check both lower and upper bounds
|
||||
if (destX >= 0 && destX < atlas.width && destY >= 0 && destY < atlas.height)
|
||||
{
|
||||
((unsigned char *)atlas.data)[destY * atlas.width + destX] =
|
||||
((unsigned char *)glyphs[i].image.data)[y * glyphs[i].image.width + x];
|
||||
((unsigned char *)atlas.data)[destY*atlas.width + destX] =
|
||||
((unsigned char *)glyphs[i].image.data)[y*glyphs[i].image.width + x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1919,9 +1919,13 @@ char *TextReplaceBetween(const char *text, const char *begin, const char *end, c
|
|||
int replaceLen = (replacement == NULL)? 0 : TextLength(replacement);
|
||||
//int toreplaceLen = endIndex - beginIndex - beginLen;
|
||||
|
||||
strncpy(buffer, text, beginIndex + beginLen); // Copy first text part
|
||||
if (replacement != NULL) strncpy(buffer + beginIndex + beginLen, replacement, replaceLen); // Copy replacement (if provided)
|
||||
strncpy(buffer + beginIndex + beginLen + replaceLen, text + endIndex, textLen - endIndex); // Copy end text part
|
||||
if ((beginIndex + beginLen + replaceLen + (textLen - endIndex)) < (MAX_TEXT_BUFFER_LENGTH - 1))
|
||||
{
|
||||
strncpy(buffer, text, beginIndex + beginLen); // Copy first text part
|
||||
if (replacement != NULL) strncpy(buffer + beginIndex + beginLen, replacement, replaceLen); // Copy replacement (if provided)
|
||||
strncpy(buffer + beginIndex + beginLen + replaceLen, text + endIndex, textLen - endIndex); // Copy end text part
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "TEXT: Text with replaced string is longer than internal buffer (MAX_TEXT_BUFFER_LENGTH)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -562,15 +562,18 @@ Image LoadImageFromTexture(Texture2D texture)
|
|||
{
|
||||
image.width = texture.width;
|
||||
image.height = texture.height;
|
||||
#if defined(FBO_READ_TEXTURE_AS_RGBA)
|
||||
// WARNING: On OpenGL ES 2.0/WebGL 1.0, there is no glGetTexImage() so,
|
||||
// texture data is retrieved by creating an RGBA fbo, binding the texture
|
||||
// to the fbo color attachment, and reading it as RGBA data with glReadPixels()
|
||||
// Returned data *should* be RGBA but it seems on some platforms (RPI, WASM)
|
||||
// original texture format is retrieved, so adding a define for this patch
|
||||
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
||||
#else
|
||||
image.format = texture.format;
|
||||
#endif
|
||||
image.mipmaps = 1;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// NOTE: Data retrieved on OpenGL ES 2.0 should be RGBA,
|
||||
// coming from FBO color buffer attachment, but it seems
|
||||
// original texture format is retrieved on RPI...
|
||||
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
||||
#endif
|
||||
TRACELOG(LOG_INFO, "TEXTURE: [ID %i] Pixel data retrieved successfully", texture.id);
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "TEXTURE: [ID %i] Failed to retrieve pixel data", texture.id);
|
||||
|
|
@ -1500,7 +1503,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
|||
if ((codepoint != ' ') && (codepoint != '\t'))
|
||||
{
|
||||
Rectangle rec = { (float)(textOffsetX + font.glyphs[index].offsetX), (float)(textOffsetY + font.glyphs[index].offsetY), (float)font.recs[index].width, (float)font.recs[index].height };
|
||||
ImageDrawImagePro(&imText, font.glyphs[index].image, (Rectangle){ 0, 0, (float)font.glyphs[index].image.width, (float)font.glyphs[index].image.height },
|
||||
ImageDrawImagePro(&imText, font.glyphs[index].image, (Rectangle){ 0, 0, (float)font.glyphs[index].image.width, (float)font.glyphs[index].image.height },
|
||||
rec, (Vector2){ 0 }, 0.0f, tint);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -680,7 +680,7 @@ int main(int argc, char *argv[])
|
|||
LOG("INFO: [%s] Building example for PLATFORM_WEB (Host: POSIX)\n", GetFileNameWithoutExt(inFileName));
|
||||
#endif
|
||||
system(TextFormat("make -C %s -f Makefile.Web %s/%s PLATFORM=PLATFORM_WEB -B", exBasePath, exCategory, exName));
|
||||
|
||||
|
||||
// Update generated .html metadata
|
||||
LOG("INFO: [%s] Updating HTML Metadata...\n", TextFormat("%s.html", exName));
|
||||
UpdateWebMetadata(TextFormat("%s/%s/%s.html", exBasePath, exCategory, exName),
|
||||
|
|
@ -1886,9 +1886,11 @@ int main(int argc, char *argv[])
|
|||
printf(" test <example_name> : Build and Test example for Desktop and Web platforms\n");
|
||||
printf(" validate : Validate examples collection, generates report\n");
|
||||
printf(" update : Validate and update examples collection, generates report\n\n");
|
||||
|
||||
printf("OPTIONS:\n\n");
|
||||
printf(" -h, --help : Show tool version and command line usage help\n");
|
||||
printf(" -v, --verbose : Verbose mode, show additional logs on processes\n");
|
||||
|
||||
printf("\nEXAMPLES:\n\n");
|
||||
printf(" > rexm add shapes_custom_stars\n");
|
||||
printf(" Add and updates new example provided <shapes_custom_stars>\n\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue