OverviewFilesCommitsIssuesDocsReleasesPeers

proc-nodes / src / nodes / curve_nodes.h

149 lines · c ref:
#ifndef PROC_NODES_CURVE_NODES_H
#define PROC_NODES_CURVE_NODES_H

#include "../graph/proc_node.h"

namespace godot {

// Generates a circular polyline curve
class CurveCircleNode : public ProcNode {
	GDCLASS(CurveCircleNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "CurveCircle"; }
	String get_node_title() const override { return "Curve Circle"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	CurveCircleNode();
};

// Generates a 2-point polyline from start to end
class CurveLineNode : public ProcNode {
	GDCLASS(CurveLineNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "CurveLine"; }
	String get_node_title() const override { return "Curve Line"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	CurveLineNode();
};

// Generates a 4-point cubic bezier segment
class BezierSegmentNode : public ProcNode {
	GDCLASS(BezierSegmentNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "BezierSegment"; }
	String get_node_title() const override { return "Bezier Segment"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	BezierSegmentNode();
};

// Sweep a profile curve along a path curve to create a tube/pipe mesh
class CurveToMeshNode : public ProcNode {
	GDCLASS(CurveToMeshNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "CurveToMesh"; }
	String get_node_title() const override { return "Curve to Mesh"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	CurveToMeshNode();
};

// Sample points along a curve
class CurveToPointsNode : public ProcNode {
	GDCLASS(CurveToPointsNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "CurveToPoints"; }
	String get_node_title() const override { return "Curve to Points"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	CurveToPointsNode();
};

// Resample a curve with evenly spaced points
class ResampleCurveNode : public ProcNode {
	GDCLASS(ResampleCurveNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "ResampleCurve"; }
	String get_node_title() const override { return "Resample Curve"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	ResampleCurveNode();
};

// Set radius for all curve points
class SetCurveRadiusNode : public ProcNode {
	GDCLASS(SetCurveRadiusNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "SetCurveRadius"; }
	String get_node_title() const override { return "Set Curve Radius"; }
	String get_node_category() const override { return "Curve"; }

	bool supports_gpu() const override { return true; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	SetCurveRadiusNode();
};

// Trim a curve by start/end parameters
class TrimCurveNode : public ProcNode {
	GDCLASS(TrimCurveNode, ProcNode);

protected:
	static void _bind_methods();

public:
	StringName get_node_type() const override { return "TrimCurve"; }
	String get_node_title() const override { return "Trim Curve"; }
	String get_node_category() const override { return "Curve"; }

	void execute(ProcEvalContext &p_ctx, int p_node_idx) override;

	TrimCurveNode();
};

} // namespace godot

#endif // PROC_NODES_CURVE_NODES_H