Commit graph

274 commits

Author SHA1 Message Date
Rémi Verschelde 9eb4d4ab2d Add missing copyright headers 2018-08-29 22:41:17 +02:00
Ignacio Etcheverry 78bb53f85d
Merge pull request #21205 from KellyThomas/c-sharp-feature-parity-quat
[Mono] Quat - add some missing constructors and methods
2018-08-27 16:18:09 +02:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Kelly Thomas a941684590 mono: Quat - add some missing constructors and methods 2018-08-24 07:56:54 +08:00
Rémi Verschelde 92aafa898f
Merge pull request #21305 from Mr-Slurpy/expression-fix
Fixed bugs in expression class
2018-08-23 12:10:54 +02:00
Daniel Eliasinski fb3506d796 Fixed bugs in expression class 2018-08-23 01:29:24 -04:00
Aaron Franke 434973fb83 [Mono] Vector2/3 Project methods 2018-08-22 13:27:35 -04:00
Hein-Pieter van Braam 33669a8bca Remove faces in in QuickHull::build() that we don't need anymore
We delete the faces for consideration in this loop but we can still
sometimes find an edge that connects to this face. We now interate over
all edges and disconnect edges connecting to this face.

This fixes #16560 and fixes #17569
2018-08-20 00:22:47 +02:00
Thomas Herzog 037f4638ab add project method to Vector2/3 2018-08-16 12:52:38 +02:00
Aaron Franke cf136a91d6 [Core] Completely kill math_2d.h, change includes 2018-08-11 03:08:34 -05:00
Aaron Franke 14fe7230f4 [Core] Move Vector2i and Rect2i out of math_2d.h 2018-08-11 00:33:01 -05:00
Aaron Franke 2eb8a9749e [Core] Move Rect2 and Transform2D to their own files
Math2D includes Transform2D, which includes Rect2, which includes Vector2.
2018-08-10 23:40:50 -05:00
Aaron Franke 9170d932e3 [Core] Grammar, move defs to defs
Math constant definitions belong in `math_defs.h`. Also, the grammer in these files really needed some updating.
2018-08-10 22:42:02 -05:00
Aaron Franke 28fc195339 [Core] Change math_2d includes to vector2 includes where relevant 2018-08-10 14:59:29 -05:00
Aaron Franke 9d1b5f4e3b [Core] Move Vector2 to its own file
Makes 2D math code easier to read and makes Vector2 consistent with Vector3. In the future, we may move other things out of math_2d as well.
2018-08-10 14:59:29 -05:00
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