42 bNode *
UNUSED(
node),
float *out,
float hue,
float sat,
float val,
const float in[4],
float fac)
44 if (fac != 0.0f && (hue != 0.5f || sat != 1.0f || val != 1.0f)) {
45 float col[3], hsv[3], mfac = 1.0f - fac;
47 rgb_to_hsv(in[0], in[1], in[2], hsv, hsv + 1, hsv + 2);
48 hsv[0] =
fmodf(hsv[0] + hue + 0.5f, 1.0f);
49 hsv[1] =
clamp_f(hsv[1] * sat, 0.0f, 1.0f);
53 out[0] = mfac * in[0] + fac *
col[0];
54 out[1] = mfac * in[1] + fac *
col[1];
55 out[2] = mfac * in[2] + fac *
col[2];
69 float hue, sat, val, fac;
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn)
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
#define NODE_CLASS_OP_COLOR
void node_type_exec(struct bNodeType *ntype, NodeInitExecFunction init_exec_fn, NodeFreeExecFunction free_exec_fn, NodeExecFunction exec_fn)
void nodeRegisterType(struct bNodeType *ntype)
MINLINE float clamp_f(float value, float min, float max)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
MINLINE void copy_v4_v4(float r[4], const float a[4])
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
static bNodeSocketTemplate sh_node_hue_sat_out[]
static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, const float in[4], float fac)
static bNodeSocketTemplate sh_node_hue_sat_in[]
static void node_shader_exec_hue_sat(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
void register_node_type_sh_hue_sat(void)
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag)
void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
Compact definition of a node socket.