2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* curve.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#ifndef CURVE_H
|
|
|
|
#define CURVE_H
|
|
|
|
|
2020-11-07 23:33:38 +01:00
|
|
|
#include "core/io/resource.h"
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2017-04-30 16:27:10 +02:00
|
|
|
// y(x) curve
|
|
|
|
class Curve : public Resource {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(Curve, Resource);
|
|
|
|
|
2017-04-30 16:27:10 +02:00
|
|
|
public:
|
|
|
|
static const int MIN_X = 0.f;
|
|
|
|
static const int MAX_X = 1.f;
|
|
|
|
|
2017-06-26 23:39:35 +02:00
|
|
|
static const char *SIGNAL_RANGE_CHANGED;
|
|
|
|
|
|
|
|
enum TangentMode {
|
|
|
|
TANGENT_FREE = 0,
|
|
|
|
TANGENT_LINEAR,
|
|
|
|
TANGENT_MODE_COUNT
|
|
|
|
};
|
|
|
|
|
2017-04-30 16:27:10 +02:00
|
|
|
struct Point {
|
2021-10-15 22:32:26 +02:00
|
|
|
Vector2 position;
|
2021-02-09 18:24:36 +01:00
|
|
|
real_t left_tangent = 0.0;
|
|
|
|
real_t right_tangent = 0.0;
|
|
|
|
TangentMode left_mode = TANGENT_FREE;
|
|
|
|
TangentMode right_mode = TANGENT_FREE;
|
2017-04-30 16:27:10 +02:00
|
|
|
|
|
|
|
Point() {
|
|
|
|
}
|
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
Point(const Vector2 &p_position,
|
2021-02-09 18:24:36 +01:00
|
|
|
real_t p_left = 0.0,
|
|
|
|
real_t p_right = 0.0,
|
2017-06-28 02:42:38 +02:00
|
|
|
TangentMode p_left_mode = TANGENT_FREE,
|
|
|
|
TangentMode p_right_mode = TANGENT_FREE) {
|
2021-10-15 22:32:26 +02:00
|
|
|
position = p_position;
|
2017-06-28 02:42:38 +02:00
|
|
|
left_tangent = p_left;
|
|
|
|
right_tangent = p_right;
|
|
|
|
left_mode = p_left_mode;
|
|
|
|
right_mode = p_right_mode;
|
2017-04-30 16:27:10 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Curve();
|
|
|
|
|
|
|
|
int get_point_count() const { return _points.size(); }
|
|
|
|
|
2022-02-12 19:12:22 +01:00
|
|
|
void set_point_count(int p_count);
|
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
int add_point(Vector2 p_position,
|
2017-06-28 02:42:38 +02:00
|
|
|
real_t left_tangent = 0,
|
|
|
|
real_t right_tangent = 0,
|
|
|
|
TangentMode left_mode = TANGENT_FREE,
|
|
|
|
TangentMode right_mode = TANGENT_FREE);
|
2023-03-13 23:03:36 +01:00
|
|
|
int add_point_no_update(Vector2 p_position,
|
|
|
|
real_t left_tangent = 0,
|
|
|
|
real_t right_tangent = 0,
|
|
|
|
TangentMode left_mode = TANGENT_FREE,
|
|
|
|
TangentMode right_mode = TANGENT_FREE);
|
2017-04-30 16:27:10 +02:00
|
|
|
void remove_point(int p_index);
|
|
|
|
void clear_points();
|
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
int get_index(real_t p_offset) const;
|
2017-04-30 16:27:10 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
void set_point_value(int p_index, real_t p_position);
|
|
|
|
int set_point_offset(int p_index, real_t p_offset);
|
2017-09-10 15:37:49 +02:00
|
|
|
Vector2 get_point_position(int p_index) const;
|
2017-04-30 16:27:10 +02:00
|
|
|
|
2017-06-28 02:42:38 +02:00
|
|
|
Point get_point(int p_index) const;
|
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_min_value() const { return _min_value; }
|
|
|
|
void set_min_value(real_t p_min);
|
2017-06-26 23:39:35 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_max_value() const { return _max_value; }
|
|
|
|
void set_max_value(real_t p_max);
|
2017-06-26 23:39:35 +02:00
|
|
|
|
2023-03-13 23:03:36 +01:00
|
|
|
real_t get_range() const { return _max_value - _min_value; }
|
|
|
|
|
2022-07-24 18:47:57 +02:00
|
|
|
real_t sample(real_t p_offset) const;
|
|
|
|
real_t sample_local_nocheck(int p_index, real_t p_local_offset) const;
|
2017-04-30 16:27:10 +02:00
|
|
|
|
|
|
|
void clean_dupes();
|
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
void set_point_left_tangent(int p_index, real_t p_tangent);
|
|
|
|
void set_point_right_tangent(int p_index, real_t p_tangent);
|
|
|
|
void set_point_left_mode(int p_index, TangentMode p_mode);
|
|
|
|
void set_point_right_mode(int p_index, TangentMode p_mode);
|
2017-06-26 23:39:35 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_point_left_tangent(int p_index) const;
|
|
|
|
real_t get_point_right_tangent(int p_index) const;
|
|
|
|
TangentMode get_point_left_mode(int p_index) const;
|
|
|
|
TangentMode get_point_right_mode(int p_index) const;
|
2017-06-26 23:39:35 +02:00
|
|
|
|
|
|
|
void update_auto_tangents(int i);
|
2017-04-30 16:27:10 +02:00
|
|
|
|
|
|
|
Array get_data() const;
|
|
|
|
void set_data(Array input);
|
|
|
|
|
|
|
|
void bake();
|
|
|
|
int get_bake_resolution() const { return _bake_resolution; }
|
2017-08-11 21:10:05 +02:00
|
|
|
void set_bake_resolution(int p_resolution);
|
2022-07-24 18:47:57 +02:00
|
|
|
real_t sample_baked(real_t p_offset) const;
|
2017-04-30 16:27:10 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
void ensure_default_setup(real_t p_min, real_t p_max);
|
2018-07-07 01:21:13 +02:00
|
|
|
|
2022-02-12 19:12:22 +01:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
|
|
|
|
2017-04-30 16:27:10 +02:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void mark_dirty();
|
2022-06-22 14:17:28 +02:00
|
|
|
int _add_point(Vector2 p_position,
|
|
|
|
real_t left_tangent = 0,
|
|
|
|
real_t right_tangent = 0,
|
|
|
|
TangentMode left_mode = TANGENT_FREE,
|
|
|
|
TangentMode right_mode = TANGENT_FREE);
|
|
|
|
void _remove_point(int p_index);
|
2017-04-30 16:27:10 +02:00
|
|
|
|
|
|
|
Vector<Point> _points;
|
2021-02-09 18:24:36 +01:00
|
|
|
bool _baked_cache_dirty = false;
|
2017-04-30 16:27:10 +02:00
|
|
|
Vector<real_t> _baked_cache;
|
2021-02-09 18:24:36 +01:00
|
|
|
int _bake_resolution = 100;
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t _min_value = 0.0;
|
|
|
|
real_t _max_value = 1.0;
|
2021-02-09 18:24:36 +01:00
|
|
|
int _minmax_set_once = 0b00; // Encodes whether min and max have been set a first time, first bit for min and second for max.
|
2017-04-30 16:27:10 +02:00
|
|
|
};
|
|
|
|
|
2017-06-26 23:39:35 +02:00
|
|
|
VARIANT_ENUM_CAST(Curve::TangentMode)
|
|
|
|
|
2014-07-06 16:49:27 +02:00
|
|
|
class Curve2D : public Resource {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(Curve2D, Resource);
|
2014-07-06 16:49:27 +02:00
|
|
|
|
|
|
|
struct Point {
|
|
|
|
Vector2 in;
|
|
|
|
Vector2 out;
|
2021-10-15 22:32:26 +02:00
|
|
|
Vector2 position;
|
2014-07-06 16:49:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Vector<Point> points;
|
|
|
|
|
|
|
|
struct BakedPoint {
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t ofs = 0.0;
|
2014-07-06 16:49:27 +02:00
|
|
|
Vector2 point;
|
|
|
|
};
|
|
|
|
|
2021-02-09 18:24:36 +01:00
|
|
|
mutable bool baked_cache_dirty = false;
|
2020-02-17 22:06:54 +01:00
|
|
|
mutable PackedVector2Array baked_point_cache;
|
2022-11-24 13:43:34 +01:00
|
|
|
mutable PackedVector2Array baked_forward_vector_cache;
|
2021-10-15 22:32:26 +02:00
|
|
|
mutable Vector<real_t> baked_dist_cache;
|
|
|
|
mutable real_t baked_max_ofs = 0.0;
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2022-02-12 19:11:08 +01:00
|
|
|
void mark_dirty();
|
|
|
|
|
2022-12-07 16:37:59 +01:00
|
|
|
static Vector2 _calculate_tangent(const Vector2 &p_begin, const Vector2 &p_control_1, const Vector2 &p_control_2, const Vector2 &p_end, const real_t p_t);
|
2014-07-06 16:49:27 +02:00
|
|
|
void _bake() const;
|
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t bake_interval = 5.0;
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2022-11-24 13:43:34 +01:00
|
|
|
struct Interval {
|
|
|
|
int idx;
|
|
|
|
real_t frac;
|
|
|
|
};
|
|
|
|
Interval _find_interval(real_t p_offset) const;
|
|
|
|
Vector2 _sample_baked(Interval p_interval, bool p_cubic) const;
|
|
|
|
Transform2D _sample_posture(Interval p_interval) const;
|
|
|
|
|
2022-05-16 18:17:02 +02:00
|
|
|
void _bake_segment2d(RBMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_tol) const;
|
2022-11-24 13:43:34 +01:00
|
|
|
void _bake_segment2d_even_length(RBMap<real_t, Vector2> &r_bake, real_t p_begin, real_t p_end, const Vector2 &p_a, const Vector2 &p_out, const Vector2 &p_b, const Vector2 &p_in, int p_depth, int p_max_depth, real_t p_length) const;
|
2014-07-06 16:49:27 +02:00
|
|
|
Dictionary _get_data() const;
|
|
|
|
void _set_data(const Dictionary &p_data);
|
|
|
|
|
2022-02-12 19:12:22 +01:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
|
|
|
|
2022-06-23 20:00:05 +02:00
|
|
|
void _add_point(const Vector2 &p_position, const Vector2 &p_in = Vector2(), const Vector2 &p_out = Vector2(), int p_atpos = -1);
|
|
|
|
void _remove_point(int p_index);
|
|
|
|
|
2022-11-24 13:43:34 +01:00
|
|
|
Vector<RBMap<real_t, Vector2>> _tessellate_even_length(int p_max_stages = 5, real_t p_length = 0.2) const;
|
|
|
|
|
2014-07-06 16:49:27 +02:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
int get_point_count() const;
|
2022-02-12 19:12:22 +01:00
|
|
|
void set_point_count(int p_count);
|
2021-10-15 22:32:26 +02:00
|
|
|
void add_point(const Vector2 &p_position, const Vector2 &p_in = Vector2(), const Vector2 &p_out = Vector2(), int p_atpos = -1);
|
|
|
|
void set_point_position(int p_index, const Vector2 &p_position);
|
2017-09-10 15:37:49 +02:00
|
|
|
Vector2 get_point_position(int p_index) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_point_in(int p_index, const Vector2 &p_in);
|
2014-07-06 16:49:27 +02:00
|
|
|
Vector2 get_point_in(int p_index) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_point_out(int p_index, const Vector2 &p_out);
|
2014-07-06 16:49:27 +02:00
|
|
|
Vector2 get_point_out(int p_index) const;
|
|
|
|
void remove_point(int p_index);
|
2016-12-03 21:35:59 +01:00
|
|
|
void clear_points();
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2022-07-24 18:47:57 +02:00
|
|
|
Vector2 sample(int p_index, real_t p_offset) const;
|
|
|
|
Vector2 samplef(real_t p_findex) const;
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
void set_bake_interval(real_t p_tolerance);
|
|
|
|
real_t get_bake_interval() const;
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_baked_length() const;
|
2022-07-24 18:47:57 +02:00
|
|
|
Vector2 sample_baked(real_t p_offset, bool p_cubic = false) const;
|
2022-11-24 13:43:34 +01:00
|
|
|
Transform2D sample_baked_with_rotation(real_t p_offset, bool p_cubic = false) const;
|
2020-02-17 22:06:54 +01:00
|
|
|
PackedVector2Array get_baked_points() const; //useful for going through
|
2018-04-25 01:28:17 +02:00
|
|
|
Vector2 get_closest_point(const Vector2 &p_to_point) const;
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_closest_offset(const Vector2 &p_to_point) const;
|
2014-07-06 16:49:27 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
PackedVector2Array tessellate(int p_max_stages = 5, real_t p_tolerance = 4) const; //useful for display
|
2022-11-24 13:43:34 +01:00
|
|
|
PackedVector2Array tessellate_even_length(int p_max_stages = 5, real_t p_length = 20.0) const; // Useful for baking.
|
2014-07-06 16:49:27 +02:00
|
|
|
|
|
|
|
Curve2D();
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class Curve3D : public Resource {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(Curve3D, Resource);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
struct Point {
|
|
|
|
Vector3 in;
|
|
|
|
Vector3 out;
|
2021-10-15 22:32:26 +02:00
|
|
|
Vector3 position;
|
|
|
|
real_t tilt = 0.0;
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Vector<Point> points;
|
2022-11-17 16:42:00 +01:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
// For Path3DGizmo.
|
|
|
|
mutable Vector<size_t> points_in_cache;
|
|
|
|
#endif
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-02-09 18:24:36 +01:00
|
|
|
mutable bool baked_cache_dirty = false;
|
2020-02-17 22:06:54 +01:00
|
|
|
mutable PackedVector3Array baked_point_cache;
|
2021-08-10 00:15:17 +02:00
|
|
|
mutable Vector<real_t> baked_tilt_cache;
|
2020-02-17 22:06:54 +01:00
|
|
|
mutable PackedVector3Array baked_up_vector_cache;
|
2022-11-23 04:11:58 +01:00
|
|
|
mutable PackedVector3Array baked_forward_vector_cache;
|
2021-10-15 22:32:26 +02:00
|
|
|
mutable Vector<real_t> baked_dist_cache;
|
|
|
|
mutable real_t baked_max_ofs = 0.0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-02-12 19:11:08 +01:00
|
|
|
void mark_dirty();
|
|
|
|
|
2022-12-07 16:37:59 +01:00
|
|
|
static Vector3 _calculate_tangent(const Vector3 &p_begin, const Vector3 &p_control_1, const Vector3 &p_control_2, const Vector3 &p_end, const real_t p_t);
|
2014-02-10 02:10:30 +01:00
|
|
|
void _bake() const;
|
|
|
|
|
2022-08-07 12:29:12 +02:00
|
|
|
struct Interval {
|
|
|
|
int idx;
|
|
|
|
real_t frac;
|
|
|
|
};
|
|
|
|
Interval _find_interval(real_t p_offset) const;
|
|
|
|
Vector3 _sample_baked(Interval p_interval, bool p_cubic) const;
|
|
|
|
real_t _sample_baked_tilt(Interval p_interval) const;
|
|
|
|
Basis _sample_posture(Interval p_interval, bool p_apply_tilt = false) const;
|
2022-11-17 16:42:00 +01:00
|
|
|
Basis _compose_posture(int p_index) const;
|
2022-08-07 12:29:12 +02:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t bake_interval = 0.2;
|
2021-02-09 18:24:36 +01:00
|
|
|
bool up_vector_enabled = true;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-05-16 18:17:02 +02:00
|
|
|
void _bake_segment3d(RBMap<real_t, Vector3> &r_bake, real_t p_begin, real_t p_end, const Vector3 &p_a, const Vector3 &p_out, const Vector3 &p_b, const Vector3 &p_in, int p_depth, int p_max_depth, real_t p_tol) const;
|
2022-11-23 04:11:58 +01:00
|
|
|
void _bake_segment3d_even_length(RBMap<real_t, Vector3> &r_bake, real_t p_begin, real_t p_end, const Vector3 &p_a, const Vector3 &p_out, const Vector3 &p_b, const Vector3 &p_in, int p_depth, int p_max_depth, real_t p_length) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
Dictionary _get_data() const;
|
|
|
|
void _set_data(const Dictionary &p_data);
|
|
|
|
|
2022-02-12 19:12:22 +01:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
|
|
|
|
2022-06-23 20:00:05 +02:00
|
|
|
void _add_point(const Vector3 &p_position, const Vector3 &p_in = Vector3(), const Vector3 &p_out = Vector3(), int p_atpos = -1);
|
|
|
|
void _remove_point(int p_index);
|
|
|
|
|
2022-11-23 04:11:58 +01:00
|
|
|
Vector<RBMap<real_t, Vector3>> _tessellate_even_length(int p_max_stages = 5, real_t p_length = 0.2) const;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2022-11-17 16:42:00 +01:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
// For Path3DGizmo.
|
|
|
|
Basis get_point_baked_posture(int p_index, bool p_apply_tilt = false) const;
|
|
|
|
#endif
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
int get_point_count() const;
|
2022-02-12 19:12:22 +01:00
|
|
|
void set_point_count(int p_count);
|
2021-10-15 22:32:26 +02:00
|
|
|
void add_point(const Vector3 &p_position, const Vector3 &p_in = Vector3(), const Vector3 &p_out = Vector3(), int p_atpos = -1);
|
|
|
|
void set_point_position(int p_index, const Vector3 &p_position);
|
2017-09-10 15:37:49 +02:00
|
|
|
Vector3 get_point_position(int p_index) const;
|
2021-10-15 22:32:26 +02:00
|
|
|
void set_point_tilt(int p_index, real_t p_tilt);
|
|
|
|
real_t get_point_tilt(int p_index) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_point_in(int p_index, const Vector3 &p_in);
|
2014-02-10 02:10:30 +01:00
|
|
|
Vector3 get_point_in(int p_index) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_point_out(int p_index, const Vector3 &p_out);
|
2014-02-10 02:10:30 +01:00
|
|
|
Vector3 get_point_out(int p_index) const;
|
|
|
|
void remove_point(int p_index);
|
2016-12-03 21:35:59 +01:00
|
|
|
void clear_points();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-07-24 18:47:57 +02:00
|
|
|
Vector3 sample(int p_index, real_t p_offset) const;
|
|
|
|
Vector3 samplef(real_t p_findex) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
void set_bake_interval(real_t p_tolerance);
|
|
|
|
real_t get_bake_interval() const;
|
2018-05-19 00:14:25 +02:00
|
|
|
void set_up_vector_enabled(bool p_enable);
|
|
|
|
bool is_up_vector_enabled() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_baked_length() const;
|
2022-07-24 18:47:57 +02:00
|
|
|
Vector3 sample_baked(real_t p_offset, bool p_cubic = false) const;
|
2022-08-07 12:29:12 +02:00
|
|
|
Transform3D sample_baked_with_rotation(real_t p_offset, bool p_cubic = false, bool p_apply_tilt = false) const;
|
2022-07-24 18:47:57 +02:00
|
|
|
real_t sample_baked_tilt(real_t p_offset) const;
|
|
|
|
Vector3 sample_baked_up_vector(real_t p_offset, bool p_apply_tilt = false) const;
|
2022-08-07 12:29:12 +02:00
|
|
|
PackedVector3Array get_baked_points() const; // Useful for going through.
|
2021-08-10 00:15:17 +02:00
|
|
|
Vector<real_t> get_baked_tilts() const; //useful for going through
|
2020-02-17 22:06:54 +01:00
|
|
|
PackedVector3Array get_baked_up_vectors() const;
|
2018-04-25 01:28:17 +02:00
|
|
|
Vector3 get_closest_point(const Vector3 &p_to_point) const;
|
2021-10-15 22:32:26 +02:00
|
|
|
real_t get_closest_offset(const Vector3 &p_to_point) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-11-23 04:11:58 +01:00
|
|
|
PackedVector3Array tessellate(int p_max_stages = 5, real_t p_tolerance = 4) const; // Useful for display.
|
|
|
|
PackedVector3Array tessellate_even_length(int p_max_stages = 5, real_t p_length = 0.2) const; // Useful for baking.
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Curve3D();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CURVE_H
|