Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_valToRgb.c
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| float *array; | float *array; | ||||
| int size; | int size; | ||||
| colorband_table_RGBA(node->storage, &array, &size); | colorband_table_RGBA(node->storage, &array, &size); | ||||
| return GPU_stack_link(mat, "valtorgb", in, out, GPU_texture(size, array)); | return GPU_stack_link(mat, node, "valtorgb", in, out, GPU_texture(size, array)); | ||||
| } | } | ||||
| void register_node_type_sh_valtorgb(void) | void register_node_type_sh_valtorgb(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, 0); | sh_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, 0); | ||||
| node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); | node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); | ||||
| Show All 24 Lines | static void node_shader_exec_rgbtobw(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) | ||||
| /* stack order out: bw */ | /* stack order out: bw */ | ||||
| /* stack order in: col */ | /* stack order in: col */ | ||||
| float col[3]; | float col[3]; | ||||
| nodestack_get_vec(col, SOCK_VECTOR, in[0]); | nodestack_get_vec(col, SOCK_VECTOR, in[0]); | ||||
| out[0]->vec[0] = IMB_colormanagement_get_luminance(col); | out[0]->vec[0] = IMB_colormanagement_get_luminance(col); | ||||
| } | } | ||||
| static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| return GPU_stack_link(mat, "rgbtobw", in, out); | return GPU_stack_link(mat, node, "rgbtobw", in, out); | ||||
| } | } | ||||
| void register_node_type_sh_rgbtobw(void) | void register_node_type_sh_rgbtobw(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); | sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); | ||||
| node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); | node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); | ||||
| node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out); | node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out); | ||||
| node_type_exec(&ntype, NULL, NULL, node_shader_exec_rgbtobw); | node_type_exec(&ntype, NULL, NULL, node_shader_exec_rgbtobw); | ||||
| node_type_gpu(&ntype, gpu_shader_rgbtobw); | node_type_gpu(&ntype, gpu_shader_rgbtobw); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||