Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_bump.c
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| if (!in[3].link) | if (!in[3].link) | ||||
| in[3].link = GPU_builtin(GPU_VIEW_NORMAL); | in[3].link = GPU_builtin(GPU_VIEW_NORMAL); | ||||
| else | else | ||||
| GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); | GPU_link(mat, "direction_transform_m4v3", in[3].link, GPU_builtin(GPU_VIEW_MATRIX), &in[3].link); | ||||
| float invert = node->custom1; | float invert = node->custom1; | ||||
| GPU_stack_link(mat, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&invert)); | GPU_stack_link(mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_uniform(&invert)); | ||||
| /* Other nodes are applying view matrix if the input Normal has a link. | /* Other nodes are applying view matrix if the input Normal has a link. | ||||
| * We don't want normal to have view matrix applied twice, so we cancel it here. | * We don't want normal to have view matrix applied twice, so we cancel it here. | ||||
| * | * | ||||
| * TODO(sergey): This is an extra multiplication which cancels each other, | * TODO(sergey): This is an extra multiplication which cancels each other, | ||||
| * better avoid this but that requires bigger refactor. | * better avoid this but that requires bigger refactor. | ||||
| */ | */ | ||||
| return GPU_link(mat, "direction_transform_m4v3", out[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[0].link); | return GPU_link(mat, "direction_transform_m4v3", out[0].link, GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &out[0].link); | ||||
| } | } | ||||
| Show All 14 Lines | |||||