1
0
Fork 0
Commit Graph

1129 Commits

Author SHA1 Message Date
aaronp64 1089f61868 Fix RandomPCG::random(int, int) overflow bug
- Use int64_t for subtraction before converting to uint32_t
- Don't add one to uint32_t max value for rand() bounds
2025-05-06 17:54:12 -04:00
Thaddeus Crews 01fc9aee6c
Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
Thaddeus Crews 3947cbe3b2
Merge pull request #104386 from Repiteo/core/cpp-math
Core: Replace C math headers with C++ equivalents
2025-04-27 19:21:22 -05:00
Lukas Tenbrink 7c37188ca1 Smoke test: In collections, log an error if `reserve()` is called with a number smaller than the current size. Don't log an error if it is called with a number smaller than the current capacity. 2025-04-23 16:47:47 +02:00
Thaddeus Crews ad40939b6f
Core: Replace C math headers with C++ equivalents
- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
2025-04-16 15:49:02 -05:00
Marc Gilleron 5e6df6a196 Use Math::abs to avoid ambiguity with integer abs 2025-04-16 20:41:36 +02:00
Thaddeus Crews 29dcead192
Merge pull request #105394 from Zylann/quaternion_abs
Use Math::abs to avoid ambiguity with integer abs
2025-04-15 12:28:41 -05:00
Thaddeus Crews 53608e3376
Merge pull request #104239 from Ivorforce/optimize-undenormalize
Optimize reverb by removing stray `volatile` from the `undenormalize` function signature.
2025-04-14 19:39:46 -05:00
Marc Gilleron 40b5468c6d Use Math::abs to avoid ambiguity with integer abs 2025-04-14 23:54:07 +02:00
Thaddeus Crews 94282d88f9
Core: Use `Math` namespace for constants 2025-04-10 16:29:30 -05:00
MewPurPur 45b1071e7c Optimize Color.html() 2025-04-05 14:00:30 +03:00
Thaddeus Crews 207a2b6472
Core: Integrate warning suppression macro helpers 2025-04-03 10:13:46 -05:00
Thaddeus Crews 9f222d500d
Merge pull request #104375 from YYF233333/is_empty
Replace `size() == 0` with `is_empty()`
2025-04-02 07:37:31 -05:00
Yufeng Ying 4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +08:00
smix8 f2197a1013 Expose TriangleMesh api functions wrapped for scripting
Adds script wrapped TriangleMesh api functions to create and query the triangle BVH tree.
2025-04-02 09:52:35 +02:00
Thaddeus Crews 21956851ac
Merge pull request #104885 from MewPurPur/html-validation-optimization
Optimize Color HTML validation
2025-04-01 19:53:32 -05:00
MewPurPur 250cc58388 Optimize HTML color validation 2025-04-01 21:26:21 +03:00
Aaron Franke c1acc839a8
Directly use segment points in Geometry2D/3D function parameters 2025-03-30 16:25:59 -07:00
Thaddeus Crews 3b1a481f13
Merge pull request #97843 from detomon/optimize-a-star-grid-2d-solve
Reduce allocations when solving path in `AStarGrid2D`
2025-03-30 09:06:02 -05:00
Zae e7f7823236 Fix reversed hex order in `Color::to_html` 2025-03-29 06:06:09 +08:00
Rémi Verschelde 10799d0b44
Merge pull request #104389 from Ivorforce/color-string-append
Optimize `Color::to_html` by allocating less.
2025-03-28 14:32:54 +01:00
Yyf2333 22b5ec17fb Using iterator pattern instead of List::Element *.
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2025-03-28 13:29:15 +08:00
Thaddeus Crews 2eec0fc526
Merge pull request #94441 from Repiteo/core/math-namespace
Core: Convert `Math` class to namespace
2025-03-23 19:03:55 -05:00
Thaddeus Crews f09ee0171a
Style: Begin integrating simple `.clangd` fixes 2025-03-22 13:24:35 -05:00
Thaddeus Crews 581d675eeb
Core: Convert `Math` class to namespace 2025-03-21 10:29:18 -05:00
Lukas Tenbrink 143f8e933e Optimize `Color::to_html` by allocating less. 2025-03-20 13:42:03 +01:00
kobewi 10f6c01b9c Remove ABS in favor of Math::abs 2025-03-19 13:52:40 +01:00
Thaddeus Crews 85258ec1a5
Merge pull request #102662 from groud/chunk_tilemap_physics
Chunk tilemap physics
2025-03-17 16:03:29 -05:00
Thaddeus Crews 06f0c6369e
Merge pull request #104273 from Ivorforce/fabs-absf
Simplify and optimize `Math::absf` implementation to use `::fabs` and `::fabsf`.
2025-03-17 16:03:24 -05:00
Thaddeus Crews ea62170dac
Core: Add `constexpr` constructors/operators to math structs
• Begin integrating `constexpr` on math tests; use `static_assert` where appropriate
2025-03-17 12:15:31 -05:00
Lukas Tenbrink 24c11dea16 Simplify and optimize `absf` implementation to use `std::fabs`. 2025-03-17 14:50:15 +01:00
Lukas Tenbrink a9745aac5c Optimize reverb by removing stray `volatile` from the `undenormalize` function signature. 2025-03-16 15:50:50 +01:00
Aaron Franke ced61da848
Add missing Projection constructor with 16 real_t values 2025-03-14 02:57:19 -07:00
Thaddeus Crews 74907876d3
Merge pull request #103759 from Ivorforce/zero-constructible
Optimize `Array.resize` by using `memset` (through new `is_zero_constructible` type trait)
2025-03-12 10:31:55 -05:00
Lukas Tenbrink 75bc471965 Add `is_zero_constructible` to denote if a type can be semi-trivially constructed with all 0 bytes.
Optimize `CowData` and `LocalVector` resize for zero constructible types.
Mark several compatible types as `is_zero_constructible`.
2025-03-12 09:49:24 +01:00
Michael Alexsander 5c66129e62
Allow to select multiple remote nodes at runtime 2025-03-11 12:35:41 -03:00
Thaddeus Crews a13067e61f
Merge pull request #97553 from AThousandShips/semantic_equal
[Core] Add `is_same` to types that have float components
2025-03-10 10:01:05 -05:00
A Thousand Ships 331a43a9d8
Add `String::remove_char(s)` methods for performance and convenience 2025-03-10 13:19:28 +01:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 -06:00
Thaddeus Crews c937b6d180
Merge pull request #102419 from Ivorforce/std-size
Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase.
2025-03-07 15:12:25 -06:00
Thaddeus Crews 3d816853e5
Merge pull request #100209 from Flarkk/simplify_fix_projection
Simplify and fix `Projection`'s getter functions
2025-03-06 16:36:19 -06:00
Florent Guiocheau 1d416fc2ba Simplify and fix `Projection`'s getter functions 2025-03-06 16:48:01 +01:00
Gilles Roudière 4765bc883c Chunk tilemap physics 2025-02-11 16:28:58 +01:00
Lukas Tenbrink e34f1f504c Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase. 2025-02-07 14:57:48 +01:00
Pāvels Nadtočajevs b50d9742c2 Fix `is_valid_float`, `Variant` parser, `Expression` parser, script highlighter, and `TextServer` not handing capital E in scientific notation. 2025-02-05 18:39:40 +02:00
bruvzg 3be46a69c4 Fix uppercase B and X parsing in the integer literals. 2025-02-05 16:02:06 +02:00
A Thousand Ships e825085978
[Core] Add `is_same` to types that have float components
Compares `NaN` as equal.

Added to:
* `AABB`
* `Basis`
* `Color`
* `Plane`
* `Projection`
* `Quaternion`
* `Rect2`
* `Transform2D`
* `Transform3D`
* `Vector2`
* `Vector3`
* `Vector4`

And added as a method in `Math`
2025-02-03 19:25:50 +01:00
Adam d56cbd374b Fix `Basis::get_euler` incorrectly simplifying rotations in some cases. 2025-01-29 16:13:29 -06:00
Silc Lizard (Tokage) Renew 27e23280c5 Fix Quaternion arc constructor to check dot & Add test for same vec3s 2025-01-20 18:16:53 +09:00
Aarni Koskela f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00