Commit graph

259 commits

Author SHA1 Message Date
Marcelo Fernandez
da1f1619fe Fix clang compile error 2018-08-09 08:50:06 -03:00
Juan Linietsky
a71a5fc0c3 Ability to pass custom variables to expression. 2018-08-08 17:47:51 -03:00
Juan Linietsky
934c641a15 -Add Expression class, used to evaluate expressions
-Added expression evaluation to EditorSpinSlider, fixes #20813, fixes #18932
2018-08-08 17:35:23 -03:00
Rémi Verschelde
5c8919aac6
Merge pull request #18955 from tagcup/fix_set_scale
Removed incorrect Basis::set_scale().
2018-07-26 10:37:03 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Wilson E. Alvarez
a22e746bc3 Removed unnecessary assignments 2018-07-24 09:51:03 +02:00
Max Hilbrunner
c538f2ff80
Merge pull request #19279 from aaronfranke/core-fposmod-fix
[Core] [Math] Fix fposmod() function
2018-07-05 00:35:46 +02:00
Max Hilbrunner
045944f83a
Merge pull request #19819 from MetaSaval/master
Change the neighbours vector to a set in AStar
2018-07-03 15:32:15 +02:00
Danny
9b60bb2c7c Change the neighbours vector to a set in AStar
This fixes an issue where one could not disconnect two points that were connected more than once.
2018-06-27 22:36:38 -07:00
Juan Linietsky
ad4666f8e0
Merge pull request #19193 from tagcup/quat_norm
Fixed Basis -> Quat conversions, added a few safety checks.
2018-06-25 10:58:04 -03:00
Juan Linietsky
2365fe472b Added auto triangle generation in blend space, using Delaunay. 2018-06-21 22:48:47 -03:00
JFonS
9cd1c20f6a Polished 3D selection 2018-06-13 17:52:37 +02:00
Aaron Franke
eebe41b1b0 [Core] [Math] Fix fposmod() function
ffff


meth
2018-06-10 15:06:44 -05:00
Andrea Catania
0b7c4db5ee Added functions to get trimesh info 2018-06-07 15:46:17 +02:00
Rémi Verschelde
43b7ebf0a0 Style: Apply clang-format (5.0) to some missed files 2018-05-31 09:00:37 +02:00
tagcup
9d41161596 Fixed Basis -> Quat conversions, added a few safety checks.
Fixes #19027.
2018-05-27 14:15:47 -04:00
tagcup
1bba6eeeb9 Removed incorrect Basis::set_scale().
Also added a missing constructor in Basis, and fixed usage of inverse and affine inverse in Transform.
2018-05-17 19:39:04 -04:00
tagcup
ed7aadcd87 Add SLERP to Vector{2,3}, optimize Quat's Vector3 rotation.
Also even out Basis and Quat APIs a little.
2018-05-12 13:05:04 -04:00
Juan Linietsky
69a96ff4a6
Merge pull request #15943 from poke1024/geometry-line-line
Add Geometry::line_intersects_line_2d()
2018-05-07 17:54:33 -03:00
Alexander Alekseev
26963473a9 Vector3::round, Vector2::round & Vector2::ceil methods were added.
Now both structs (Vector2 & Vector3) have round, floor & ceil methods.
(see #18603)
2018-05-04 12:43:50 +03:00
Rémi Verschelde
bf7ca623a6 Fix Coverity reports of uninitialized scalar variable
Fixes most current reports on Coverity Scan of uninitialized scalar
variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html

These happen most of the time (in our code) when instanciating structs
without a constructor (or with an incomplete one), and later returning
the instance. This is sometimes intended though, as some parameters are
only used in some situations and should not be double-initialized for
performance reasons (e.g. `constant` in ShaderLanguage::Token).
2018-04-19 15:20:45 +02:00
tagcup
a5e0bb447c Avoid converting Quat to Euler angles when not necessary.
Also ensure that get_scale doesn't arbitrarlity change the signs of scales, ensuring that the combination of get_rotation and get_scale gives the correct basis.

Added various missing functions and constructors.

Should close #17968.
2018-04-14 15:53:25 -04:00
Chaosus
ac4c340a45 Small performance fix to wrapf 2018-04-13 13:50:17 +03:00
Crazy-P
ae7a9df292 Resolves Inccorect Quaternion Conversion
Fixes https://github.com/godotengine/godot/issues/18025
2018-04-09 14:48:03 +08:00
Juan Linietsky
cef01f1f49
Merge pull request #16495 from Chaosus/is_point_in_triangle_fix
Fix is_point_in_triangle function
2018-04-08 18:18:19 -03:00
Marcelo Fernandez
bbd21c2203 Fix for clang warning at distance_to 2018-03-22 13:26:04 -03:00
Rémi Verschelde
b4da44981a
Merge pull request #17254 from Chaosus/updatewrap
Update wrap functions
2018-03-13 12:33:57 +01:00
Bernhard Liebl
9d7856620c Bring back Vector2.cross() 2018-03-07 21:10:31 +01:00
Chaosus
70bb31a7b2 Update wrap functions 2018-03-06 10:34:37 +03:00
Nicolas Silva
e73266a51c Allow degenerate triangles in polygon triangulation when necessary. 2018-02-28 22:46:56 -05:00
Chaosus
f2c22791ce Fix is_point_in_triangle 2018-02-08 19:59:52 +03:00
Nicolas Silva
91215e1919 Fix polygon triangulation failure.
The ear clipping algorithm used to triangulate polygons has a slightly too conservative point-in-triangle test which can, in some configurations prevent it from finding a possible tessellation. Relaxing the test by considering that points exactly on edges don't belong the triangle fixes the issue. Changing the semantic of the test is safe because no other code makes use of it. A more detailed explanation can be found in issue #16395.

Fixes #16395.
2018-02-05 16:01:24 +01:00
Bernhard Liebl
c1e099b48f Add Geometry::line_intersects_line_2d() 2018-01-21 15:31:34 +01:00
Rémi Verschelde
9f479f096c Fix typos in code and docs with codespell
Using v1.11.0 from https://github.com/lucasdemarchi/codespell
2018-01-18 22:01:42 +01:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
459ee51338
Merge pull request #15093 from poke1024/canvas-editor-select
More exact picking for canvas editor
2018-01-03 11:15:28 +01:00
Juan Linietsky
14772d2213
Merge pull request #15083 from tagcup/spatial_rot_fix
Restore the behavior of Spatial rotations recently changed in c1153f5.
2018-01-02 15:02:19 -03:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Noshyaar
8dcc28254c
Merge pull request #15091 from poke1024/fix-rect2-distance-to
Fix Rect2::distance_to() not returning 0
2018-01-01 18:37:46 +07:00
tagcup
e9896b17a9 Restore the behavior of Spatial rotations recently changed in c1153f5.
That change was borne out of a confusion regarding the meaning of "local" in #14569.

Affine transformations in Spatial simply correspond to affine operations of its Transform. Such operations take place in a coordinate system that is defined by the parent Spatial. When there is no parent, they correspond to operations in the global coordinate system.
This coordinate system, which is relative to the parent, has been referred to as the local coordinate system in the docs so far, but this sloppy language has apparently confused some users, making them think that the local coordinate system refers to the one whose axes are "painted" on the Spatial node itself.

To avoid such conceptual conflations and misunderstandings in the future, the parent-relative local system is now referred to as "parent-local", and the object-relative local system is called "object-local" in the docs.

This commit adds the functionality "requested" in #14569, not by changing how rotate/scale/translate works, but by adding new rotate_object_local, scale_object_local and translate_object_local functions. Also, for completeness, there is now global_scale.

This commit also updates another part of the docs regarding the rotation property of Spatial, which also leads to confusion among some users.
2017-12-27 16:40:49 -05:00
Bernhard Liebl
8505871a87 More exact picking for canvas editor 2017-12-27 20:24:58 +01:00
Bernhard Liebl
41c11894f1 Fix Rect2::distance_to() not returning 0 2017-12-27 09:56:52 +01:00
Noshyaar
de2247b9b4
Merge pull request #15045 from poke1024/vector2-inline
Inline some very common Vector2 operations
2017-12-27 10:25:08 +07:00
Juan Linietsky
c1153f5041 Change the rotate function of Spatial to be local, makes more sense. Closes #14569 2017-12-26 12:45:56 -03:00
Bernhard Liebl
517227943f Inline some very common Vector2 operations 2017-12-25 15:58:14 +01:00
Poommetee Ketson
6c897707ca Add missing parameter names 2017-12-25 21:19:56 +07:00
Gilles Roudiere
71f5e17680 Fixes grow_margin not working at all 2017-12-21 23:53:31 +01:00
Rémi Verschelde
2b41afb30e Fix wrong return value in some virtual method bindings 2017-12-10 15:34:08 +01:00
Rémi Verschelde
41e3592041
Merge pull request #13347 from Noshyaar/hang_in_there
Rect2: add function returning same rect with positive w and h
2017-12-09 18:08:09 +01:00
Rémi Verschelde
13c2ff9320 Style: Apply new clang-format 5.0 style to all files 2017-12-07 08:02:00 +01:00