Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static bNodeSocketTemplate sh_node_bsdf_principled_out[] = { | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) | static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| node->custom1 = SHD_GLOSSY_MULTI_GGX; | node->custom1 = SHD_GLOSSY_MULTI_GGX; | ||||
| } | } | ||||
| static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| #if 0 /* Old 2.7 glsl viewport */ | #if 0 /* Old 2.7 glsl viewport */ | ||||
| // normal | // normal | ||||
| if (!in[17].link) | if (!in[17].link) | ||||
| in[17].link = GPU_builtin(GPU_VIEW_NORMAL); | in[17].link = GPU_builtin(GPU_VIEW_NORMAL); | ||||
| else | else | ||||
| GPU_link(mat, "direction_transform_m4v3", in[17].link, GPU_builtin(GPU_VIEW_MATRIX), &in[17].link); | GPU_link(mat, "direction_transform_m4v3", in[17].link, GPU_builtin(GPU_VIEW_MATRIX), &in[17].link); | ||||
| Show All 20 Lines | if (!in[19].link) { | ||||
| GPU_link(mat, "tangent_orco_z", orco, &in[19].link); | GPU_link(mat, "tangent_orco_z", orco, &in[19].link); | ||||
| GPU_link(mat, "node_tangent", | GPU_link(mat, "node_tangent", | ||||
| GPU_builtin(GPU_VIEW_NORMAL), in[19].link, GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), | GPU_builtin(GPU_VIEW_NORMAL), in[19].link, GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), | ||||
| &in[19].link); | &in[19].link); | ||||
| } | } | ||||
| /* Only use complex versions when needed. */ | /* Only use complex versions when needed. */ | ||||
| if (!in[12].link && (in[12].vec[0] == 0.0f)) { | if (!in[12].link && (in[12].vec[0] == 0.0f)) { | ||||
| return GPU_stack_link(mat, "node_bsdf_principled_simple", in, out, GPU_builtin(GPU_VIEW_POSITION)); | return GPU_stack_link(mat, node, "node_bsdf_principled_simple", in, out, GPU_builtin(GPU_VIEW_POSITION)); | ||||
| } | } | ||||
| else { | else { | ||||
| return GPU_stack_link(mat, "node_bsdf_principled_clearcoat", in, out, GPU_builtin(GPU_VIEW_POSITION)); | return GPU_stack_link(mat, node, "node_bsdf_principled_clearcoat", in, out, GPU_builtin(GPU_VIEW_POSITION)); | ||||
| } | } | ||||
| } | } | ||||
| static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node) | static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| bNodeSocket *sock; | bNodeSocket *sock; | ||||
| int distribution = node->custom1; | int distribution = node->custom1; | ||||
| Show All 27 Lines | |||||