Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_fresnel.c
| Show All 33 Lines | static bNodeSocketTemplate sh_node_fresnel_in[] = { | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static bNodeSocketTemplate sh_node_fresnel_out[] = { | static bNodeSocketTemplate sh_node_fresnel_out[] = { | ||||
| { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, | { SOCK_FLOAT, 0, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int node_shader_gpu_fresnel(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_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION)); | return GPU_stack_link(mat, node, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION)); | ||||
| } | } | ||||
| static void node_shader_exec_fresnel(void *data, int UNUSED(thread), bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out) | static void node_shader_exec_fresnel(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 eta = max_ff(in[0]->vec[0], 0.00001); | float eta = max_ff(in[0]->vec[0], 0.00001); | ||||
| float n[3]; | float n[3]; | ||||
| Show All 29 Lines | |||||