feat: WIP terrain path modifiers
This commit is contained in:
parent
4d4427949d
commit
31a9986066
4 changed files with 288 additions and 74 deletions
|
|
@ -14,25 +14,22 @@ class TerrainModifier : public Marker3D {
|
|||
|
||||
protected:
|
||||
void _notification(int what);
|
||||
float blend(float under, float over);
|
||||
void push_changed(Rect2 bounds);
|
||||
|
||||
public:
|
||||
virtual float evaluate_at(Vector2 world_coordinate, float before);
|
||||
|
||||
private:
|
||||
float blend_distance{ 10.0 };
|
||||
Vector3 thread_safe_global_position{};
|
||||
Terrain *terrain{ nullptr };
|
||||
Rect2 bounds{ { -INFINITY, -INFINITY }, { INFINITY, INFINITY } };
|
||||
|
||||
protected:
|
||||
GET_SET_FNS(Rect2, bounds);
|
||||
void set_bounds(Rect2 bounds);
|
||||
Rect2 get_bounds() const;
|
||||
|
||||
public:
|
||||
Vector3 get_thread_safe_global_position() const;
|
||||
void set_blend_distance(float value);
|
||||
float get_blend_distance() const;
|
||||
GET_SET_FNS(Terrain *, terrain);
|
||||
};
|
||||
|
||||
|
|
@ -55,7 +52,7 @@ class TerrainModifierDistance : public TerrainModifier {
|
|||
|
||||
protected:
|
||||
void _notification(int what);
|
||||
virtual float distance_at(Vector2 const &world_coordinate);
|
||||
float distance_at(Vector2 const &world_coordinate);
|
||||
|
||||
public:
|
||||
float evaluate_at(Vector2 world_coordinate, float before) override;
|
||||
|
|
@ -69,3 +66,45 @@ public:
|
|||
void set_distance_weight_curve(Ref<Curve> curve);
|
||||
Ref<Curve> get_distance_weight_curve() const;
|
||||
};
|
||||
|
||||
class TerrainModifierPathPoint : public Marker3D {
|
||||
GDCLASS(TerrainModifierPathPoint, Marker3D);
|
||||
static void _bind_methods();
|
||||
|
||||
protected:
|
||||
void _notification(int what);
|
||||
|
||||
public:
|
||||
class TerrainModifierPath *path{ nullptr };
|
||||
};
|
||||
|
||||
class TerrainModifierPath : public TerrainModifier {
|
||||
GDCLASS(TerrainModifierPath, TerrainModifier);
|
||||
static void _bind_methods();
|
||||
void curves_changed();
|
||||
bool update_bounds();
|
||||
|
||||
protected:
|
||||
void _notification(int what);
|
||||
float evaluate_line(Vector3 a, Vector3 b, Vector2 world_coordinate, float &out_dot, float &out_distance);
|
||||
|
||||
public:
|
||||
float evaluate_at(Vector2 world_coordinate, float before) override;
|
||||
void path_changed();
|
||||
PackedStringArray get_configuration_warnings() const override;
|
||||
|
||||
private:
|
||||
SharedMutex lock{};
|
||||
float min_height{};
|
||||
float max_height{};
|
||||
bool closed{ false };
|
||||
Vector<Vector3> points{};
|
||||
Ref<Curve> curve_left{};
|
||||
Ref<Curve> curve_right{};
|
||||
|
||||
public:
|
||||
void set_curve_left(Ref<Curve> curve);
|
||||
Ref<Curve> get_curve_left() const;
|
||||
void set_curve_right(Ref<Curve> curve);
|
||||
Ref<Curve> get_curve_right() const;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue