From f607cac267ae21e9b6392dc510f389b43c9e63f4 Mon Sep 17 00:00:00 2001 From: "Dennis E. Hamilton" Date: Sat, 18 Nov 2023 11:01:02 -0800 Subject: [PATCH 01/13] Preparing for 5.1-dev (#3550) Adjusting raylib.h to reflect post-5.0 changes now. --- src/raylib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 1c4c4a09..6ea00300 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1,6 +1,6 @@ /********************************************************************************************** * -* raylib v5.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com) +* raylib v5.1-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 // Required for: va_list - Only used by TraceLogCallback #define RAYLIB_VERSION_MAJOR 5 -#define RAYLIB_VERSION_MINOR 0 +#define RAYLIB_VERSION_MINOR 1 #define RAYLIB_VERSION_PATCH 0 -#define RAYLIB_VERSION "5.0" +#define RAYLIB_VERSION "5.1-dev" // Function specifiers in case library is build/used as a shared library (Windows) // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll From 25c6c12150d6f0aeea83d55d1a0f16e12a3effd3 Mon Sep 17 00:00:00 2001 From: Jussi Viitala Date: Sat, 18 Nov 2023 21:02:33 +0200 Subject: [PATCH 02/13] Added glsl 100 and 120 shaders to lightmap example. (#3543) * Added glsl 100 and 120 shaders to lightmap example. * Fixed lightmap example resource loading on web. --- examples/Makefile.Web | 8 ++--- .../resources/shaders/glsl100/lightmap.fs | 22 +++++++++++++ .../resources/shaders/glsl100/lightmap.vs | 31 +++++++++++++++++++ .../resources/shaders/glsl120/lightmap.fs | 20 ++++++++++++ .../resources/shaders/glsl120/lightmap.vs | 31 +++++++++++++++++++ examples/shaders/shaders_lightmap.c | 1 - 6 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 examples/shaders/resources/shaders/glsl100/lightmap.fs create mode 100644 examples/shaders/resources/shaders/glsl100/lightmap.vs create mode 100644 examples/shaders/resources/shaders/glsl120/lightmap.fs create mode 100644 examples/shaders/resources/shaders/glsl120/lightmap.vs diff --git a/examples/Makefile.Web b/examples/Makefile.Web index e8a72661..aa42d722 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -968,10 +968,10 @@ shaders/shaders_julia_set: shaders/shaders_julia_set.c shaders/shaders_lightmap: shaders/shaders_lightmap.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s FORCE_FILESYSTEM=1 \ - --preload-file shaders/resources/shaders/glsl330/lightmap.vs \ - --preload-file shaders/resources/shaders/glsl330/lightmap.fs \ - --preload-file shaders/resources/cubicmap_atlas.png \ - --preload-file shaders/resources/spark_flame.png + --preload-file shaders/resources/shaders/glsl100/lightmap.vs@resources/shaders/glsl100/lightmap.vs \ + --preload-file shaders/resources/shaders/glsl100/lightmap.fs@resources/shaders/glsl100/lightmap.fs \ + --preload-file shaders/resources/cubicmap_atlas.png@resources/cubicmap_atlas.png \ + --preload-file shaders/resources/spark_flame.png@resources/spark_flame.png shaders/shaders_mesh_instancing: shaders/shaders_mesh_instancing.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ diff --git a/examples/shaders/resources/shaders/glsl100/lightmap.fs b/examples/shaders/resources/shaders/glsl100/lightmap.fs new file mode 100644 index 00000000..9f0bcd27 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/lightmap.fs @@ -0,0 +1,22 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec3 fragPosition; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D texture1; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + vec4 texelColor2 = texture2D(texture1, fragTexCoord2); + + gl_FragColor = texelColor * texelColor2; +} diff --git a/examples/shaders/resources/shaders/glsl100/lightmap.vs b/examples/shaders/resources/shaders/glsl100/lightmap.vs new file mode 100644 index 00000000..f5d87b3e --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/lightmap.vs @@ -0,0 +1,31 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec2 vertexTexCoord2; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragPosition = vec3(matModel*vec4(vertexPosition, 1.0)); + fragTexCoord = vertexTexCoord; + fragTexCoord2 = vertexTexCoord2; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/resources/shaders/glsl120/lightmap.fs b/examples/shaders/resources/shaders/glsl120/lightmap.fs new file mode 100644 index 00000000..93a0609e --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/lightmap.fs @@ -0,0 +1,20 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec3 fragPosition; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D texture1; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + vec4 texelColor2 = texture2D(texture1, fragTexCoord2); + + gl_FragColor = texelColor * texelColor2; +} diff --git a/examples/shaders/resources/shaders/glsl120/lightmap.vs b/examples/shaders/resources/shaders/glsl120/lightmap.vs new file mode 100644 index 00000000..9847b253 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/lightmap.vs @@ -0,0 +1,31 @@ +#version 120 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec2 vertexTexCoord2; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragPosition = vec3(matModel*vec4(vertexPosition, 1.0)); + fragTexCoord = vertexTexCoord; + fragTexCoord2 = vertexTexCoord2; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/shaders_lightmap.c b/examples/shaders/shaders_lightmap.c index c5ed6094..445d81d2 100644 --- a/examples/shaders/shaders_lightmap.c +++ b/examples/shaders/shaders_lightmap.c @@ -170,4 +170,3 @@ int main(void) return 0; } - From e41a0c9721a38c81a1499ae499b746bd05f9de2e Mon Sep 17 00:00:00 2001 From: _Tradam Date: Sat, 18 Nov 2023 14:03:13 -0500 Subject: [PATCH 03/13] fix for running gles2 with sdl on desktop (#3542) --- src/platforms/rcore_desktop_sdl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 96e55702..7836828f 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -49,7 +49,14 @@ **********************************************************************************************/ #include "SDL.h" // SDL base library (window/rendered, input, timming... functionality) +#ifdef GRAPHICS_API_OPENGL_ES2 +// I suspect that the gles2 version of the SDL header should be used +// but the compilation fails if we do. Not including anything appears +// to work fine. +//#include "SDL_opengles2.h" +#else #include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer) +#endif //---------------------------------------------------------------------------------- // Types and Structures Definition From 21469e92b0a886de8b384b7ffadc5c1c73cff913 Mon Sep 17 00:00:00 2001 From: Karim <35817819+Kimo-s@users.noreply.github.com> Date: Sat, 18 Nov 2023 14:05:45 -0500 Subject: [PATCH 04/13] Image convolution function ImageKernelConvolution (#3528) * Added image convultion ImageKernelConvolution * comment changes * spelling changes and change to kernel size * removed kernel normalization inside function * fix to formating --- examples/Makefile | 1 + examples/textures/textures_image_kernel.c | 127 ++++++++++++++++ .../raylib_npp_parser/raylib_to_parse.h | 1 + src/raylib.h | 1 + src/rtextures.c | 142 ++++++++++++++++++ 5 files changed, 272 insertions(+) create mode 100644 examples/textures/textures_image_kernel.c diff --git a/examples/Makefile b/examples/Makefile index 5cd8e6bb..11669e3a 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -490,6 +490,7 @@ TEXTURES = \ textures/textures_gif_player \ textures/textures_image_drawing \ textures/textures_image_generation \ + textures/textures_image_kernel \ textures/textures_image_loading \ textures/textures_image_processing \ textures/textures_image_rotate \ diff --git a/examples/textures/textures_image_kernel.c b/examples/textures/textures_image_kernel.c new file mode 100644 index 00000000..cbc75e18 --- /dev/null +++ b/examples/textures/textures_image_kernel.c @@ -0,0 +1,127 @@ +/******************************************************************************************* +* +* raylib [textures] example - Image loading and texture creation +* +* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM) +* +* Example originally created with raylib 1.3, last time updated with raylib 1.3 +* +* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, +* BSD-like license that allows static linking with closed source software +* +* Copyright (c) 2015-2023 Karim Salem (@kimo-s) +* +********************************************************************************************/ + +#include "raylib.h" + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +void normalizeKernel(float *kernel, int size){ + float sum = 0.0f; + for(int i = 0; i < size; i++) + { + sum += kernel[i]; + } + + if(sum != 0.0f) + { + for(int i = 0; i < size; i++) + { + kernel[i] /= sum; + } + } +} + +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + + Image image = LoadImage("resources/cat.png"); // Loaded in CPU memory (RAM) + + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "raylib [textures] example - image convolution"); + + float gaussiankernel[] = {1.0, 2.0, 1.0, + 2.0, 4.0, 2.0, + 1.0, 2.0, 1.0}; + + float sobelkernel[] = {1.0, 0.0, -1.0, + 2.0, 0.0, -2.0, + 1.0, 0.0, -1.0}; + + float sharpenkernel[] = {0.0, -1.0, 0.0, + -1.0, 5.0, -1.0, + 0.0, -1.0, 0.0}; + + normalizeKernel(gaussiankernel, 9); + normalizeKernel(sharpenkernel, 9); + normalizeKernel(sobelkernel, 9); + + Image catSharpend = ImageCopy(image); + ImageKernelConvolution(&catSharpend, sharpenkernel, 9); + + Image catSobel = ImageCopy(image); + ImageKernelConvolution(&catSobel, sobelkernel, 9); + + Image catGaussian = ImageCopy(image); + for(int i = 0; i < 6; i++) + { + ImageKernelConvolution(&catGaussian, gaussiankernel, 9); + } + + ImageCrop(&image, (Rectangle){ 0, 0, (float)200, (float)450 }); + ImageCrop(&catGaussian, (Rectangle){ 0, 0, (float)200, (float)450 }); + ImageCrop(&catSobel, (Rectangle){ 0, 0, (float)200, (float)450 }); + ImageCrop(&catSharpend, (Rectangle){ 0, 0, (float)200, (float)450 }); + Texture2D texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM) + Texture2D catSharpendTexture = LoadTextureFromImage(catSharpend); + Texture2D catSobelTexture = LoadTextureFromImage(catSobel); + Texture2D catGaussianTexture = LoadTextureFromImage(catGaussian); + UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM + UnloadImage(catGaussian); + UnloadImage(catSobel); + UnloadImage(catSharpend); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //--------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + // TODO: Update your variables here + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawTexture(catSharpendTexture, 0, 0, WHITE); + DrawTexture(catSobelTexture, 200, 0, WHITE); + DrawTexture(catGaussianTexture, 400, 0, WHITE); + DrawTexture(texture, 600, 0, WHITE); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + UnloadTexture(texture); // Texture unloading + UnloadTexture(catGaussianTexture); + UnloadTexture(catSobelTexture); + UnloadTexture(catSharpendTexture); + + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +} diff --git a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h index 2c033c91..8776d434 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +++ b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h @@ -375,6 +375,7 @@ 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 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 diff --git a/src/raylib.h b/src/raylib.h index 6ea00300..28f052c7 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1329,6 +1329,7 @@ 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 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 diff --git a/src/rtextures.c b/src/rtextures.c index 98586db7..8742b0c9 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -2082,6 +2082,148 @@ void ImageBlurGaussian(Image *image, int blurSize) { ImageFormat(image, format); } +// The kernel matrix is assumed to be square. Only supply the width of the kernel. +void ImageKernelConvolution(Image *image, float* kernel, int kernelSize){ + + if ((image->data == NULL) || (image->width == 0) || (image->height == 0) || kernel == NULL) return; + + int kernelWidth = (int)sqrtf((float)kernelSize); + if (kernelWidth*kernelWidth != kernelSize) + { + TRACELOG(LOG_WARNING, "IMAGE: Convolution kernel must be square to be applied"); + return; + } + + Color *pixels = LoadImageColors(*image); + + Vector4 *imageCopy2 = RL_MALLOC((image->height)*(image->width)*sizeof(Vector4)); + Vector4 *temp = RL_MALLOC(kernelSize*sizeof(Vector4)); + + + for(int i = 0; i < kernelSize; i++){ + temp[i].x = 0.0f; + temp[i].y = 0.0f; + temp[i].z = 0.0f; + temp[i].w = 0.0f; + } + + float rRes = 0.0f; + float gRes = 0.0f; + float bRes = 0.0f; + float aRes = 0.0f; + + + int startRange, endRange; + if(kernelWidth % 2 == 0) + { + startRange = -kernelWidth/2; + endRange = kernelWidth/2; + } else + { + startRange = -kernelWidth/2; + endRange = kernelWidth/2+1; + } + for(int x = 0; x < image->height; x++) + { + for(int y = 0; y < image->width; y++) + { + + for(int xk = startRange; xk < endRange; xk++) + { + for(int yk = startRange; yk < endRange; yk++) + { + int xkabs = xk + kernelWidth/2; + int ykabs = yk + kernelWidth/2; + size_t imgindex = image->width * (x+xk) + (y+yk); + if(imgindex < 0 || imgindex >= image->width * image->height){ + temp[kernelWidth * xkabs + ykabs].x = 0.0f; + temp[kernelWidth * xkabs + ykabs].y = 0.0f; + temp[kernelWidth * xkabs + ykabs].z = 0.0f; + temp[kernelWidth * xkabs + ykabs].w = 0.0f; + } else { + temp[kernelWidth * xkabs + ykabs].x = ((float)pixels[imgindex].r)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + temp[kernelWidth * xkabs + ykabs].y = ((float)pixels[imgindex].g)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + temp[kernelWidth * xkabs + ykabs].z = ((float)pixels[imgindex].b)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + temp[kernelWidth * xkabs + ykabs].w = ((float)pixels[imgindex].a)/255.0f * kernel[kernelWidth * xkabs + ykabs]; + } + } + } + + for(int i = 0; i < kernelSize; i++) + { + rRes += temp[i].x; + gRes += temp[i].y; + bRes += temp[i].z; + aRes += temp[i].w; + } + + if(rRes < 0.0f) + { + rRes = 0.0f; + } + if(gRes < 0.0f) + { + gRes = 0.0f; + } + if(bRes < 0.0f) + { + bRes = 0.0f; + } + + if(rRes > 1.0f) + { + rRes = 1.0f; + } + if(gRes > 1.0f) + { + gRes = 1.0f; + } + if(bRes > 1.0f) + { + bRes = 1.0f; + } + + imageCopy2[image->width * (x) + (y)].x = rRes; + imageCopy2[image->width * (x) + (y)].y = gRes; + imageCopy2[image->width * (x) + (y)].z = bRes; + imageCopy2[image->width * (x) + (y)].w = aRes; + + rRes = 0.0f; + gRes = 0.0f; + bRes = 0.0f; + aRes = 0.0f; + + for(int i = 0; i < kernelSize; i++) + { + temp[i].x = 0.0f; + temp[i].y = 0.0f; + temp[i].z = 0.0f; + temp[i].w = 0.0f; + } + } + } + + for (int i = 0; i < (image->width) * (image->height); i++) + { + float alpha = (float)imageCopy2[i].w; + pixels[i].r = (unsigned char)((imageCopy2[i].x)*255.0f); + pixels[i].g = (unsigned char)((imageCopy2[i].y)*255.0f); + pixels[i].b = (unsigned char)((imageCopy2[i].z)*255.0f); + pixels[i].a = (unsigned char)((alpha)*255.0f); + // printf("pixels[%d] = %d", i, pixels[i].r); + } + + + int format = image->format; + RL_FREE(image->data); + RL_FREE(imageCopy2); + RL_FREE(temp); + + image->data = pixels; + image->format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; + ImageFormat(image, format); +} + // Generate all mipmap levels for a provided image // NOTE 1: Supports POT and NPOT images // NOTE 2: image.data is scaled to include mipmap levels From f6de0358e137625e12f60b26c794cc05f09999e4 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sat, 18 Nov 2023 16:06:19 -0300 Subject: [PATCH 05/13] Disable unused miniaudio features (#3544) * Disable unused miniaudio features * Fix mistakes --- src/raudio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/raudio.c b/src/raudio.c index e38e51e6..c321aa50 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -167,6 +167,10 @@ typedef struct tagBITMAPINFOHEADER { #define MA_NO_WAV #define MA_NO_FLAC #define MA_NO_MP3 +#define MA_NO_RESOURCE_MANAGER +#define MA_NO_NODE_GRAPH +#define MA_NO_ENGINE +#define MA_NO_GENERATION // Threading model: Default: [0] COINIT_MULTITHREADED: COM calls objects on any thread (free threading) #define MA_COINIT_VALUE 2 // [2] COINIT_APARTMENTTHREADED: Each object has its own thread (apartment model) From 0137efde7a20903ce50fbd8a796dc92c77cb2c39 Mon Sep 17 00:00:00 2001 From: MrScautHD <65916181+MrScautHD@users.noreply.github.com> Date: Sat, 18 Nov 2023 20:07:30 +0100 Subject: [PATCH 06/13] Expanding Possibilities: Integrating Additional glTF / GLB Data Formats for Enhanced 3D Experiences (#3546) * Add more gltf data formats * Fix forgot to save bone ids * Fix misstake * Fix code format * Removed useless formats --- src/rmodels.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/rmodels.c b/src/rmodels.c index 229d373f..c191f0ac 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -5155,16 +5155,29 @@ static Model LoadGLTF(const char *fileName) if ((attribute->component_type == cgltf_component_type_r_8u) && (attribute->type == cgltf_type_vec4)) { - // Init raylib mesh bone ids to copy glTF attribute data + // Handle 8-bit unsigned byte, vec4 format model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned char)); - - // Load 4 components of unsigned char data type into mesh.boneIds - // for cgltf_attribute_type_joints we have: - // - data.meshes[0] (256 vertices) - // - 256 values, provided as cgltf_type_vec4 of bytes (4 byte per joint, stride 4) LOAD_ATTRIBUTE(attribute, 4, unsigned char, model.meshes[meshIndex].boneIds) } - else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint attribute data format not supported, use vec4 u8", fileName); + else if ((attribute->component_type == cgltf_component_type_r_16u) && (attribute->type == cgltf_type_vec2)) + { + // Handle 16-bit unsigned short, vec2 format + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*2, sizeof(unsigned short)); + LOAD_ATTRIBUTE(attribute, 2, unsigned short, model.meshes[meshIndex].boneIds) + } + else if ((attribute->component_type == cgltf_component_type_r_32u) && (attribute->type == cgltf_type_vec4)) + { + // Handle 32-bit unsigned int, vec4 format + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*4, sizeof(unsigned int)); + LOAD_ATTRIBUTE(attribute, 4, unsigned int, model.meshes[meshIndex].boneIds) + } + else if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec2)) + { + // Handle 32-bit float, vec2 format + model.meshes[meshIndex].boneIds = RL_CALLOC(model.meshes[meshIndex].vertexCount*2, sizeof(float)); + LOAD_ATTRIBUTE(attribute, 2, float, model.meshes[meshIndex].boneIds) + } + else TRACELOG(LOG_WARNING, "MODEL: [%s] Joint attribute data format not supported", fileName); } else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_weights) // WEIGHTS_n (vec4 / u8, u16, f32) { From 67035815aa7dfa7dab350db13b1983a5b970742f Mon Sep 17 00:00:00 2001 From: Gunko Vadim Date: Sun, 19 Nov 2023 00:08:08 +0500 Subject: [PATCH 07/13] Update pascal binding.md (#3548) --- BINDINGS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BINDINGS.md b/BINDINGS.md index ab1bf6fa..6ae569bc 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -53,7 +53,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | MIT | https://github.com/Deathbat2190/raylib_odin_bindings | | raylib-ocaml | **4.5** | [OCaml](https://ocaml.org/) | MIT | https://github.com/tjammer/raylib-ocaml | | TurboRaylib | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | MIT | https://github.com/turborium/TurboRaylib | -| Ray4Laz | **4.5** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz | +| Ray4Laz | **5.0** | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/GuvaCode/Ray4Laz | | Raylib.4.0.Pascal | 4.0 | [Free Pascal](https://en.wikipedia.org/wiki/Free_Pascal)| Zlib | https://github.com/sysrpl/Raylib.4.0.Pascal | | pyraylib | 3.7 | [Python](https://www.python.org/) | Zlib | https://github.com/Ho011/pyraylib | | raylib-python-cffi | 4.2 | [Python](https://www.python.org/) | EPL-2.0 | https://github.com/electronstudio/raylib-python-cffi | From eccfaa5fcfca544f19e5b3b7c87da45cedeb5061 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sat, 18 Nov 2023 13:08:45 -0600 Subject: [PATCH 08/13] BINDINGS: Update raylib-cpp support to raylib 5.0 (#3551) [raylib-cpp](https://github.com/RobLoach/raylib-cpp) supports raylib 5.0. --- BINDINGS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BINDINGS.md b/BINDINGS.md index 6ae569bc..8b0ef96e 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -6,7 +6,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | name | raylib version | language | license | repo | |:------------------:|:---------------:|:---------:|:----------:|-----------------------------------------------------------| -| raylib | **4.5** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib | +| raylib | **5.0** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | Zlib | https://github.com/raysan5/raylib | | raylib-boo | 3.7 | [Boo](http://boo-language.github.io/)| MIT | https://github.com/Rabios/raylib-boo | | Raylib-cs | **4.5** | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | Zlib | https://github.com/ChrisDill/Raylib-cs | | Raylib-CsLo | 4.2 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/NotNotTech/Raylib-CsLo | @@ -88,7 +88,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm. | name | raylib version | language | license | repo | |:------------------:|:-------------: | :--------:|:-------:|:-------------------------------------------------------------| -| raylib-cpp | **4.5** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp | +| raylib-cpp | **5.0** | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | Zlib | https://github.com/robloach/raylib-cpp | | claylib | **4.5** | [Common Lisp](https://common-lisp.net/) | Zlib | https://github.com/defun-games/claylib | ### Older or Unmaintained Language Bindings From a91ebb75170780e28351226e11d34d347819fbc6 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 18 Nov 2023 20:12:08 +0100 Subject: [PATCH 09/13] Update BINDINGS.md --- BINDINGS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BINDINGS.md b/BINDINGS.md index 8b0ef96e..50fc90dd 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -29,7 +29,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | raylib for Pascal | **4.5** | [Object Pascal](https://en.wikipedia.org/wiki/Object_Pascal) | Modified Zlib | https://github.com/tinyBigGAMES/raylib | | raylib-go | **5.0** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go | | raylib-guile | **auto** | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile | -| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib | +| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | **???** | https://github.com/ArnautDaniel/gforth-raylib | | h-raylib | **4.6-dev** | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib | | raylib-hx | 4.2 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx | | hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | From ee9b44245fe6c36fc6d657fc4a5e5e6a92258755 Mon Sep 17 00:00:00 2001 From: Auz Date: Sun, 19 Nov 2023 03:01:10 -0700 Subject: [PATCH 10/13] Update BINDINGS.md for Raylib.nelua (#3552) Bumped version number and updated the link for Raylib.nelua --- BINDINGS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BINDINGS.md b/BINDINGS.md index 50fc90dd..d0dbf6fd 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -43,7 +43,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | raylua | 4.0 | [Lua](http://www.lua.org/) | MIT | https://github.com/Rabios/raylua | | raylib-matte | 4.6-dev | [Matte](https://github.com/jcorks/matte/) | MIT | https://github.com/jcorks/raylib-matte | | nelua-raylib | 4.0 | [nelua](https://nelua.io/) | MIT | https://github.com/AKDev21/nelua-raylib | -| Raylib.nelua | **4.5** | [nelua](https://nelua.io/) | Zlib | https://github.com/Its-Kenta/Raylib-Nelua | +| Raylib.nelua | **5.0** | [nelua](https://nelua.io/) | Zlib | https://github.com/AuzFox/Raylib.nelua | | NimraylibNow! | 4.2 | [Nim](https://nim-lang.org/) | MIT | https://github.com/greenfork/nimraylib_now | | raylib-bindings | **4.5** | [Ruby](https://www.ruby-lang.org/en/) | Zlib | https://github.com/vaiorabbit/raylib-bindings | | raylib-Forever | auto | [Nim](https://nim-lang.org/) | ? | https://github.com/Guevara-chan/Raylib-Forever | From 7e60227720515143712e1df9e78e7a6ecfc46169 Mon Sep 17 00:00:00 2001 From: Dmitry Matveyev Date: Sun, 19 Nov 2023 14:11:51 +0400 Subject: [PATCH 11/13] Update BINDINGS.md for Janet (#3553) This PR updates the bindings https://github.com/janet-lang/jaylib/pull/54 --- BINDINGS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BINDINGS.md b/BINDINGS.md index d0dbf6fd..5abe9c16 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -33,7 +33,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | h-raylib | **4.6-dev** | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib | | raylib-hx | 4.2 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx | | hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | -| jaylib | 4.5 | [Janet](https://janet-lang.org/) | MIT | https://github.com/janet-lang/jaylib | +| jaylib | 5.0 | [Janet](https://janet-lang.org/) | MIT | https://github.com/janet-lang/jaylib | | jaylib | **4.5** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ | | raylib-j | 4.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | Zlib | https://github.com/CreedVI/Raylib-J | | raylib.jl | 4.2 | [Julia](https://julialang.org/) | Zlib | https://github.com/irishgreencitrus/raylib.jl | From ce26e26177eb886c4fec16a51581f4611b8a069f Mon Sep 17 00:00:00 2001 From: Sergey Zapunidi Date: Mon, 20 Nov 2023 22:49:58 +0300 Subject: [PATCH 12/13] Added missing textures_image_kernel example in web makefile (#3555) * Added missing textures_image_kernel example in web makefile * Added missing --preload-file for textures_image_kernel --------- Co-authored-by: zap --- examples/Makefile.Web | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/Makefile.Web b/examples/Makefile.Web index aa42d722..a3c2bb72 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -396,6 +396,7 @@ TEXTURES = \ textures/textures_gif_player \ textures/textures_image_drawing \ textures/textures_image_generation \ + textures/textures_image_kernel \ textures/textures_image_loading \ textures/textures_image_processing \ textures/textures_image_rotate \ @@ -702,6 +703,10 @@ textures/textures_image_drawing: textures/textures_image_drawing.c textures/textures_image_generation: textures/textures_image_generation.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -s TOTAL_MEMORY=67108864 + +textures/textures_image_kernel: textures/textures_image_kernel.c + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ + --preload-file textures/resources/cat.png@resources/cat.png textures/textures_image_loading: textures/textures_image_loading.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ From 994c4f4bdf1f47f706447724b813c9304a66fb16 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 20 Nov 2023 23:21:04 +0100 Subject: [PATCH 13/13] Update rcore_desktop_sdl.c --- src/platforms/rcore_desktop_sdl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index 7836828f..0d3b091f 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -48,14 +48,13 @@ * **********************************************************************************************/ -#include "SDL.h" // SDL base library (window/rendered, input, timming... functionality) -#ifdef GRAPHICS_API_OPENGL_ES2 -// I suspect that the gles2 version of the SDL header should be used -// but the compilation fails if we do. Not including anything appears -// to work fine. -//#include "SDL_opengles2.h" +#include "SDL.h" // SDL base library (window/rendered, input, timming... functionality) + +#if defined(GRAPHICS_API_OPENGL_ES2) + // It seems it does not need to be included to work + //#include "SDL_opengles2.h" #else -#include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer) + #include "SDL_opengl.h" // SDL OpenGL functionality (if required, instead of internal renderer) #endif //----------------------------------------------------------------------------------