summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
2018-12-12Merge pull request #24135 from Chaosus/rngRémi Verschelde
Added ranged integer generation function to RNG class
2018-12-11Moved member variables to initializer listWilson E. Alvarez
2018-12-06Added integer number generation function to RNG classChaosus
2018-11-20Remove trailing whitespaceRémi Verschelde
With `sed -i $(rg -l '[[:blank:]]*$' -g'!thirdparty') -e 's/[[:blank:]]*$//g'` (+ manual revert of some thirdparty code under `platform/android`).
2018-11-14Ensure that array passed to physics is always counter clockwise, fixes #15361.Juan Linietsky
2018-11-13Implement random number generatorChaosus
Co-authored-by: Zirak <zirakertan@gmail.com>
2018-11-02Remove unused "dtoll" methodsAaron Franke
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-10-28Error running Expression.execute after parse errorsantouits
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-07Merge pull request #22722 from akien-mga/fix-warningsRémi Verschelde
Fix more "may be used initialized" warnings from GCC 7
2018-10-06Remove redundant "== false" codeAaron Franke
Some of this code has been re-organized. f
2018-10-06Fix warnings in HTML5 build outside platform filesLeon Krause
2018-10-04Fix more "may be used initialized" warnings from GCC 7Rémi Verschelde
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-03Fix warnings on release builds (not DEBUG_ENABLED)Rémi Verschelde
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-02Merge pull request #21492 from Maykeye/astarRémi Verschelde
Changed A* exit condition, added 2 tests for it
2018-10-01Add support for '.[0-9]' numbers in ExpressionRémi Verschelde
Fixes #21874, supersedes #22065.
2018-09-28SCons: Build core's thirdparty code in own environmentRémi Verschelde
Also move Zlib and Zstd's build instructions to core/SCsub.
2018-09-23Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to ↵DualMatrix
core/math/ Removed obsoleted core/helper/value_evaluator.h and moved math_fieldwise to core/math/
2018-09-19Fix: Strip integer part in "decimals"Aaron Franke
Note: Core only.
2018-09-13Merge pull request #21982 from luzpaz/misc-typosRémi Verschelde
Misc. typos
2018-09-12Misc. typosluz.paz
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
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-08-29Add missing copyright headersRémi Verschelde
2018-08-28Changed A* exit condition, added 2 tests for itMaykeye
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-27Merge pull request #21205 from KellyThomas/c-sharp-feature-parity-quatIgnacio Etcheverry
[Mono] Quat - add some missing constructors and methods
2018-08-24Make some debug prints verbose-only, remove othersRémi Verschelde
2018-08-24mono: Quat - add some missing constructors and methodsKelly Thomas
2018-08-23Merge pull request #21305 from Mr-Slurpy/expression-fixRémi Verschelde
Fixed bugs in expression class
2018-08-23Fixed bugs in expression classDaniel Eliasinski
2018-08-22[Mono] Vector2/3 Project methodsAaron Franke
2018-08-20Remove faces in in QuickHull::build() that we don't need anymoreHein-Pieter van Braam
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-16add project method to Vector2/3Thomas Herzog
2018-08-11[Core] Completely kill math_2d.h, change includesAaron Franke
2018-08-11[Core] Move Vector2i and Rect2i out of math_2d.hAaron Franke
2018-08-10[Core] Move Rect2 and Transform2D to their own filesAaron Franke
Math2D includes Transform2D, which includes Rect2, which includes Vector2.
2018-08-10[Core] Grammar, move defs to defsAaron Franke
Math constant definitions belong in `math_defs.h`. Also, the grammer in these files really needed some updating.
2018-08-10[Core] Change math_2d includes to vector2 includes where relevantAaron Franke
2018-08-10[Core] Move Vector2 to its own fileAaron Franke
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-09Fix clang compile errorMarcelo Fernandez
2018-08-08Ability to pass custom variables to expression.Juan Linietsky
2018-08-08-Add Expression class, used to evaluate expressionsJuan Linietsky
-Added expression evaluation to EditorSpinSlider, fixes #20813, fixes #18932
2018-07-26Merge pull request #18955 from tagcup/fix_set_scaleRémi Verschelde
Removed incorrect Basis::set_scale().
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
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-24Removed unnecessary assignmentsWilson E. Alvarez
2018-07-05Merge pull request #19279 from aaronfranke/core-fposmod-fixMax Hilbrunner
[Core] [Math] Fix fposmod() function
2018-07-03Merge pull request #19819 from MetaSaval/masterMax Hilbrunner
Change the neighbours vector to a set in AStar
2018-06-27Change the neighbours vector to a set in AStarDanny
This fixes an issue where one could not disconnect two points that were connected more than once.
2018-06-25Merge pull request #19193 from tagcup/quat_normJuan Linietsky
Fixed Basis -> Quat conversions, added a few safety checks.
2018-06-21Added auto triangle generation in blend space, using Delaunay.Juan Linietsky
2018-06-13Polished 3D selectionJFonS
2018-06-10[Core] [Math] Fix fposmod() functionAaron Franke
ffff meth