From c636618d777053d1a2b968c1aa76e8e06190f29e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1zaro=20Albuquerque?= <33807434+lzralbu@users.noreply.github.com> Date: Mon, 10 Jun 2024 14:50:09 -0400 Subject: [PATCH 1/7] Update Makefile (#4054) Since the flag CUSTOM_CFLAGS should allow users customize things, in particular the optimization level, I figured it should come after other default ones. Based on: "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective." Source: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html --- src/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 23742565d..19251b956 100644 --- a/src/Makefile +++ b/src/Makefile @@ -316,7 +316,7 @@ endif # -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers # -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing) -CFLAGS = -Wall -D_GNU_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing $(CUSTOM_CFLAGS) +CFLAGS = -Wall -D_GNU_SOURCE -D$(PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing ifneq ($(RAYLIB_CONFIG_FLAGS), NONE) CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS) @@ -449,6 +449,8 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif endif +CFLAGS += $(CUSTOM_CFLAGS) + # Define include paths for required headers: INCLUDE_PATHS # NOTE: Several external required libraries (stb and others) #------------------------------------------------------------------------------------------------ From 0fc4b619065291a06787fe38388d1318f7ecfc12 Mon Sep 17 00:00:00 2001 From: VitoTringolo Date: Tue, 11 Jun 2024 11:50:42 +0200 Subject: [PATCH 2/7] LoadBoneInfoGLTF add check for animation name being NULL (#4053) Co-authored-by: Vito Tringolo --- src/rmodels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rmodels.c b/src/rmodels.c index 14cfc64aa..1ee27602d 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -4864,7 +4864,7 @@ static BoneInfo *LoadBoneInfoGLTF(cgltf_skin skin, int *boneCount) for (unsigned int i = 0; i < skin.joints_count; i++) { cgltf_node node = *skin.joints[i]; - strncpy(bones[i].name, node.name, sizeof(bones[i].name)); + if (node.name != NULL) strncpy(bones[i].name, node.name, sizeof(bones[i].name)); // Find parent bone index unsigned int parentIndex = -1; From 2609211207419ceab2e00113b4a442bfdab434d3 Mon Sep 17 00:00:00 2001 From: Jeffery Myers Date: Tue, 11 Jun 2024 02:51:49 -0700 Subject: [PATCH 3/7] [SHAPES] Make functions that draw point arrays take them as const (#4051) * Update raylib_api.* by CI * make functions that take a pointer to an array take them as const pointers * Update raylib_api.* by CI * fix comment alignment. --------- Co-authored-by: github-actions[bot] --- parser/output/raylib_api.json | 20 ++++++++++---------- parser/output/raylib_api.lua | 20 ++++++++++---------- parser/output/raylib_api.txt | 20 ++++++++++---------- parser/output/raylib_api.xml | 20 ++++++++++---------- src/raylib.h | 22 +++++++++++----------- src/rmodels.c | 2 +- src/rshapes.c | 18 +++++++++--------- 7 files changed, 61 insertions(+), 61 deletions(-) diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json index 961578e53..1a38c03ab 100644 --- a/parser/output/raylib_api.json +++ b/parser/output/raylib_api.json @@ -5345,7 +5345,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6022,7 +6022,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6041,7 +6041,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6145,7 +6145,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6168,7 +6168,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6191,7 +6191,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6214,7 +6214,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6237,7 +6237,7 @@ "returnType": "void", "params": [ { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -6644,7 +6644,7 @@ "name": "point" }, { - "type": "Vector2 *", + "type": "const Vector2 *", "name": "points" }, { @@ -9613,7 +9613,7 @@ "returnType": "void", "params": [ { - "type": "Vector3 *", + "type": "const Vector3 *", "name": "points" }, { diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua index eb88daab9..3dec7f371 100644 --- a/parser/output/raylib_api.lua +++ b/parser/output/raylib_api.lua @@ -4636,7 +4636,7 @@ return { description = "Draw lines sequence (using gl lines)", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "Color", name = "color"} } @@ -4947,7 +4947,7 @@ return { description = "Draw a triangle fan defined by points (first vertex is the center)", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "Color", name = "color"} } @@ -4957,7 +4957,7 @@ return { description = "Draw a triangle strip defined by points", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "Color", name = "color"} } @@ -5004,7 +5004,7 @@ return { description = "Draw spline: Linear, minimum 2 points", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "float", name = "thick"}, {type = "Color", name = "color"} @@ -5015,7 +5015,7 @@ return { description = "Draw spline: B-Spline, minimum 4 points", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "float", name = "thick"}, {type = "Color", name = "color"} @@ -5026,7 +5026,7 @@ return { description = "Draw spline: Catmull-Rom, minimum 4 points", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "float", name = "thick"}, {type = "Color", name = "color"} @@ -5037,7 +5037,7 @@ return { description = "Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...]", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "float", name = "thick"}, {type = "Color", name = "color"} @@ -5048,7 +5048,7 @@ return { description = "Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...]", returnType = "void", params = { - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "float", name = "thick"}, {type = "Color", name = "color"} @@ -5239,7 +5239,7 @@ return { returnType = "bool", params = { {type = "Vector2", name = "point"}, - {type = "Vector2 *", name = "points"}, + {type = "const Vector2 *", name = "points"}, {type = "int", name = "pointCount"} } }, @@ -6855,7 +6855,7 @@ return { description = "Draw a triangle strip defined by points", returnType = "void", params = { - {type = "Vector3 *", name = "points"}, + {type = "const Vector3 *", name = "points"}, {type = "int", name = "pointCount"}, {type = "Color", name = "color"} } diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt index 66880130e..2a33a995f 100644 --- a/parser/output/raylib_api.txt +++ b/parser/output/raylib_api.txt @@ -2130,7 +2130,7 @@ Function 212: DrawLineStrip() (3 input parameters) Name: DrawLineStrip Return type: void Description: Draw lines sequence (using gl lines) - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) Function 213: DrawLineBezier() (4 input parameters) @@ -2360,14 +2360,14 @@ Function 239: DrawTriangleFan() (3 input parameters) Name: DrawTriangleFan Return type: void Description: Draw a triangle fan defined by points (first vertex is the center) - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) Function 240: DrawTriangleStrip() (3 input parameters) Name: DrawTriangleStrip Return type: void Description: Draw a triangle strip defined by points - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) Function 241: DrawPoly() (5 input parameters) @@ -2402,7 +2402,7 @@ Function 244: DrawSplineLinear() (4 input parameters) Name: DrawSplineLinear Return type: void Description: Draw spline: Linear, minimum 2 points - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: thick (type: float) Param[4]: color (type: Color) @@ -2410,7 +2410,7 @@ Function 245: DrawSplineBasis() (4 input parameters) Name: DrawSplineBasis Return type: void Description: Draw spline: B-Spline, minimum 4 points - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: thick (type: float) Param[4]: color (type: Color) @@ -2418,7 +2418,7 @@ Function 246: DrawSplineCatmullRom() (4 input parameters) Name: DrawSplineCatmullRom Return type: void Description: Draw spline: Catmull-Rom, minimum 4 points - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: thick (type: float) Param[4]: color (type: Color) @@ -2426,7 +2426,7 @@ Function 247: DrawSplineBezierQuadratic() (4 input parameters) Name: DrawSplineBezierQuadratic Return type: void Description: Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: thick (type: float) Param[4]: color (type: Color) @@ -2434,7 +2434,7 @@ Function 248: DrawSplineBezierCubic() (4 input parameters) Name: DrawSplineBezierCubic Return type: void Description: Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] - Param[1]: points (type: Vector2 *) + Param[1]: points (type: const Vector2 *) Param[2]: pointCount (type: int) Param[3]: thick (type: float) Param[4]: color (type: Color) @@ -2574,7 +2574,7 @@ Function 265: CheckCollisionPointPoly() (3 input parameters) Return type: bool Description: Check if point is within a polygon described by array of vertices Param[1]: point (type: Vector2) - Param[2]: points (type: Vector2 *) + Param[2]: points (type: const Vector2 *) Param[3]: pointCount (type: int) Function 266: CheckCollisionLines() (5 input parameters) Name: CheckCollisionLines @@ -3695,7 +3695,7 @@ Function 432: DrawTriangleStrip3D() (3 input parameters) Name: DrawTriangleStrip3D Return type: void Description: Draw a triangle strip defined by points - Param[1]: points (type: Vector3 *) + Param[1]: points (type: const Vector3 *) Param[2]: pointCount (type: int) Param[3]: color (type: Color) Function 433: DrawCube() (5 input parameters) diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml index 0e096d5a2..130f22f75 100644 --- a/parser/output/raylib_api.xml +++ b/parser/output/raylib_api.xml @@ -1317,7 +1317,7 @@ - + @@ -1493,12 +1493,12 @@ - + - + @@ -1525,31 +1525,31 @@ - + - + - + - + - + @@ -1655,7 +1655,7 @@ - + @@ -2440,7 +2440,7 @@ - + diff --git a/src/raylib.h b/src/raylib.h index c61285641..b1da83cb8 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1233,7 +1233,7 @@ 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 @@ -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] @@ -1342,7 +1342,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 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 @@ -1504,7 +1504,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 diff --git a/src/rmodels.c b/src/rmodels.c index 1ee27602d..5a6c6414c 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -226,7 +226,7 @@ void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color) } // Draw a triangle strip defined by points -void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color) +void DrawTriangleStrip3D(const Vector3 *points, int pointCount, Color color) { if (pointCount < 3) return; // Security check diff --git a/src/rshapes.c b/src/rshapes.c index cb85c1c54..058c96863 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -196,7 +196,7 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color) } // Draw lines sequuence (using gl lines) -void DrawLineStrip(Vector2 *points, int pointCount, Color color) +void DrawLineStrip(const Vector2 *points, int pointCount, Color color) { if (pointCount < 2) return; // Security check @@ -1385,7 +1385,7 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color) // Draw a triangle fan defined by points // NOTE: First vertex provided is the center, shared by all triangles // By default, following vertex should be provided in counter-clockwise order -void DrawTriangleFan(Vector2 *points, int pointCount, Color color) +void DrawTriangleFan(const Vector2 *points, int pointCount, Color color) { if (pointCount >= 3) { @@ -1416,7 +1416,7 @@ void DrawTriangleFan(Vector2 *points, int pointCount, Color color) // Draw a triangle strip defined by points // NOTE: Every new vertex connects with previous two -void DrawTriangleStrip(Vector2 *points, int pointCount, Color color) +void DrawTriangleStrip(const Vector2 *points, int pointCount, Color color) { if (pointCount >= 3) { @@ -1570,7 +1570,7 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl //---------------------------------------------------------------------------------- // Draw spline: linear, minimum 2 points -void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color) +void DrawSplineLinear(const Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 2) return; @@ -1687,7 +1687,7 @@ void DrawSplineLinear(Vector2 *points, int pointCount, float thick, Color color) } // Draw spline: B-Spline, minimum 4 points -void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color) +void DrawSplineBasis(const Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 4) return; @@ -1763,7 +1763,7 @@ void DrawSplineBasis(Vector2 *points, int pointCount, float thick, Color color) } // Draw spline: Catmull-Rom, minimum 4 points -void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color color) +void DrawSplineCatmullRom(const Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 4) return; @@ -1829,7 +1829,7 @@ void DrawSplineCatmullRom(Vector2 *points, int pointCount, float thick, Color co } // Draw spline: Quadratic Bezier, minimum 3 points (1 control point): [p1, c2, p3, c4...] -void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Color color) +void DrawSplineBezierQuadratic(const Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 3) return; @@ -1840,7 +1840,7 @@ void DrawSplineBezierQuadratic(Vector2 *points, int pointCount, float thick, Col } // Draw spline: Cubic Bezier, minimum 4 points (2 control points): [p1, c2, c3, p4, c5, c6...] -void DrawSplineBezierCubic(Vector2 *points, int pointCount, float thick, Color color) +void DrawSplineBezierCubic(const Vector2 *points, int pointCount, float thick, Color color) { if (pointCount < 4) return; @@ -2195,7 +2195,7 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 // Check if point is within a polygon described by array of vertices // NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php -bool CheckCollisionPointPoly(Vector2 point, Vector2 *points, int pointCount) +bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount) { bool inside = false; From fffae1a975dbfff8e6c8ee37c989f5256debc90f Mon Sep 17 00:00:00 2001 From: Karl Zylinski Date: Tue, 11 Jun 2024 20:55:13 +0200 Subject: [PATCH 4/7] Fix fragPosition using wrong matrix in lighting_instancing.vs (#4056) fragPosition was multiplied by mvp*instanceTransform, but it should only be multiplied by instanceTransform. Compare to lighting.vs, there we only use mvp for gl_Position, but matModel for the fragPosition. --- .../resources/shaders/glsl330/lighting_instancing.vs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs b/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs index 6775a2eb6..3e4da1e28 100644 --- a/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs +++ b/examples/shaders/resources/shaders/glsl330/lighting_instancing.vs @@ -22,15 +22,12 @@ out vec3 fragNormal; void main() { - // Compute MVP for current instance - mat4 mvpi = mvp*instanceTransform; - // Send vertex attributes to fragment shader - fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0)); + fragPosition = vec3(instanceTransform*vec4(vertexPosition, 1.0)); fragTexCoord = vertexTexCoord; //fragColor = vertexColor; fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0))); - // Calculate final vertex position - gl_Position = mvpi*vec4(vertexPosition, 1.0); + // Calculate final vertex position, note that we multiply mvp by instanceTransform + gl_Position = mvp*instanceTransform*vec4(vertexPosition, 1.0); } From 33c598123c4b6ef78ff2ac3dcc1094da4dd6efef Mon Sep 17 00:00:00 2001 From: Alexey Kutepov Date: Wed, 12 Jun 2024 16:42:41 +0700 Subject: [PATCH 5/7] [raudio] Add 24 bits samples support for FLAC format (#4058) Similarly to how it's done for WAV format, by forcing the conversion to s16 on UpdateMusicStream(). --- src/raudio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/raudio.c b/src/raudio.c index c6bd00165..177bdb5aa 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -1428,7 +1428,9 @@ Music LoadMusicStream(const char *fileName) { music.ctxType = MUSIC_AUDIO_FLAC; music.ctxData = ctxFlac; - music.stream = LoadAudioStream(ctxFlac->sampleRate, ctxFlac->bitsPerSample, ctxFlac->channels); + int sampleSize = ctxFlac->bitsPerSample; + if (ctxFlac->bitsPerSample == 24) sampleSize = 16; // Forcing conversion to s16 on UpdateMusicStream() + music.stream = LoadAudioStream(ctxFlac->sampleRate, sampleSize, ctxFlac->channels); music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount; music.looping = true; // Looping enabled by default musicLoaded = true; From 735c0160b5cc5fa2a2cdd60843d61afa25551991 Mon Sep 17 00:00:00 2001 From: TokyoSU <77746747+TokyoSU@users.noreply.github.com> Date: Wed, 12 Jun 2024 19:36:25 +0200 Subject: [PATCH 6/7] Update rlgl.h (#4059) - The function rlGetMatrixProjectionStereo and rlGetMatrixViewOffsetStereo have RLAPI for the function declaration and cause error when compiling using RLGL_IMPLEMENTATION. --- src/rlgl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index 2f6a03b8a..530e44efc 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -4518,7 +4518,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 +4528,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) From df849d2fb0c7df6a818f2f79dd8343565dd1274c Mon Sep 17 00:00:00 2001 From: listeria <56203103+ListeriaM@users.noreply.github.com> Date: Thu, 13 Jun 2024 11:05:22 -0300 Subject: [PATCH 7/7] [raudio] fix mapping of wave data in LoadWaveSamples() (#4062) Co-authored-by: Listeria monocytogenes --- src/raudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/raudio.c b/src/raudio.c index 177bdb5aa..623984e1d 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -1304,8 +1304,8 @@ float *LoadWaveSamples(Wave wave) for (unsigned int i = 0; i < wave.frameCount*wave.channels; i++) { - if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 127)/256.0f; - else if (wave.sampleSize == 16) samples[i] = (float)(((short *)wave.data)[i])/32767.0f; + if (wave.sampleSize == 8) samples[i] = (float)(((unsigned char *)wave.data)[i] - 128)/128.0f; + else if (wave.sampleSize == 16) samples[i] = (float)(((short *)wave.data)[i])/32768.0f; else if (wave.sampleSize == 32) samples[i] = ((float *)wave.data)[i]; }