Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_layer_weight.c
| Show All 35 Lines | |||||
| }; | }; | ||||
| static bNodeSocketTemplate sh_node_layer_weight_out[] = { | static bNodeSocketTemplate sh_node_layer_weight_out[] = { | ||||
| { SOCK_FLOAT, 0, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | { SOCK_FLOAT, 0, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| { SOCK_FLOAT, 0, N_("Facing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | { SOCK_FLOAT, 0, N_("Facing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| if (!in[1].link) | if (!in[1].link) | ||||
| in[1].link = GPU_builtin(GPU_VIEW_NORMAL); | in[1].link = GPU_builtin(GPU_VIEW_NORMAL); | ||||
| else if (GPU_material_use_world_space_shading(mat)) { | else if (GPU_material_use_world_space_shading(mat)) { | ||||
| GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link); | GPU_link(mat, "direction_transform_m4v3", in[1].link, GPU_builtin(GPU_VIEW_MATRIX), &in[1].link); | ||||
| } | } | ||||
| return GPU_stack_link(mat, "node_layer_weight", in, out, GPU_builtin(GPU_VIEW_POSITION)); | return GPU_stack_link(mat, node, "node_layer_weight", in, out, GPU_builtin(GPU_VIEW_POSITION)); | ||||
| } | } | ||||
| static void node_shader_exec_layer_weight(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) | static void node_shader_exec_layer_weight(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) | ||||
| { | { | ||||
| ShadeInput *shi = ((ShaderCallData *)data)->shi; | ShadeInput *shi = ((ShaderCallData *)data)->shi; | ||||
| float blend = in[0]->vec[0]; | float blend = in[0]->vec[0]; | ||||
| float eta = max_ff(1 - blend, 0.00001); | float eta = max_ff(1 - blend, 0.00001); | ||||
| Show All 37 Lines | |||||