summaryrefslogtreecommitdiff
path: root/scene/resources/shader_graph.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/shader_graph.h')
-rw-r--r--scene/resources/shader_graph.h39
1 files changed, 34 insertions, 5 deletions
diff --git a/scene/resources/shader_graph.h b/scene/resources/shader_graph.h
index c73895db8a..5c34bedadd 100644
--- a/scene/resources/shader_graph.h
+++ b/scene/resources/shader_graph.h
@@ -66,12 +66,15 @@ public:
NODE_VEC_TO_XFORM, // 3 vec input, 1 xform output
NODE_SCALAR_INTERP, // scalar interpolation (with optional curve)
NODE_VEC_INTERP, // vec3 interpolation (with optional curve)
- NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
+ NODE_COLOR_RAMP, //take scalar, output vec3
+ NODE_CURVE_MAP, //take scalar, otput scalar
+ NODE_SCALAR_INPUT, // scalar uniform (assignable in material)
NODE_VEC_INPUT, // vec3 uniform (assignable in material)
NODE_RGB_INPUT, // color uniform (assignable in material)
NODE_XFORM_INPUT, // mat4 uniform (assignable in material)
NODE_TEXTURE_INPUT, // texture input (assignable in material)
NODE_CUBEMAP_INPUT, // cubemap input (assignable in material)
+ NODE_DEFAULT_TEXTURE,
NODE_OUTPUT, // output (shader type dependent)
NODE_COMMENT, // comment
NODE_TYPE_MAX
@@ -115,7 +118,7 @@ public:
private:
- String _find_unique_name(ShaderType p_which, const String& p_base);
+ String _find_unique_name(const String& p_base);
struct SourceSlot {
@@ -151,6 +154,7 @@ private:
ShaderType shader_type;
const char *name;
const char *variable;
+ const char *postfix;
SlotType slot_type;
SlotDir dir;
};
@@ -171,10 +175,14 @@ private:
void _update_shader();
void _request_update();
+ void _plot_curve(const Vector2& p_a,const Vector2& p_b,const Vector2& p_c,const Vector2& p_d,uint8_t* p_heights,bool *p_useds);
void _add_node_code(ShaderType p_type,Node *p_node,const Vector<String>& p_inputs,String& code);
Array _get_node_list(ShaderType p_type) const;
Array _get_connections(ShaderType p_type) const;
+
+ void _set_data(const Dictionary& p_data);
+ Dictionary _get_data() const;
protected:
static void _bind_methods();
@@ -263,9 +271,8 @@ public:
RGB_MAX_OP
};
- void rgb_op_node_set_op(ShaderType p_which,float p_id,RGBOp p_op,float p_c);
+ void rgb_op_node_set_op(ShaderType p_which,float p_id,RGBOp p_op);
RGBOp rgb_op_node_get_op(ShaderType p_which,float p_id) const;
- float rgb_op_node_get_c(ShaderType p_which,float p_id) const;
void xform_vec_mult_node_set_no_translation(ShaderType p_which,int p_id,bool p_no_translation);
bool xform_vec_mult_node_get_no_translation(ShaderType p_which,int p_id) const;
@@ -310,6 +317,13 @@ public:
void vec_func_node_set_function(ShaderType p_which,int p_id,VecFunc p_func);
VecFunc vec_func_node_get_function(ShaderType p_which,int p_id) const;
+ void color_ramp_node_set_ramp(ShaderType p_which,int p_id,const DVector<Color>& p_colors, const DVector<real_t>& p_offsets);
+ DVector<Color> color_ramp_node_get_colors(ShaderType p_which,int p_id) const;
+ DVector<real_t> color_ramp_node_get_offsets(ShaderType p_which,int p_id) const;
+
+ void curve_map_node_set_points(ShaderType p_which, int p_id, const DVector<Vector2>& p_points);
+ DVector<Vector2> curve_map_node_get_points(ShaderType p_which,int p_id) const;
+
void input_node_set_name(ShaderType p_which,int p_id,const String& p_name);
String input_node_get_name(ShaderType p_which,int p_id);
@@ -345,6 +359,8 @@ public:
Variant node_get_state(ShaderType p_type, int p_node) const;
void node_set_state(ShaderType p_type, int p_id, const Variant& p_state);
+ GraphError get_graph_error(ShaderType p_type) const;
+
static int get_type_input_count(NodeType p_type);
static int get_type_output_count(NodeType p_type);
static SlotType get_type_input_type(NodeType p_type,int p_idx);
@@ -384,12 +400,12 @@ VARIANT_ENUM_CAST( ShaderGraph::VecScalarOp );
VARIANT_ENUM_CAST( ShaderGraph::RGBOp );
VARIANT_ENUM_CAST( ShaderGraph::ScalarFunc );
VARIANT_ENUM_CAST( ShaderGraph::VecFunc );
+VARIANT_ENUM_CAST( ShaderGraph::GraphError );
class MaterialShaderGraph : public ShaderGraph {
OBJ_TYPE( MaterialShaderGraph, ShaderGraph );
- RES_BASE_EXTENSION("sgp");
public:
@@ -399,4 +415,17 @@ public:
}
};
+class CanvasItemShaderGraph : public ShaderGraph {
+
+ OBJ_TYPE( CanvasItemShaderGraph, ShaderGraph );
+
+public:
+
+
+ CanvasItemShaderGraph() : ShaderGraph(MODE_CANVAS_ITEM) {
+
+ }
+};
+
+
#endif // SHADER_GRAPH_H