summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
2021-08-15Add constant to vector function parameters that don't actually modify their ↵Ricard Rovira Cubeles
input. Add more overloads of vector multiplication, required by templates to compile with float=64.
2021-08-13Fix some unnecessary includesAaron Franke
2021-08-10Merge pull request #50682 from aaronfranke/basis-looking-atRémi Verschelde
Move code for looking_at to Basis
2021-08-08[Text Server] Improve object (image/table) inline alignment.bruvzg
2021-08-07Fix Transform::xform(Plane) functionslawnjelly
The Transform::xform and xform_inv are made safe for Planes when using non-uniform scaling. Optimization of calling sites to prevent loss of performance from the changes to xform(Plane).
2021-08-01Move code for looking_at to BasisAaron Franke
2021-08-01Merge pull request #48958 from ↵Rémi Verschelde
kleonc/astar-get_available_point_id-start-from-zero Astar::get_available_point_id Return 0 instead of 1 when empty
2021-07-30Remove obsolete "dectime" methodAaron Franke
Replaced by "move_toward"
2021-07-25Merge pull request #50809 from akien-mga/iterators-const-referencesRémi Verschelde
2021-07-25Use const references where possible for List range iteratorsRémi Verschelde
2021-07-25Fix various typos with codespellluz paz
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-07-23Merge pull request #50748 from JFonS/gizmo_reworkRémi Verschelde
Node3D gizmo improvements
2021-07-23Node3D gizmo improvementsjfons
* Clean-up of node_3d_editor_plugin.{h,cpp}: removed unused code, fixed some bugs. * Moved node_3d_editor_gizmos.{h,cpp} to editor/plugins. * Added support for multiple gizmos per node. This means custom gizmos will no longer override the built-in ones and that multiple gizmos can be used in more complex nodes. * Added support for handle IDs. When adding handles to a gizmo, an ID can be specified for each one, making it easier to work with gizmos that have a variable number of handles. * Added support for subgizmos, selectable elements that can be transformed without needing a node of their own. By overriding _subgizmo_intersect_frustum() and/or _subgizmo_intersect_ray() gizmos can define which subgizmos should be selected on a region or click selection. Subgizmo transformations are applied using get/set/commit virtual methods, similar to how handles work.
2021-07-21Add min_axis and max_axis to Vector2iGilles Roudière
2021-07-21Use the standard C `INFINITY` and `NAN` constants directlyHugo Locurcio
The `Math_INF` and `Math_NAN` defines were just aliases for those constants, so we might as well use them directly. Some portions of the code were already using `INFINITY` directly.
2021-06-29Implement painting properties over TileSetsGilles Roudière
2021-06-18Merge pull request #44156 from aaronfranke/quat-angle-toRémi Verschelde
Add Quaternion angle_to method
2021-06-17Add Quaternion angle_to methodAaron Franke
2021-06-15Allow multiplying Transforms and Basis by numbersAaron Franke
2021-06-13Merge pull request #34668 from aaronfranke/to-stringRémi Verschelde
[Core] Reformat structure string operators
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-11Reformat structure string operatorsAaron Franke
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant). For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
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-22Astar::get_available_point_id Start from 0kleonc
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>