summaryrefslogtreecommitdiff
path: root/scene/resources/curve.h
AgeCommit message (Collapse)Author
2022-12-14Handle corner cases for curve bakingYaohua Xiong
When control point and point have equal position, the derivative is 0 vector, which cause error message in Basis::look_at(). This commit handles this case.
2022-12-05Refactor baking code for Curve2DYaohua Xiong
The main change is to caculate tangent directly from bezier curve, without going through discretized polyline, avoiding pitfalls of discretization. A similar refacor had been applied to Curve3D. The test cases for Curve2D is updated, comparing floating point with is_equal_approxmiate() instead of `==`, in order to avoid float precision problem.
2022-11-24Refactor Curve3D::_bake() methodYaohua Xiong
The main change is to caculate tangent directly from bezier curve, without going through discretized polyline, avoiding pitfalls of discretization. Other changes are: 1. Add an bezier_derivative() method for Vector3, Vector2, and Math; 2. Add an tesselate_even_length() method to Curve3D, which tesselate bezier curve to even length segments adaptively; 3. Cache the tangent vectors in baked_tangent_vector_cache;
2022-11-12Refactor Curv3D and PathFollow3DYaohua Xiong
This commit makes the following major changes 1. Add "sample_baked_with_rotation()" to Curve3D, making it usable independently. A similar change was made to Curve2D previously. 2. Refactor the _bake() method on Curve3D, using Parallel Transport Frame instead of Frenet Frame. 3. Refactor the sample_* methods, including: i. Factor out common binary search code, following the DRY principe ii. sample_up_vector() interpolated up vector as part of rotation frame(posture) for consistancy and accuracy.
2022-11-01Move rotation sampling from Path2D to Curve2DYaohua Xiong
The rotation sampling code is moved from Path2D to a new method `sample_baked_with_rotation` on Curve2D.
2022-08-30Rename Curve/Curve2D/Curve3D/Gradient `interpolate()` to `sample()`Hugo Locurcio
"sampling" is a more accurate term than "interpolating" for what's happening when using that function.
2022-06-23Fix Curve{2D,3D} notifying property list changedRaul Santos
Make `Curve2D` and `Curve3D` more consistent with `Curve` and avoid calling `notify_property_list_changed` when the list of points doesn't change.
2022-06-22Fixed dragging curve pointsVitika9
2022-05-17Expose Curve points in the inspectorRaul Santos
Exposes the Curve, Curve2D and Curve3D points as an array property.
2022-05-17Implement `mark_dirty` in Curve2D and Curve3DRaul Santos
Implements a method `mark_dirty` in Curve2D and Curve3D like the one that already exists in Curve, it's a convenient way to set `baked_cache_dirty` to `true` and also emit the `changed` signal.
2022-05-16Regression: Fix Curve2D/Curve3D bakingHendrik Brucker
2022-05-16Replace most uses of Map by HashMapreduz
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-11-30Improve Curve with const and real_tAaron Franke
2021-08-21Curve2D/Curve3D: exact linear interpolationJihyun Yu
While calculating interpolated points, intervals between two baked points has been assummed to be `baked_interval`. The assumption could cause significant error in some extreme cases (for example #7088). To improve accuracy, `baked_dist_cache` is introduced, which stores distance from starting point for each baked points. `interpolate_baked` now returns exact linear-interpolated position along baked points.
2021-08-09Some work on double supportAaron Franke
2021-04-30Implement Particle Trailsreduz
-Enable the trails and set the length in seconds -Provide a mesh with a skeleton and a skin -Or, alternatively use one of the built-in TubeTrailMesh/RibbonTrailMesh -Works deterministically -Fixed particle collisions (were broken) -Not working in 2D yet (that will happen next)
2021-02-09Initialize class variables with default values in scene/ [2/2]Rafał Mikrut
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-06-21Curve: Prevent forcing 1.0 min value to 0.99Rémi Verschelde
The setters are called when the property is first initialized, and before that its default min and max are 0.0 and 1.0 respectively. If you configured min_value to 1.0 and max_value to e.g. 3.0, since the min_value setter can be called before that of max_value (which thus still defaults to 1.0), the min will be set to 0.99. Same conflict could happen with a configured max_value of 0 if its setter is called before that of a valid, negative min value.
2019-06-19Made use of semicolons more consitent, fixed formattingJohnJLight
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
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-07-06Support for CPU based particles, which aids compatibility with OpenGL ES 2.0Juan Linietsky
2018-05-20Up vector implementation and OrientedPathFollow.danilo2205
2018-05-01Added methods get_closest_point and get_closest_offset to both Curve2D and ↵danilo2205
Curve3D
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
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-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-09-20Rename pos to position in user facing methods and variablesletheed
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-08-27Dead code tells no talesRémi Verschelde
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-16Synchronize parameter names in definition and declarationTwistedTwigleg
Fixes #10244.
2017-07-19Add object type hint for docsPoommetee Ketson
2017-06-28Fix curve saving, refined undo/redoMarc Gilleron
2017-06-26Curve featuresMarc Gilleron
- Ability to set tangents as linear - Indicative min and max values - CurveTexture doesn't need min and max anymore
2017-06-24Added Curve resourceMarc Gilleron
- New resource for curves in y(x) form - CurveTexture now has a Curve - Curve and CurveTexture share the same editor
2017-04-08Add "Godot Engine contributors" copyright lineRémi Verschelde
2017-03-24Fix typos in source code using codespellRémi Verschelde
From https://github.com/lucasdemarchi/codespell
2017-03-05A Whole New World (clang-format edition)Rémi Verschelde
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-01-11Type renames:Juan Linietsky
Matrix32 -> Transform2D Matrix3 -> Basis AABB -> Rect3 RawArray -> PoolByteArray IntArray -> PoolIntArray FloatArray -> PoolFloatArray Vector2Array -> PoolVector2Array Vector3Array -> PoolVector3Array ColorArray -> PoolColorArray
2017-01-07Memory pool vectors (DVector) have been enormously simplified in code, and ↵Juan Linietsky
renamed to PoolVector
2017-01-02ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to ↵Juan Linietsky
Variant. All usages of "type" to refer to classes were renamed to "class" ClassDB has been exposed to GDScript. OBJ_TYPE() macro is now GDCLASS()
2017-01-01Welcome in 2017, dear changelog reader!Rémi Verschelde
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer with state-of-the-art rendering techniques tuned to work as low as middle end handheld devices - without compromising with the possibilities given for higher end desktop games of course. Great times ahead for the Godot community and the gamers that will play our games!
2016-12-03Curve2D/3D: Add clear_points method.Andreas Haas
Adds a method to the Curve2D and Curve3D classes to easily clear the curve. So you don't have to remove each point manually.
2016-01-01Update copyright to 2016 in headersGeorge Marques