Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_tangent.c
| Show All 40 Lines | static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| node->storage = attr; | node->storage = attr; | ||||
| } | } | ||||
| static int node_shader_gpu_tangent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int node_shader_gpu_tangent(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| NodeShaderTangent *attr = node->storage; | NodeShaderTangent *attr = node->storage; | ||||
| if (attr->direction_type == SHD_TANGENT_UVMAP) { | if (attr->direction_type == SHD_TANGENT_UVMAP) { | ||||
| return GPU_stack_link(mat, "node_tangentmap", in, out, GPU_attribute(CD_TANGENT, ""), GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); | return GPU_stack_link(mat, node, "node_tangentmap", in, out, GPU_attribute(CD_TANGENT, ""), GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); | ||||
| } | } | ||||
| else { | else { | ||||
| GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); | GPUNodeLink *orco = GPU_attribute(CD_ORCO, ""); | ||||
| if (attr->axis == SHD_TANGENT_AXIS_X) | if (attr->axis == SHD_TANGENT_AXIS_X) | ||||
| GPU_link(mat, "tangent_orco_x", orco, &orco); | GPU_link(mat, "tangent_orco_x", orco, &orco); | ||||
| else if (attr->axis == SHD_TANGENT_AXIS_Y) | else if (attr->axis == SHD_TANGENT_AXIS_Y) | ||||
| GPU_link(mat, "tangent_orco_y", orco, &orco); | GPU_link(mat, "tangent_orco_y", orco, &orco); | ||||
| else | else | ||||
| GPU_link(mat, "tangent_orco_z", orco, &orco); | GPU_link(mat, "tangent_orco_z", orco, &orco); | ||||
| return GPU_stack_link(mat, "node_tangent", in, out, GPU_builtin(GPU_VIEW_NORMAL), orco, | return GPU_stack_link(mat, node, "node_tangent", in, out, GPU_builtin(GPU_VIEW_NORMAL), orco, | ||||
| GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); | GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX)); | ||||
| } | } | ||||
| } | } | ||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_tangent(void) | void register_node_type_sh_tangent(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| Show All 11 Lines | |||||