Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
index 707e295241a..2c515d587c0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.c
@@ -44,13 +44,26 @@ static bNodeSocketTemplate sh_node_sephsv_out[] = {
{ -1, 0, "" }
};
+static void node_shader_exec_sephsv(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
+{
+ rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2],
+ &out[0]->vec[0], &out[1]->vec[0], &out[2]->vec[0]);
+}
+
+static int gpu_shader_sephsv(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "separate_hsv", in, out);
+}
+
void register_node_type_sh_sephsv(void)
{
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTOR, 0);
- node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_sephsv_in, sh_node_sephsv_out);
+ node_type_exec(&ntype, NULL, NULL, node_shader_exec_sephsv);
+ node_type_gpu(&ntype, gpu_shader_sephsv);
nodeRegisterType(&ntype);
}
@@ -68,13 +81,26 @@ static bNodeSocketTemplate sh_node_combhsv_out[] = {
{ -1, 0, "" }
};
+static void node_shader_exec_combhsv(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
+{
+ hsv_to_rgb(in[0]->vec[0], in[1]->vec[0], in[2]->vec[0],
+ &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2]);
+}
+
+static int gpu_shader_combhsv(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "combine_hsv", in, out);
+}
+
void register_node_type_sh_combhsv(void)
{
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTOR, 0);
- node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
node_type_socket_templates(&ntype, sh_node_combhsv_in, sh_node_combhsv_out);
+ node_type_exec(&ntype, NULL, NULL, node_shader_exec_combhsv);
+ node_type_gpu(&ntype, gpu_shader_combhsv);
nodeRegisterType(&ntype);
}