Commit graph

448 commits

Author SHA1 Message Date
Calamander 64e584a97e
Update random_pcg.h
little fix to function types
2019-01-07 23:13:16 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde a1954e51e8
Merge pull request #24135 from Chaosus/rng
Added ranged integer generation function to RNG class
2018-12-12 14:07:47 +01:00
Wilson E. Alvarez 08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Chaosus d376be2bf4 Added integer number generation function to RNG class 2018-12-06 14:49:52 +03:00
Rémi Verschelde 173b342ca7 Remove trailing whitespace
With `sed -i $(rg -l '[[:blank:]]*$' -g'!thirdparty') -e 's/[[:blank:]]*$//g'`
(+ manual revert of some thirdparty code under `platform/android`).
2018-11-20 11:15:02 +01:00
Juan Linietsky 16022da187 Ensure that array passed to physics is always counter clockwise, fixes #15361. 2018-11-14 15:55:50 -03:00
Chaosus f8151a9e50 Implement random number generator
Co-authored-by: Zirak <zirakertan@gmail.com>
2018-11-13 10:50:07 +03:00
Aaron Franke 81be9542eb Remove unused "dtoll" methods
These methods aren't used anywhere in Godot's code, and all they do is cast floating types to int64_t. There's no reason to have these lines, they literally do nothing, and they aren't useful functions to begin with.
2018-11-02 05:02:27 -04:00
santouits b0df0b46ac Error running Expression.execute after parse error
There happens a segmentation fault when you use Expression.parse() and you don't check for errors and then run Expression.execute(). So we check if there was a parse error in the execute method now.
2018-10-28 12:13:39 +02:00
Rémi Verschelde bf6dcb9105
Merge pull request #22722 from akien-mga/fix-warnings
Fix more "may be used initialized" warnings from GCC 7
2018-10-07 11:07:13 +02:00
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04:00
Leon Krause 5f45476dc1 Fix warnings in HTML5 build outside platform files 2018-10-06 00:08:17 +02:00
Rémi Verschelde 3e9740ac93 Fix more "may be used initialized" warnings from GCC 7
Fixes the following GCC 7 warnings:
```
core/cowdata.h:269:47: warning: 'alloc_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/error_macros.h:163:26: warning: 'nearest_point' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/image.cpp:1579:5: warning: 'colormap_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/image.cpp:1582:12: warning: 'size_height' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/image.cpp:1590:23: warning: 'size_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/image.cpp:1599:29: warning: 'pixel_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/math/face3.cpp:207:15: warning: 'tri_max' may be used uninitialized in this function [-Wmaybe-uninitialized]
core/math/face3.cpp:209:15: warning: 'tri_min' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/gles3/rasterizer_scene_gles3.cpp:665:22: warning: 'best_used_frame' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/gles3/rasterizer_storage_gles3.cpp:865:27: warning: 'blit_target' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/gles3/rasterizer_storage_gles3.cpp:980:29: warning: 'blit_target' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/gles3/shader_gles3.h:122:9: warning: '<anonymous>.ShaderGLES3::Version::frag_id' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/gles3/shader_gles3.h:122:9: warning: '<anonymous>.ShaderGLES3::Version::id' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/gles3/shader_gles3.h:122:9: warning: '<anonymous>.ShaderGLES3::Version::vert_id' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/plugins/script_editor_plugin.cpp:1980:31: warning: 'se' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/scene_tree_dock.cpp:840:30: warning: 'new_node' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4259:9: warning: 'a1' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4259:9: warning: 'lll' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4259:9: warning: 'lul' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4260:9: warning: 'a2' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4261:9: warning: 'a3' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4265:3: warning: 'enable_lin' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4294:3: warning: 'enable_ang' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4311:34: warning: 'll' may be used uninitialized in this function [-Wmaybe-uninitialized]
editor/spatial_editor_gizmos.cpp:4311:34: warning: 'ul' may be used uninitialized in this function [-Wmaybe-uninitialized]
scene/3d/voxel_light_baker.cpp:1655:47: warning: 'cone_dirs' may be used uninitialized in this function [-Wmaybe-uninitialized]
scene/3d/voxel_light_baker.cpp:1656:73: warning: 'cone_weights' may be used uninitialized in this function [-Wmaybe-uninitialized]
scene/gui/texture_progress.cpp:181:6: warning: 'cp' may be used uninitialized in this function [-Wmaybe-uninitialized]
scene/gui/texture_progress.cpp:181:6: warning: 'cq' may be used uninitialized in this function [-Wmaybe-uninitialized]
servers/physics/shape_sw.cpp:1056:19: warning: 'support_max' may be used uninitialized in this function [-Wmaybe-uninitialized]
```
2018-10-04 18:54:20 +02:00
Rémi Verschelde 95131e6f23 Fix warnings on release builds (not DEBUG_ENABLED)
Fixes the following Clang 5 warnings:
```
modules/bmp/image_loader_bmp.cpp:46:60: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
modules/bmp/image_loader_bmp.cpp:48:61: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
drivers/png/image_loader_png.cpp:231:20: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
scene/gui/graph_edit.cpp:1045:8: warning: comparison of constant 0 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare]

core/class_db.cpp:812:13: warning: unused variable 'check' [-Wunused-variable]
core/io/file_access_pack.cpp:172:11: warning: unused variable 'ver_rev' [-Wunused-variable]
core/math/bsp_tree.cpp:195:13: warning: unused variable 'plane' [-Wunused-variable]
core/math/bsp_tree.cpp:168:6: warning: unused variable 'plane_count' [-Wunused-variable]
modules/gdscript/gdscript_function.cpp:685:10: warning: unused variable 'ok' [-Wunused-variable]
modules/gdscript/gdscript_function.cpp:706:10: warning: unused variable 'ok' [-Wunused-variable]
modules/gdscript/gdscript_function.cpp:755:19: warning: unused variable 'var_type' [-Wunused-variable]
modules/gdscript/gdscript_function.cpp:1306:12: warning: unused variable 'err' [-Wunused-variable]

modules/gdscript/gdscript_function.cpp:158:15: warning: unused function '_get_var_type' [-Wunused-function]
modules/gdscript/gdscript_parser.cpp:750:20: warning: unused variable 'lv' [-Wunused-variable]
modules/gdscript/gdscript_parser.cpp:59:15: warning: unused function '_find_function_name' [-Wunused-function]
scene/main/node.cpp:2489:13: warning: unused function '_Node_debug_sn' [-Wunused-function]
```
2018-10-03 17:34:55 +02:00
Rémi Verschelde b4c1d40869
Merge pull request #21492 from Maykeye/astar
Changed A* exit condition, added 2 tests for it
2018-10-02 10:30:12 +02:00
Rémi Verschelde 34dec26a50 Add support for '.[0-9]' numbers in Expression
Fixes #21874, supersedes #22065.
2018-10-01 16:06:21 +02:00
Rémi Verschelde a9e17af09a SCons: Build core's thirdparty code in own environment
Also move Zlib and Zstd's build instructions to core/SCsub.
2018-09-28 11:40:41 +02:00
DualMatrix f483460e38 Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
2018-09-23 14:58:15 +02:00
Aaron Franke 5f4f9ca4a5 Fix: Strip integer part in "decimals"
Note: Core only.
2018-09-19 23:47:33 -04:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde 9eb4d4ab2d Add missing copyright headers 2018-08-29 22:41:17 +02:00
Maykeye 40562a67c8 Changed A* exit condition, added 2 tests for it
A* now exits when next node from open set with least cost happens to be end_point,
not when node with least cost has end_point as a neigbour.

Added two tests for astar:
* ABC tests case where start and end node are
neigbours
* ABCX tests case with intermediate nodes
2018-08-28 19:48:07 +06: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
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
Rémi Verschelde d5ca9e2f6f Style: Apply clang-format again on all files
Fixes issues introduced by newer clang-format versions or commits
pushed directly without using the clang-format pre-commit hook.
2017-12-07 08:02:00 +01:00
Bastiaan Olij 4f9dac5bb1 Forgot to apply oversampling to Y 2017-12-03 22:32:42 +11:00
Poommetee Ketson 5c9be411eb Rect2: add function returning same rect with positive w and h 2017-11-28 00:41:29 +07:00
Ferenc Arn d28763a4c1 Rename Rect3 to AABB.
Fixes #12973.
2017-11-17 11:01:41 -05:00
Goutte 91ca725f9b Add support for the TAU constant. Fixes #12094. 2017-11-12 13:32:35 +01:00
Rémi Verschelde ed57f0a0d4 Remove get_default_video_mode definition on OSX/iOS
It had been missed in d09160a8b6 and broke compilation
for those platforms.

Took the opportunity to run clang-format on the code base to fix some corner cases
that went through our static tests/were overlooked recently.
2017-11-09 23:36:08 +01:00
DmDerbin 4c79e58e3f AStar: implementation of get_point_connections 2017-11-04 11:21:03 +03:00
Rémi Verschelde ea0e942617
Merge pull request #12035 from Chaosus/wrapfunc
Added new Wrap functions for numbers
2017-10-31 23:30:50 +01:00
Rémi Verschelde cb3f594b14
Merge pull request #11249 from m4nu3lf/bugfix/get_euler
Fix inertia tensor update & Generic6DOFJoint & Simplify Basis::get_euler()
2017-10-31 23:03:01 +01:00
Unknown 9b4c5989ad AStar: Add setters for point position and scale weight, cleanup 2017-10-27 19:19:01 +02:00
Robert Hernandez 794407e7b6 Fixed memory leak with AStar class 2017-10-22 18:37:02 -04:00
Rémi Verschelde 99c8a8c7b1 Merge pull request #11401 from SaracenOne/snapped_drag
Added snapping to spatial drag and drop.
2017-10-22 12:06:00 +02:00
Chaosus 216a8aa643 Added new wrap functions 2017-10-13 11:10:45 +03:00
Ferenc Arn 8861cc40fa Added Basis::get_quat() and set_quat(). 2017-10-11 16:56:47 -04:00
m4nu3lf 3df217b1a1 Fix Basis::get_euler_xyz() 2017-09-22 20:19:11 +01:00
Rémi Verschelde e3617cb187 Merge pull request #11409 from MarufSarker/PR-core-math-is_nan
Verbose and Platform-specific implementation for is_nan
2017-09-20 14:29:01 +02:00
letheed 5ad9be4c24 Rename pos to position in user facing methods and variables
Rename user facing methods and variables as well as the corresponding
C++ methods according to the folloming changes:

* pos -> position
* rot -> rotation
* loc -> location

C++ variables are left as is.
2017-09-20 13:11:10 +02:00
ABU MD. MARUF SARKER 7744bb153f verbose and platform specific implementation for is_nan 2017-09-20 08:20:08 +06:00
SaracenOne 2e22c07f42 Added snapping to spatial drag and drop. 2017-09-20 01:54:01 +01:00
Indah Sylvia 13b630eb0c Fixed Typo: 'Seperate' to 'Separate' 2017-09-19 15:51:00 +07:00
Rémi Verschelde 26017499a5 Merge pull request #11049 from scayze/astar_get_points
Add get_points() method to AStar
2017-09-12 14:07:06 +02:00
Rémi Verschelde aabbd00284 Merge pull request #10908 from hpvb/fix-unused-variables
Fix unused variable warnings
2017-09-12 12:55:53 +02:00
Hein-Pieter van Braam b2a38854fd Fix unused variable warnings
The forth in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-08 15:03:53 +02:00
Hein-Pieter van Braam 5e18967d77 Fix serveral recent new clang-format errors 2017-09-08 00:20:16 +02:00
Juan Linietsky eedb39091a Several fixes to directional shadows, closes #10926
Added option to change directional light range mode, between optimized and stable. For Orthogonal, you might need to use optimized.
2017-09-07 18:00:47 -03:00
Scayze 6872cc7b12 Add get_points method to AStar 2017-09-07 19:15:46 +02:00
Juan Linietsky 6d233c651b -Changed KinematicBody API yet again to make it friendlier
-Fixed get_scale functions (and added set_scale) to make it more coherent when decomposing and composing (fixes bugs in transform interpolation)
2017-09-04 07:49:42 -03:00
Hein-Pieter van Braam 9c63ab99f0 Fix use of unitialized variables
The second in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-02 01:59:26 +02:00
Rémi Verschelde dac150108a Merge pull request #10846 from hpvb/fix-sign-compare
Fix signed and unsigned comparisons
2017-09-01 21:52:55 +02:00
Poommetee Ketson ed606ded52 Fix files header 2017-09-01 21:07:55 +07:00
Hein-Pieter van Braam f9467ec1ea Fix signed and unsigned comparisons
The first in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-01 08:13:12 +02:00
Ferenc Arn 5ad8d310f2 Add a new decomposition to Basis.
This new decomposition splits the basis into a rotation-reflection matrix and a positive scaling matrix, which is required for physics calculations.
2017-08-30 09:37:18 -04:00
Ferenc Arn a0bbf5c9af Remove Basis::set_scale and Basis::set_rotation_* functions.
Those functions were added in #8277 but they did more harm than good. They're subtle, don't do what people think and requires users to understand the non-uniqueness of polar decomposition. They ended up confusing people.

Until we store additional information enough to make a unique polar decomposition, these functions shouldn't be a part of Basis.
2017-08-29 21:47:59 -04:00
Rémi Verschelde 7ad14e7a3e Dead code tells no tales 2017-08-27 22:13:45 +02:00
Rémi Verschelde bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
Rémi Verschelde 92410df24c Merge pull request #10415 from tagcup/euler_hack
Fix incorrect workaround for pure Y (X) rotations in XYZ (YXZ) conven…
2017-08-22 00:54:39 +02:00
Rémi Verschelde 135027a2f6 Merge pull request #10225 from Noshyaar/map
GDScript Built-in: add inverse_lerp & range_lerp
2017-08-22 00:31:46 +02:00
Juan Linietsky 72be8876ea Properly manage drawing of primitives when they lack an area, fixes #8930 2017-08-18 15:12:48 -03:00
Poommetee Ketson d28da86f9f GDScript Built-in: add inverse_lerp & range_lerp 2017-08-18 21:49:03 +07:00
Ferenc Arn 94aa4092f5 Fix incorrect workaround for pure Y (X) rotations in XYZ (YXZ) convention.
Fixes #10352.
2017-08-18 01:45:36 -04:00
Marcelo Fernandez eab850524e Add closest_power_of_2 func and implement mix_rate/latency on OS X 2017-08-17 19:51:13 -03:00
Rémi Verschelde a8a6082dc0 Merge pull request #8899 from toger5/BetterFlatStylebox
Better flat stylebox with rounded corners
2017-08-16 18:15:04 +02:00
TwistedTwigleg 00f6c85928 Synchronize parameter names in definition and declaration
Fixes #10244.
2017-08-16 17:22:23 +02:00
Rémi Verschelde 035d74f54a Rename cull_AABB to cull_aabb
Part of #8830.
2017-08-16 17:01:05 +02:00
toger5 c39ac8650d Added Corner Enum 2017-08-15 19:36:34 +02:00
Wilson E. Alvarez 21d281c4a9 Use const reference where favorable 2017-08-14 13:28:06 -04:00
Rémi Verschelde 5c6e41cc13 Merge pull request #10190 from tagcup/euler_yxz
Use YXZ convention for Euler angles.
2017-08-11 10:38:46 +02:00
Ferenc Arn 53c23b0222 Use YXZ convention for Euler angles.
As discussed in issues #1479 and #9782, choosing the up axis (which is Y in Godot) as the axis of the last (or first) rotation is helpful in practical use cases.
This also aligns Godot's convention with Unity, helping with a smoother transition for people who are used to working with Unity (issue #9905).

Internally, both XYZ and YXZ functions are kept, for potential future applications.
2017-08-09 09:05:37 -04:00
Wilson E. Alvarez 6d112a68b6 Moved member variables from constructor to initialization list 2017-08-08 21:43:19 -04:00
Juan Linietsky cd9539f85d Display the Y angle properly when rotating from gizmo, partially helps #1479 2017-08-07 15:09:08 -03:00
Rémi Verschelde 62464839ad Merge pull request #8567 from BastiaanOlij/ar_vr_server
AR/VR base classes and position tracker support
2017-07-31 13:29:18 +02:00
Rémi Verschelde 76005a8e75 Style: Apply clang-format on all files
Thus fixing some invalid changes that had still made it to the master branch.
2017-07-30 22:53:40 +02:00
BastiaanOlij d2ba2d0873 Adding base classes and structures for ARVR support
Added ArVrScriptInterface

Added ARVRCamera, ARVRController and ARVROrigin helper objects
2017-07-28 10:39:15 +10:00
Juan Linietsky 2e73be99d8 Lots of work on Audio & Physics engine:
-Added new 3D stream player node
-Added ability for Area to capture sound from streams
-Added small features in physics to be able to properly guess distance to areas for sound
-Fixed 3D CollisionObject so shapes are added the same as in 2D, directly from children
-Fixed KinematicBody API to make it the same as 2D.
2017-07-15 08:32:34 -03:00
Poommetee Ketson 2c9f6312e2 AStar: add bool has_point(id) 2017-07-11 21:06:30 +07:00
Poommetee Ketson 2fd204c35e Refactor 'treshold' to 'threshold' 2017-07-08 22:24:56 +07:00
Juan Linietsky 7263137dba Implemented environment arrays for skybox reflection and roughness, quality increase is enormous. 2017-07-04 23:53:08 -03:00
TwistedTwigleg 44ecfb028d Fixed syntax inconsistency in Vector3.snap and Vector3.snapped 2017-07-03 16:29:03 -04:00
Thomas Herzog b6b225f4c5 Merge pull request #8870 from tagcup/pathfollow
Fix PathFollow rotations.
2017-06-19 23:30:40 +02:00
Rémi Verschelde 43a84429ff doc: Sync classref with current source
Tried to salvage what I could of the Image and InputEvent changes.
2017-06-15 20:52:51 +02:00
Ferenc Arn cd1e14b1da Use inline code for isinf as a workaround for libstdc++ versions from gcc 5.x era.
Fixes #9166.
2017-06-14 18:30:22 -05:00
Juan Linietsky a8e845a474 Merge pull request #8548 from tagcup/etc2comp
Add ETC1/ETC2 compression support though etc2comp.
2017-06-13 19:17:13 -03:00
alexholly 935f730170 renamed all Rect3.pos to Rect3.position 2017-06-09 15:54:02 +02:00
Poommetee Ketson fcaddeccbb
Fix build error, commit bee81d5 2017-06-08 12:48:59 +07:00
Rémi Verschelde bee81d5214 Merge pull request #8981 from toger5/addedGrowFunction
implemented grow(left,top,right,bottom) function
2017-06-08 07:41:54 +02:00
toger5 66b308925c added grow functions to Rect2
- grow_individual
 - grow_margin
2017-06-05 01:11:00 -07:00
alexholly a3c90b0293 renamed all Rect2.pos to Rect2.position 2017-06-04 02:09:17 +02:00
Ferenc Arn 6a9c990da7 Add ETC1/ETC2 compression support though etc2comp.
Remove rg-etc1 code. Also updated travis to use ubuntu 14.04.

Fixes #8457.
2017-05-31 18:59:00 -05:00
Ferenc Arn a1c8896d9d Fix PathFollow rotations.
Used parallel transport to move the object along the curve. Also introduced a few more math checks useful for debugging.
2017-05-31 13:58:31 -05:00
Thomas Görlich 2c6449c4fc Changed enum to const because enum with uint64 size does not work on VSC++ Compiler 2017-05-29 23:56:21 +02:00
Juan Linietsky f89641907f -Added EXR supprot for HDR (no BC6 compression yet though)
-Improvements to texture importer
-Proper detection of S3TC compression modes, and added all modes to Image
-Fixes to non-power of 2 compressed textures, which should all be supported by GLES3
2017-05-26 22:31:32 -03:00
Rémi Verschelde ce51138b38 Merge pull request #8786 from bojidar-bg/fix-astar-weight-scale
Fix weigth scale of A* being applied to the whole estimation
2017-05-22 15:16:20 +02:00
Bojidar Marinov bd91730347
Fix weigth scale of A* being applied to the whole path and estimation
Attempt to fix #8584
2017-05-22 15:55:49 +03:00
Ferenc Arn e4eb093c62 Avoid overestimating the cost in AStar heuristics.
This is a necessary condition for finding optimal solutions.
This is achieved by simply requiring/ensuring that no weights are smaller than 1.

Fixes #8584.
2017-05-21 15:13:09 -05:00
Fabian Mathews 2262a59ab3 Added bool to allow astar points to be connected in one direction only 2017-05-19 20:46:45 +09:30
Rémi Verschelde 2398eb6ed4 Move core thirdparty files to thirdparty/{minizip,misc} 2017-04-28 21:19:23 +02:00
Rémi Verschelde 5ae1e172da Merge pull request #8277 from tagcup/math_checks
Added various functions basic math classes. Also enabled math checks …
2017-04-24 11:16:20 +02:00
Ferenc Arn ceb699f5ec Fix PRNG randomization.
PCG32 doesn't like small seeds, which leads to zero random values (prior to #7532, zero values were handled as special cases).

Use a large default seed, and also add a shift in Math::randomize.

Fixes #8423.
2017-04-17 14:05:02 -05:00
Juan Linietsky 4286aef693 Particle system is complete. Rejoice! 2017-04-08 22:40:06 -03:00
Rémi Verschelde df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
Juan Linietsky 74808ac4d9 New particle system, mostly working, some small features missing. 2017-04-06 23:49:27 -03:00
Ferenc Arn 9a37ff1e34 Added various functions basic math classes. Also enabled math checks only for debug builds.
Added set_scale, set_rotation_euler, set_rotation_axis_angle. Addresses #2565 directly.
Added an euler angle constructor for Basis in GDScript and also exposed is_normalized for vectors and quaternions.
Various other changes mostly cosmetic in nature.
2017-04-06 13:03:56 -05:00
Rémi Verschelde 2c4e4432af Merge pull request #8214 from tagcup/bounce_reflect_slide
Made slide and reflect active verbs acting on itself in Vector2 and V…
2017-04-05 01:23:09 +02:00
Ferenc Arn 1a620bd5fa Made slide and reflect active verbs acting on itself in Vector2 and Vector3.
This is in alignment with other functions in vector classes.
Also added checks for normalization, fixed the sign of reflect (which now corresponds to reflection along a plane mathematically), added bounce method and updated docs.

Fixes #8201.
2017-04-03 10:02:12 -05:00
Rémi Verschelde 5b09dde3fe Merge pull request #8146 from supagu/astar
Added ability to change A-star cost function
2017-04-03 13:52:59 +02:00
Fabian Mathews b541402417 Added ability to change A-star cost function 2017-04-01 16:36:22 +10:30
Ferenc Arn 97d510531a Fix polar decomposition in 2D.
When performing polar decomposition in 2D as B = R.S, where R is rotation (with determinant +1) and S is scaling, use the convention that reflections are absorbed into S through a reflection around y axis.
In 3D, this is done by using a reflection along all three axes, but since the dimensionality is even in 2D, one axis needs to be chosen.

Fixes Matrix32::get_rotation and Matrix32::get_scale (which weren't properly fixed in #7445).
2017-03-29 12:04:49 -05:00
Rémi Verschelde 60a9debb99 Merge pull request #8132 from tagcup/vector3_angle_to
Use atan2 rather than acos in Vector3.angle_to.
2017-03-24 22:52:46 +01:00
Rémi Verschelde beba97c0c3 Merge pull request #8122 from tagcup/axis_check_normalization
Explicitly documented that Transform.basis is not necessarily an orth…
2017-03-24 22:51:27 +01:00
Rémi Verschelde debeee56f7 Fix typos in source code using codespell
From https://github.com/lucasdemarchi/codespell
2017-03-24 21:45:31 +01:00
Ferenc Arn 3730e0533c Use atan2 rather than acos in Vector3.angle_to.
Fixes #8111.
2017-03-24 12:03:33 -05:00
Ferenc Arn 6bb9b58b09 Explicitly documented that Transform.basis is not necessarily an orthogonal matrix.
Also added a check that in axis-angle rotations, axis is a normalized vector, and modified the docs accordingly.

Fixes #8113.
2017-03-23 12:27:00 -05:00
Rémi Verschelde 5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Rémi Verschelde e1c1d7d1d7 Add a bunch of missing Godot headers in own files 2017-03-05 15:47:28 +01:00
Leandro Motta Barros 0e5863c86a Fix RANDOM_MAX, which is 2^32-1 with PCG32. 2017-03-01 14:33:45 -03:00
Saracen 5e938f0001 Inf and NaN support added to GDScript. 2017-02-28 21:52:33 +00:00
Hein-Pieter van Braam b696beea65 Correct hash behavior for floating point numbers
This fixes HashMap where a key or part of a key is a floating point
number. To fix this the following has been done:

* HashMap now takes an extra template argument Comparator. This class
gets used to compare keys. The default Comperator now works correctly
for common types and floating point numbets.

* Variant implements ::hash_compare() now. This function implements
nan-safe comparison for all types with components that contain floating
point numbers.

* Variant now has a VariantComparator which uses Variant::hash_compare()
safely compare floating point components of variant's types.

* The hash functions for floating point numbers will now normalize NaN
values so that all floating point numbers that are NaN hash to the same
value.

C++ module writers that want to use HashMap internally in their modules
can now also safeguard against this crash by defining their on
Comperator class that safely compares their types.

GDScript users, or writers of modules that don't use HashMap internally
in their modules don't need to do anything.

This fixes #7354 and fixes #6947.
2017-02-16 18:44:29 +01:00
Juan Linietsky da11d6d9e8 Many fixes to make exported scenes work better, still buggy. 2017-02-15 08:34:02 -03:00
Juan Linietsky 04a6d2789e Revert "Make nan==nan true for GDScript" 2017-02-14 17:05:16 -03:00
Hein-Pieter van Braam adcc211feb Make nan==nan true for GDScript
After discussing this with Reduz this seemed like the best way to
fix #7354. This will make composite values that contain NaN in the same
places as well as the same other values compare as the same.

Additionally non-composite values now also compare equal if they are
both NaN. This breaks IEEE specifications but this is probably what most
users expect. There is a GDScript function check for NaN if the user
needs this information.

This fixes #7354 and probably also fixes #6947
2017-02-14 13:32:23 +01:00
Hein-Pieter van Braam 411ee71b4d Rename the _MD macro to D_METHOD
This new name also makes its purpose a little clearer

This is a step towards fixing #56
2017-02-13 12:50:02 +01:00
Juan Linietsky 0aa7242624 WIP new AudioServer, with buses, effects, etc. 2017-01-21 19:01:00 -03:00
Juan Linietsky ee0f53df52 Merge pull request #7528 from tagcup/real_t_float_fixes
Use real_t rather than float or double in generic functions (core/mat…
2017-01-20 19:24:49 -03:00
BastiaanOlij d11a4c1120 Some changes in the header so Godot3 compiles again on Windows. 2017-01-18 21:55:47 +11:00
Ferenc Arn 6f4f9aa6de Overloaded basic math funcs (double and float variants). Use real_t rather than float or double in generic functions (core/math) whenever possible.
Also inlined some more math functions.
2017-01-16 13:36:33 -06:00
Rémi Verschelde bf05dab74f Merge pull request #7532 from tagcup/pcg_prng
Replace the existing PRNG (Xorshift31) with (minimal) PCG-32.
2017-01-16 20:06:54 +01:00
BastiaanOlij cef0ae5d5d Fix compile errors related to audio on OSX 2017-01-16 20:32:44 +11:00
Rémi Verschelde 2a0ddc1e89 Style: Various fixes to play nice with clang-format 2017-01-16 08:49:52 +01:00
Rémi Verschelde f44ee891be Style: Fix statements ending with ';;' 2017-01-16 08:49:52 +01:00
Rémi Verschelde 3890256fc5 Style: Cleanups, added headers, renamed files
Made sure files in core/ and tools/ have a proper Godot license header
when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h}
to rect3.{cpp,h} and class_db.{cpp,h} respectively.

Also added a proper header to core/io/base64.{c,h} after clarifying
the licensing with the original author (public domain).
2017-01-16 08:04:23 +01:00
Ferenc Arn 4c9004671a Replace the existing PRNG (Xorshift31) with (minimal) PCG (XSH-RR variant with 32-bit output, 64-bit state).
PCG is better than many alternatives by many metrics (see www.pcg-random.org) including statistical quality with good speed.
2017-01-15 19:15:16 -06:00