Skip to content

Commit acf211a

Browse files
Brian-EDBrian-Eraysan5ubkpashn-dot-dev
authored
general syntax fixes (#3319)
* Prettified a comment * fixed broken indentation caused by another commit. the commit renamed a bool to int and broke indentation: 233cf39 * Changed 0.001 and 0.00001 to EPSILON This commit is untested. I don't know what consequences this has. Since the commits that added these numbers were before epsilon was added, I have assumed that epsilon could replace them. * Prettied up indentation in a few places * removed spacing around *, standardizing it. * I may have gotten overboard with indentation * removed a few useless parenthesis * Added fortran-raylib * Fix examples/others/rlgl_standalone.c compilation issue (#3242) * Update BINDINGS.md * Ignore unused return value of GetCodepointNext in GetCodepointCount (#3241) * Ignore unused return value of GetCodepointNext in GetCodepointCount Removes the last warning from non-external libraries when compiling with the default build configuration on x64 Linux. * Remove unnecessary void cast in GetCodepointCount * Fix #3246 * Revert "Fix #3246" This reverts commit e4dcbd5. * Fix text_unicode.c example crashing (#3250) * Fix text_unicode.c example crashing * Adjust the text_unicode.c example crashing fix * tweaks * add build.zig options for individual modules (#3254) * Add `IsKeyPressedRepeat` (desktop only) (#3245) Since the key pressed are handle by comparing current vs previous state (ie frame), a special way is needed to handle key repeats. * Reviewed `IsKeyPressedRepeat()` #3248 * Update rcore.c (#3255) * Match CMakeOptions.txt options default values (#3258) * Fix SetClipboardText for web (#3257) * [Image] Validate that ImageDrawRectangleRec is drawing entirely inside the image (#3264) * Add a function to clone a sound and share data with another sound. * rename items based on feedback * PR Feedback, use custom unload for sound alias, not variant of normal sound unloading * sound_multi example * Validate that image rect drawing is inside the image so we don't overflow a buffer * remove files that should not have been added. * remove changes that should not have been * revert * adsfasdfsdfsdf * Add Vector3 Projecting and Rejection to Raymath (#3263) * Update raymath.h * formatting * [Feature] IsKey... safety checks and more (#3256) * [Feature] Add GetKeyRepeat * Update rcore.c * Simpler design, only one repeat per frame * Update config.h * Update rcore.c * Add KEYBOARD_KEYS_MASK * Update config.h * reversions * Update rcore.c * Update rcore.c * change docs * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Update raylib.h * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Update rcore.c * Fix bug where default shaders was not linking. (#3261) * Formating review * Add missing cmake options (#3267) * Fix CMake extraneous -lglfw (#3266) Closes #3265. The problem: LIBS_PRIVATE is a list of library names (used by pkg-config), but the shared library of the same name doesn't always exist. * Fix example/models/models_loading_gltf.c controls (#3268) * Fix example/models/models_loading_m3d.c controls (#3269) * Remove e from secondes (#3270) * Fix example/audio/audio_module_player.c help instructions and small bug (#3272) * Fix example/audio/audio_module_player.c help instructions and small bug * Update example/audio/audio_module_player.png screenshot * Use type name instead of valid specifier long long --> long long int * REVIEWED: `GetFileLength()`, added comment #3262 * Update examples/models/models_loading_gltf.png;m3d.png screenshots (#3273) * Remove a duplicated screenshot and add missing one (#3275) * Add examples/shaders/shaders_lightmap.c to Makefiles (#3276) * Fix examples/others/easings_testbed.c help instructions and small tweak (#3277) * Fix examples/shaders/shaders_texture_outline.c help instructions (#3278) * Fix examples/shapes/shapes_collision_area.c help instructions (#3279) * RENAMED: LoadFont*() parameter names for consistency and coherence * Fix uninitialized thread-locals in stbi #3282 (#3283) * REVIEWED: Added `SetTextLineSpacing()` to multiline examples * REVIEWED: Data size type consistency between functions #3168 * Some tweaks * Use internal default allocators, instead of user-exposed ones * Added rudimentary SVG support. (#2738) * Added rudimentary SVG support. Added 2 functions ImageLoadSvg and ImageLoadSvgWithSize. * Added an example on how to use ImageLoadSvgWithSize and adjusted Makefiles accordingly. * Added actual correct example file. * Reviewed the code to keep the raylib coding conventions in mind. Moved the LoadImageSvg() code into LoadImage() guarded by SUPPORT_FILEFORMAT_SVG. Renamed LoadImageSvgWithSize() to LoadImageSvg(). Added a LoadImageSvgFromString() function to parse the loaded SVG into an actual image. This does the bulk of the work. * Fixed typo. --------- Co-authored-by: Ray <raysan5@gmail.com> * REVIEWED: `LoadImageSvg()` * REVIEWED: `LoadImageSvg()` * Add SUPPORT_FILEFORMAT_SVG to cmake (#3284) * Fix examples/textures/textures_fog_of_war.c help instructions (#3285) * Fix examples/textures/textures_image_rotate.c help instructions (#3286) * Update rtextures.c * Fix #3247 * Update config.h * Fix #3293 * Disable UBSAN in zig builds. (#3292) Zig debug builds automatically enable ubsan. As the fix for #1891 had to be reverted, debug builds using zig will crash like so: ``` Illegal instruction at address 0x3237d2 raylib/src/rlgl.h:3690:91: 0x3237d2 in rlDrawVertexArrayElements (/home/rcorre/src/raylib-zig-template/raylib/src/rcore.c) glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, (const unsigned short *)buffer + offset); ``` This disables UBSAN when using zig to build raylib. * Update README.md (#3290) specially -> especially * Update cmake SUPPORT_FILEFORMAT_SVG default value (#3291) * Mouse offset and scaling must be considered also on web! * Update rcore.c * Update Makefile : clean raygui.c & physac.c (#3296) * Remove PLATFORM_RPI (#3232) * Remove PLATFORM_RPI * remove build artifacts --------- Co-authored-by: MichaelFiber <michael@cubeofb.org> Co-authored-by: Ray <raysan5@gmail.com> * Review to avoid UBSAN complaining #1891 * added raylib-raku to bindings (#3299) * examples: core: adds 2D camera two player split screen (#3298) * Reviewed examples for consistency * Update rtext.c * Some code restructuring for input functions, consistency review * Remove unneeded #if (#3301) Co-authored-by: MichaelFiber <michael@cubeofb.org> * Revert "Disable UBSAN in zig builds. (#3292)" (#3303) This reverts commit a316f9e. Issue #1891 was fixed again, so this is no longer needed. * rtextures: Fix ImageDraw() source clipping when drawing beyond top left (#3306) * REVIEWED: `TextToPascal()` issue when first char is uppercase * Implement FLAG_WINDOW_RESIZABLE for web (#3305) Fixes #3231 * Update BINDINGS.md (#3307) Fix Kaylib binding. Reroute to a new repository. Binding renamed. * Update webassembly.yml * Add claw-raylib to BINDINGS.md (#3310) * Add SetWindowMaxSize for desktop and web (#3309) * Add SetWindowMaxSize for desktop and web * Remove SizeInt and respective adjustments * Update rtextures.c * Reviewed parameters for consistency * Rename windowM* to screenM* (#3312) * Update BINDINGS.md (#3317) Update TurboRaylib bindings * Update rmodels.c * Update BINDINGS.md with vaiorabbit/raylib-bindings (#3318) * fixed spelling mistake * put back parenthesis * reverted major allignment changes * reverted parser output changes * reverted one more indentation change --------- Co-authored-by: Brian-E <brian@intra.fo> Co-authored-by: Ray <raysan5@gmail.com> Co-authored-by: ubkp <118854183+ubkp@users.noreply.github.com> Co-authored-by: ashn <60763262+ashn-dot-dev@users.noreply.github.com> Co-authored-by: actondev (Christos) <chris.actondev@gmail.com> Co-authored-by: vitopigno <103512727+VitusVeit@users.noreply.github.com> Co-authored-by: Asdqwe <asdqwe@asdqwe.com> Co-authored-by: Jeffery Myers <jeffm2501@gmail.com> Co-authored-by: Ethan Simpson <ethansimpson@xtra.co.nz> Co-authored-by: Nickolas McDonald <43690021+n77y@users.noreply.github.com> Co-authored-by: Branimir Ričko <rickobranimir@gmail.com> Co-authored-by: iacore <74560659+iacore@users.noreply.github.com> Co-authored-by: Ethan Conneely <Econn50@outlook.com> Co-authored-by: Johannes Barthelmes <615914+jbarthelmes@users.noreply.github.com> Co-authored-by: bXi <bluepunk@gmail.com> Co-authored-by: Ryan Roden-Corrent <ryan@rcorre.net> Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com> Co-authored-by: SuperUserNameMan <yoann@terminajones.com> Co-authored-by: MichaelFiber <42419558+michaelfiber@users.noreply.github.com> Co-authored-by: MichaelFiber <michael@cubeofb.org> Co-authored-by: Dan Vu <danvu.hustle@gmail.com> Co-authored-by: Gabriel dos Santos Sanches <gabrielssanches@gmail.com> Co-authored-by: Rob Loach <robloach@gmail.com> Co-authored-by: Peter0x44 <peter0x44@disroot.org> Co-authored-by: Kenta <106167071+Its-Kenta@users.noreply.github.com> Co-authored-by: bohonghuang <1281299809@qq.com> Co-authored-by: turborium <45082001+turborium@users.noreply.github.com> Co-authored-by: Wilson Silva <wilson.dsigns@gmail.com>
1 parent 33cc18e commit acf211a

File tree

2 files changed

+34
-35
lines changed

2 files changed

+34
-35
lines changed

src/raylib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filenam
10931093
RLAPI const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
10941094
RLAPI const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
10951095
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
1096-
RLAPI const char *GetApplicationDirectory(void); // Get the directory if the running application (uses static string)
1096+
RLAPI const char *GetApplicationDirectory(void); // Get the directory of the running application (uses static string)
10971097
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, return true on success
10981098
RLAPI bool IsPathFile(const char *path); // Check if a given path is a file or a directory
10991099
RLAPI FilePathList LoadDirectoryFiles(const char *dirPath); // Load directory filepaths

src/raymath.h

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ RMAPI Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle)
820820
Vector3 result = v;
821821

822822
// Vector3Normalize(axis);
823-
float length = sqrtf(axis.x * axis.x + axis.y * axis.y + axis.z * axis.z);
823+
float length = sqrtf(axis.x*axis.x + axis.y*axis.y + axis.z*axis.z);
824824
if (length == 0.0f) length = 1.0f;
825825
float ilength = 1.0f / length;
826826
axis.x *= ilength;
@@ -829,19 +829,19 @@ RMAPI Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle)
829829

830830
angle /= 2.0f;
831831
float a = sinf(angle);
832-
float b = axis.x * a;
833-
float c = axis.y * a;
834-
float d = axis.z * a;
832+
float b = axis.x*a;
833+
float c = axis.y*a;
834+
float d = axis.z*a;
835835
a = cosf(angle);
836836
Vector3 w = { b, c, d };
837837

838838
// Vector3CrossProduct(w, v)
839-
Vector3 wv = { w.y * v.z - w.z * v.y, w.z * v.x - w.x * v.z, w.x * v.y - w.y * v.x };
839+
Vector3 wv = { w.y*v.z - w.z*v.y, w.z*v.x - w.x*v.z, w.x*v.y - w.y*v.x };
840840

841841
// Vector3CrossProduct(w, wv)
842-
Vector3 wwv = { w.y * wv.z - w.z * wv.y, w.z * wv.x - w.x * wv.z, w.x * wv.y - w.y * wv.x };
842+
Vector3 wwv = { w.y*wv.z - w.z*wv.y, w.z*wv.x - w.x*wv.z, w.x*wv.y - w.y*wv.x };
843843

844-
// Vector3Scale(wv, 2 * a)
844+
// Vector3Scale(wv, 2*a)
845845
a *= 2;
846846
wv.x *= a;
847847
wv.y *= a;
@@ -1091,18 +1091,17 @@ RMAPI Vector3 Vector3ClampValue(Vector3 v, float min, float max)
10911091
RMAPI int Vector3Equals(Vector3 p, Vector3 q)
10921092
{
10931093
int result = ((fabsf(p.x - q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) &&
1094-
((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) &&
1095-
((fabsf(p.z - q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z)))));
1094+
((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) &&
1095+
((fabsf(p.z - q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z)))));
10961096

10971097
return result;
10981098
}
10991099

1100-
// Compute the direction of a refracted ray where v specifies the
1101-
// normalized direction of the incoming ray, n specifies the
1102-
// normalized normal vector of the interface of two optical media,
1103-
// and r specifies the ratio of the refractive index of the medium
1104-
// from where the ray comes to the refractive index of the medium
1105-
// on the other side of the surface
1100+
// Compute the direction of a refracted ray
1101+
// v: normalized direction of the incoming ray
1102+
// n: normalized normal vector of the interface of two optical media
1103+
// r: ratio of the refractive index of the medium from where the ray comes
1104+
// to the refractive index of the medium on the other side of the surface
11061105
RMAPI Vector3 Vector3Refract(Vector3 v, Vector3 n, float r)
11071106
{
11081107
Vector3 result = { 0 };
@@ -1862,7 +1861,7 @@ RMAPI Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount)
18621861
float halfTheta = acosf(cosHalfTheta);
18631862
float sinHalfTheta = sqrtf(1.0f - cosHalfTheta*cosHalfTheta);
18641863

1865-
if (fabsf(sinHalfTheta) < 0.001f)
1864+
if (fabsf(sinHalfTheta) < EPSILON)
18661865
{
18671866
result.x = (q1.x*0.5f + q2.x*0.5f);
18681867
result.y = (q1.y*0.5f + q2.y*0.5f);
@@ -1917,9 +1916,9 @@ RMAPI Quaternion QuaternionFromMatrix(Matrix mat)
19171916
{
19181917
Quaternion result = { 0 };
19191918

1920-
float fourWSquaredMinus1 = mat.m0 + mat.m5 + mat.m10;
1921-
float fourXSquaredMinus1 = mat.m0 - mat.m5 - mat.m10;
1922-
float fourYSquaredMinus1 = mat.m5 - mat.m0 - mat.m10;
1919+
float fourWSquaredMinus1 = mat.m0 + mat.m5 + mat.m10;
1920+
float fourXSquaredMinus1 = mat.m0 - mat.m5 - mat.m10;
1921+
float fourYSquaredMinus1 = mat.m5 - mat.m0 - mat.m10;
19231922
float fourZSquaredMinus1 = mat.m10 - mat.m0 - mat.m5;
19241923

19251924
int biggestIndex = 0;
@@ -1942,34 +1941,34 @@ RMAPI Quaternion QuaternionFromMatrix(Matrix mat)
19421941
biggestIndex = 3;
19431942
}
19441943

1945-
float biggestVal = sqrtf(fourBiggestSquaredMinus1 + 1.0f) * 0.5f;
1944+
float biggestVal = sqrtf(fourBiggestSquaredMinus1 + 1.0f)*0.5f;
19461945
float mult = 0.25f / biggestVal;
19471946

19481947
switch (biggestIndex)
19491948
{
19501949
case 0:
19511950
result.w = biggestVal;
1952-
result.x = (mat.m6 - mat.m9) * mult;
1953-
result.y = (mat.m8 - mat.m2) * mult;
1954-
result.z = (mat.m1 - mat.m4) * mult;
1951+
result.x = (mat.m6 - mat.m9)*mult;
1952+
result.y = (mat.m8 - mat.m2)*mult;
1953+
result.z = (mat.m1 - mat.m4)*mult;
19551954
break;
19561955
case 1:
19571956
result.x = biggestVal;
1958-
result.w = (mat.m6 - mat.m9) * mult;
1959-
result.y = (mat.m1 + mat.m4) * mult;
1960-
result.z = (mat.m8 + mat.m2) * mult;
1957+
result.w = (mat.m6 - mat.m9)*mult;
1958+
result.y = (mat.m1 + mat.m4)*mult;
1959+
result.z = (mat.m8 + mat.m2)*mult;
19611960
break;
19621961
case 2:
19631962
result.y = biggestVal;
1964-
result.w = (mat.m8 - mat.m2) * mult;
1965-
result.x = (mat.m1 + mat.m4) * mult;
1966-
result.z = (mat.m6 + mat.m9) * mult;
1963+
result.w = (mat.m8 - mat.m2)*mult;
1964+
result.x = (mat.m1 + mat.m4)*mult;
1965+
result.z = (mat.m6 + mat.m9)*mult;
19671966
break;
19681967
case 3:
19691968
result.z = biggestVal;
1970-
result.w = (mat.m1 - mat.m4) * mult;
1971-
result.x = (mat.m8 + mat.m2) * mult;
1972-
result.y = (mat.m6 + mat.m9) * mult;
1969+
result.w = (mat.m1 - mat.m4)*mult;
1970+
result.x = (mat.m8 + mat.m2)*mult;
1971+
result.y = (mat.m6 + mat.m9)*mult;
19731972
break;
19741973
}
19751974

@@ -2075,7 +2074,7 @@ RMAPI void QuaternionToAxisAngle(Quaternion q, Vector3 *outAxis, float *outAngle
20752074
float resAngle = 2.0f*acosf(q.w);
20762075
float den = sqrtf(1.0f - q.w*q.w);
20772076

2078-
if (den > 0.0001f)
2077+
if (den > EPSILON)
20792078
{
20802079
resAxis.x = q.x/den;
20812080
resAxis.y = q.y/den;
@@ -2158,7 +2157,7 @@ RMAPI int QuaternionEquals(Quaternion p, Quaternion q)
21582157
((fabsf(p.y - q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) &&
21592158
((fabsf(p.z - q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z))))) &&
21602159
((fabsf(p.w - q.w)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w)))))) ||
2161-
(((fabsf(p.x + q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) &&
2160+
(((fabsf(p.x + q.x)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.x), fabsf(q.x))))) &&
21622161
((fabsf(p.y + q.y)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.y), fabsf(q.y))))) &&
21632162
((fabsf(p.z + q.z)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.z), fabsf(q.z))))) &&
21642163
((fabsf(p.w + q.w)) <= (EPSILON*fmaxf(1.0f, fmaxf(fabsf(p.w), fabsf(q.w))))));

0 commit comments

Comments
 (0)