summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
2021-06-13Fix crash when using invalid index in Color.get_named_colorHaoyu Qiu
2021-06-11Rename Reference to RefCountedPedro J. Estébanez
2021-06-11Core: Move DirAccess and FileAccess to `core/io`Rémi Verschelde
File handling APIs are typically considered part of I/O, and we did have most `FileAccess` implementations in `core/io` already.
2021-06-07Style: Cleanup uses of double spaces between wordsRémi Verschelde
Or after punctuation. Tried to leave third-party stuff alone, unless it has been heavily modified for Godot.
2021-06-05New and improved IK system for Skeleton2DTwistedTwigleg
This PR and commit adds a new IK system for 2D with the Skeleton2D node that adds several new IK solvers, a way to control bones in a Skeleton2D node similar to that in Skeleton3D. It also adds additional changes and functionality. This work was sponsored by GSoC 2020 and TwistedTwigleg. Full list of changes: * Adds a SkeletonModifier2D resource * This resource is the base where all IK code is written and executed * Has a function for clamping angles, since it is so commonly used * Modifiers are unique when duplicated so it works with instancing * Adds a SkeletonModifierStack2D resource * This resource manages a series of SkeletonModification2Ds * This is what the Skeleton2D directly interfaces with to make IK possible * Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK * Each modification is in its own file * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together * Adds a PhysicalBone2D node * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node * Changes to Skeleton2D listed below: * Skeleton2D now holds a single SkeletonModificationStack2D for IK * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D * Changes to Bone2D listed below: * The default_length property has been changed to length. Length is the length of the bone to its child bone node * New bone_angle property, which is the angle the bone has to its first child bone node * Bone2D caches its transform when not modified by IK for IK interpolation purposes * Bone2D draws its own editor gizmo, though this is stated to change in the future * Changes to CanvasItemEditor listed below: * Bone2D gizmo drawing code removed * The 2D IK code is removed. Now Bone2D is the only bone system for 2D * Transform2D now has a looking_at function for rotating to face a position * Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE * These notifications only are called in the editor right before and after saving a scene * Needed for not saving the IK position when executing IK in the editor * Documentation for all the changes listed above.
2021-06-04Rename Quat to QuaternionMarcel Admiraal
2021-06-03Merge pull request #38430 from aaronfranke/transform3dRémi Verschelde
2021-06-03Allow clamping vectors and colorsAaron Franke
2021-06-03Rename Vector2 clamped to limit_length and add limit_length to Vector3Aaron Franke
2021-06-03Rename files and the exposed name for Transform3DAaron Franke
2021-06-03Rename Variant TRANSFORM to TRANSFORM3DAaron Franke
Also _transform to _transform3d
2021-06-03Rename Transform to Transform3D in coreAaron Franke
2021-05-31Merge pull request #49142 from Chaosus/bvh_fix_possible_crashRémi Verschelde
Fixed possible crash in `DynamicBVH::optimize_incremental`
2021-05-29BVH - fix stale current_tree in deactivate function [4.x]lawnjelly
Changes passing of current_tree from a member variable to a function argument, making bugs due to stale state less likely. Fix a bug in deactivate where current_tree variable was stale. This may have resulted in visual anomalies.
2021-05-27Fixed possible crash in `DynamicBVH::optimize_incremental`Yuri Roubinsky
2021-05-22Replace QuickHull with Bullet's convex hull computer.Morris Tabor
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style. Additional changes: - extended PagedAllocator to allow leaked objects - applied patch from https://github.com/bulletphysics/bullet3/pull/3037
2021-05-21Merge pull request #48903 from Calinou/math-funcs-remove-old-msvc-ifdefRémi Verschelde
2021-05-20Remove `#ifdef` catering to MSVC 2012 and earlier in `math_funcs.h`Hugo Locurcio
For the `master` branch, the minimum supported MSVC version is now MSVC 2017 (with MSVC 2019 being recommended).
2021-05-20Merge pull request #48887 from aaronfranke/roundRémi Verschelde
Use global scope round method for rounding
2021-05-20Use global scope round method for roundingAaron Franke
2021-05-20Make is_equal_approx have explicit float and double versionsAaron Franke
2021-05-19Fix Quat includesMarcel Admiraal
2021-05-10Dynamic BVH broadphase in 2D & 3D Godot PhysicsPouleyKetchoupp
Port lawnjelly's dynamic BVH implementation from 3.x to be used in both 2D and 3D broadphases. Removed alternative broadphase implementations which are not meant to be used anymore since they are much slower. Includes changes in Rect2, Vector2, Vector3 that help with the template implementation of the dynamic BVH by uniformizing the interface between 2D and 3D math. Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2021-05-07Merge pull request #48535 from groud/tiles_squashedRémi Verschelde
TileSet and TileMap rework (squashed)
2021-05-07Rework the TileSet resource and TileMap nodes:Gilles Roudière
- Move most properties from TileMap to TileSet, - Make TileSet more flexible, supporting more feature (several collision layers, etc...), - Fusion both the TileMap and TileSet editor, - Implement TileSetSources, and thus a new way to index tiles in the TileSet, - Rework the TileSet and TileMap editors completely, - Implement an editor zoom widget (and use it in several places)
2021-05-07Merge pull request #45144 from dalexeev/color-constsRémi Verschelde
Rename color constants (alternative)
2021-05-04Re-bind posmod, use int64_t instead of intRémi Verschelde
Fixes #48420, fixes #48421. The binding was missed when moving GDScript built-in to Global Scope it seems. Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2021-05-03Cast Unix time to uint in the randomize functionGeorge Marques
This returns a double while the other values are all uint64_t. The clang compiler gives a warning since converting the constant to double loses precision.
2021-04-28Fix area calculation of Face3Pasi Nuutinmaki
There seemed to be a bug in area calculation in Face3::get_area()-function. It returned the area of "imaginary" parallelogram instead of the triangle. Therefore the area returned was twice the real area. This manifested itself when using a hydro module for godot ( https://gitlab.com/ringtechsolutions/godot-tools/hydro/hydro ) causing the buoyancy to be two times the expected value. "Reference": http://www.maths.usyd.edu.au/u/MOW/vectors/vectors-11/v-11-7.html
2021-04-28Merge pull request #48239 from akien-mga/goodbye-copymemRémi Verschelde
Core: Drop custom `copymem`/`zeromem` defines
2021-04-27Core: Drop custom `copymem`/`zeromem` definesRémi Verschelde
We've been using standard C library functions `memcpy`/`memset` for these since 2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb. There was still the possibility for third-party platform ports to override the definitions with a custom header, but this doesn't seem useful anymore.
2021-04-23Implement occlusion cullingjfons
Added an occlusion culling system with support for static occluder meshes. It can be enabled via `Project Settings > Rendering > Occlusion Culling > Use Occlusion Culling`. Occluders are defined via the new `Occluder3D` resource and instanced using the new `OccluderInstance3D` node. The occluders can also be automatically baked from a scene using the built-in editor plugin.
2021-04-22Make randomize() use unix time tookobewi
2021-04-09Fix `Color::get_{r,g,b,a}8`Danil Alexeev
Closes #47022.
2021-04-05Style: Apply clang-tidy's `readability-braces-around-statements`Rémi Verschelde
2021-04-05Style: Apply clang-tidy's `modernize-use-nullptr`Rémi Verschelde
2021-03-29Fix Quat multiplicationrafallus
x, y, z values were updated too early
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
2021-02-25Make Color::from_hsv use Color::set_hsvkleonc
2021-02-24Geometry2D::make_atlas Fail is passed invalid rect sizekleonc
2021-02-22Fix unchecked array access in build_*_planesDelf Neumärker
2021-02-16Use Vector3.UP as a default value for look_at's up vectorAaron Franke
2021-02-16Added signed_angle_to for Vector3JestemStefan
2021-02-10Cylinder support in Godot Physics 3DPouleyKetchoupp
Cylinder collision detection uses a mix of SAT and GJKEPA. GJKEPA is used to find the best separation axis in cases where finding it analytically is too complex. Changes in SAT solver: Added support for generating separation axes for cylinder shape. Added support for generating contact points with circle feature. Changes in GJKEPA solver: Updated from latest Bullet version which includes EPA fixes in some scenarios. Setting a lower EPA_ACCURACY to fix accuracy problems with cylinder vs. cylinder in some cases.
2021-02-03Merge pull request #45658 from RandomShaper/fix_frozen_peakRémi Verschelde
Make audio bus channels' peak volume consistent
2021-02-02Make audio bus channels' peak volume consistentPedro J. Estébanez
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).
2021-02-01Replace ColorN and from HTML with a string constructorAaron Franke
2021-02-01Merge pull request #37547 from aaronfranke/tauRémi Verschelde
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-01-26Type consistencies in coreAaron Franke
2021-01-26Merge pull request #45373 from aaronfranke/gdnative-sizeofGeorge Marques
Define GDNative sizes using sizeof(godot_real) and sizeof(int32_t)