Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_squeeze.c
| Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | static void node_shader_exec_squeeze(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) | ||||
| nodestack_get_vec(vec, SOCK_FLOAT, in[0]); | nodestack_get_vec(vec, SOCK_FLOAT, in[0]); | ||||
| nodestack_get_vec(vec + 1, SOCK_FLOAT, in[1]); | nodestack_get_vec(vec + 1, SOCK_FLOAT, in[1]); | ||||
| nodestack_get_vec(vec + 2, SOCK_FLOAT, in[2]); | nodestack_get_vec(vec + 2, SOCK_FLOAT, in[2]); | ||||
| out[0]->vec[0] = 1.0f / (1.0f + powf(M_E, -((vec[0] - vec[2]) * vec[1]))); | out[0]->vec[0] = 1.0f / (1.0f + powf(M_E, -((vec[0] - vec[2]) * vec[1]))); | ||||
| } | } | ||||
| static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| return GPU_stack_link(mat, "squeeze", in, out); | return GPU_stack_link(mat, node, "squeeze", in, out); | ||||
| } | } | ||||
| void register_node_type_sh_squeeze(void) | void register_node_type_sh_squeeze(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, 0); | sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, 0); | ||||
| node_type_compatibility(&ntype, NODE_OLD_SHADING); | node_type_compatibility(&ntype, NODE_OLD_SHADING); | ||||
| node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out); | node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out); | ||||
| node_type_storage(&ntype, "", NULL, NULL); | node_type_storage(&ntype, "", NULL, NULL); | ||||
| node_type_exec(&ntype, NULL, NULL, node_shader_exec_squeeze); | node_type_exec(&ntype, NULL, NULL, node_shader_exec_squeeze); | ||||
| node_type_gpu(&ntype, gpu_shader_squeeze); | node_type_gpu(&ntype, gpu_shader_squeeze); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||