summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
2020-12-09Merge pull request #44128 from KoBeWi/🧹Rémi Verschelde
Cleanup unused engine code
2020-12-09Cleanup unused engine codeTomasz Chabora
2020-12-09Merge pull request #44199 from bruvzg/pvs_fixes_1Rémi Verschelde
PVS-Studio static analyzer fixes
2020-12-09Static analyzer fixes:bruvzg
Removes unused code in OS. Fixes return types. Fixes few typos.
2020-12-08Merge pull request #44089 from Xrayez/rng-stateRémi Verschelde
Add ability to restore `RandomNumberGenerator` state
2020-12-07Add ability to restore `RandomNumberGenerator` stateAndrii Doroshenko (Xrayez)
- added `state` as a property to restore internal state of RNG; - `get_seed()` returns last seed used to initialize the state rather than the current state. Co-authored-by: MidZik <matt.idzik1@gmail.com>
2020-12-07Improve argument names for core typesAaron Franke
2020-11-26[Complex Text Layouts] Refactor Font class, default themes and controls to ↵bruvzg
use Text Server interface. Implement interface mirroring. Add TextLine and TextParagraph classes. Handle UTF-16 input on macOS and Windows.
2020-11-23Initialize class/struct variables with default values in core/ and drivers/Rafał Mikrut
2020-11-16Remove empty lines around braces with the formatting scriptAaron Franke
2020-11-11Refactor variant built-in methods yet again.reduz
* Using C-style function pointers now, InternalMethod is gone. * This ensures much better performance in typed code. * Renamed builtin_funcs to utility_funcs, to avoid naming confusion
2020-11-11Merge pull request #43372 from aaronfranke/clamp-fixesRémi Verschelde
Minor clamp and float fixes
2020-11-10Create Variant built-in functions.reduz
-Moved Expression to use this, removed its own. -Eventually GDScript/VisualScript/GDNative need to be moved to this. -Given the JSON functions were hacked-in, removed them and created a new JSONParser class -Made sure these functions appear properly in documentation, since they will be removed from GDScript
2020-11-10Minor clamp and float fixesAaron Franke
2020-11-09Variant: Sync docs with new constructors, fixups after #43403Rémi Verschelde
Change DocData comparators for MethodDoc and ArgumentDoc to get a better ordering of constructors.
2020-11-09Merge pull request #43404 from akien-mga/color-fix-clamp-uint32_t-warningRémi Verschelde
Color: Fix -Wtype-limits GCC warning after refactoring
2020-11-09Color: Fix -Wtype-limits GCC warning after refactoringRémi Verschelde
Warning from GCC 10.2.0 with `warnings=extra`: ``` ./core/math/color.h: In member function 'int32_t Color::get_r8() const': ./core/typedefs.h:107:42: error: comparison of unsigned expression in '< 0' is always false [-Werror=type-limits] 107 | #define CLAMP(m_a, m_min, m_max) (((m_a) < (m_min)) ? (m_min) : (((m_a) > (m_max)) ? m_max : m_a)) | ~~~~~~^~~~~~~~~ ./core/math/color.h:201:49: note: in expansion of macro 'CLAMP' 201 | _FORCE_INLINE_ int32_t get_r8() const { return CLAMP(uint32_t(r * 255.0), 0, 255); } | ^~~~~ ``` Also some code consistency changes while at it.
2020-11-09Refactored variant constructor logicreduz
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-11-07Refactored variant setters/gettersreduz
-Discern between named, indexed and keyed -Get direct access to functions for typed GDScript and GDNative bindings -Small changes to some classes in order to work with the new setget binder
2020-11-06Refactored Variant Operators.reduz
-Using classes to call and a table -For typed code (GDS or GDNative), can obtain functions to call prevalidated or ptr.
2020-11-06Exposed randi_range to global funcs + renamed rand_range to randf_rangeYuri Roubinsky
2020-11-05Remove unused `PHI` define in math funcsAndrii Doroshenko (Xrayez)
2020-11-05doc: Override default value for RandomNumberGenerator.seedRémi Verschelde
It's non-deterministic so it's better to show a fixed value like 0 instead of having it potentially change whenever `randomize()` is called. Fixes #43317.
2020-11-04doc: Sync classref with current source + fixup some bindingsRémi Verschelde
Includes various changes triggered by the refactoring of method bindings.
2020-11-04Implement DirectionalLight2Dreduz
Also separated Light2D in PointLight2D and DirectionalLight2D. Used PointLight2D because its more of a point, and it does not work the same as OmniLight (as shape depends on texture). Added a few utility methods to Rect2D I needed.
2020-10-29Fix biased output of randi_rangeYuri Roubinsky
2020-10-27Make `randbase` member protected in `RandomNumberGenerator`Andrii Doroshenko (Xrayez)
Allows to extend `RandomNumberGenerator` via C++ modules.
2020-10-14Refactored binding system for core typesreduz
Moved to a system using variadic templates, shared with CallableBind. New code is cleaner, faster and allows for much better optimization of core type functions from GDScript and GDNative. Added Variant::InternalMethod function for direct call access.
2020-10-09Merge pull request #42660 from Chaosus/remove_get_uv84_normal_bitRémi Verschelde
Removed unused method Geometry3D.get_uv84_normal_bit
2020-10-09Implement GPU Particle Collisionsreduz
-Sphere Attractor -Box Attractor -Vector Field -Sphere Collider -Box Collider -Baked SDF Collider -Heightmap Collider
2020-10-09Removed unused method Geometry.get_uv84_normal_bitYuri Roubinsky
2020-09-28Merge pull request #42133 from vnen/variant-op-consistencyRémi Verschelde
Allow commutative multiplication in Variant
2020-09-23Remove redundant is_equal_approx_ratio methodAaron Franke
is_equal_approx is able to handle values of any size, and is_equal_approx_ratio is no longer used in any exposed APIs, so we don't need is_equal_approx_ratio anymore. Also, add #ifdef MATH_CHECKS for a method that is only used when MATH_CHECKS is defined.
2020-09-23Change Basis is_equal_approx to use instance methodAaron Franke
2020-09-18Linux/BSD: Fix support for NetBSDRémi Verschelde
Add __NetBSD__ to `platform_config.h` so that it can find `alloca` and use the proper `pthread_setname_np` format. Rename RANDOM_MAX to avoid conflict with NetBSD stdlib. Fixes #42145.
2020-09-17Allow commutative multiplication in VariantGeorge Marques
Also allow quaternions to be multiplied by integers.
2020-09-08Change inequality comparison operators to use exact equalityAaron Franke
2020-09-08Initialise Basis elements with a default Basis in the declaration.Marcel Admiraal
Ensures a valid Basis is created with all constructors.
2020-09-04Ensure assignment operators return by reference to avoid unnecessary copies.Marcel Admiraal
2020-09-03[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg
2020-08-31Merge pull request #40955 from Calinou/test-add-expressionRémi Verschelde
Add a test suite for Expression
2020-08-27Add a test suite for ExpressionHugo Locurcio
This also makes the first parameter of `Expression::execute()` optional from C++. Previously, it was only optional in the scripting API.
2020-08-13Added volumetric fog effect.Juan Linietsky
2020-07-27Make all String float conversion methods be 64-bitAaron Franke
2020-07-25GDScript: Clarified/fixed inaccuracies in the built-in function docs.Meriipu
The input to smoothstep is not actually a weight, and the decscription of smoothstep was pretty hard to understand and easy to misinterpret. Clarified what it means to be approximately equal. nearest_po2 does not do what the descriptions says it does. For one, it returns the same power if the input is a power of 2. Second, it returns 0 if the input is negative or 0, while the smallest possible integral power of 2 actually is 1 (2^0 = 1). Due to the implementation and how it is used in a lot of places, it does not seem wise to change such a core function however, and I decided it is better to alter the description of the built-in. Added a few examples/clarifications/edge-cases.
2020-07-21Update core documentation to match recent C# changesAaron Franke
Also a few minor API changes like adding AABB.abs() Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-07-01Merge pull request #38713 from aaronfranke/string-64bitRémi Verschelde
Make all String integer conversion methods be 64-bit
2020-06-26Addition of SDFGI for open world global illuminationJuan Linietsky
Move GI to a deferred pass
2020-06-25Style: Fix copyright headersRémi Verschelde