Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_vectMath.c
| Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | static const char *names[] = {"vec_math_add", "vec_math_sub", | ||||
| "vec_math_normalize"}; | "vec_math_normalize"}; | ||||
| switch (node->custom1) { | switch (node->custom1) { | ||||
| case 0: | case 0: | ||||
| case 1: | case 1: | ||||
| case 2: | case 2: | ||||
| case 3: | case 3: | ||||
| case 4: | case 4: | ||||
| GPU_stack_link(mat, names[node->custom1], in, out); | GPU_stack_link(mat, node, names[node->custom1], in, out); | ||||
| break; | break; | ||||
| case 5: | case 5: | ||||
| if (in[0].hasinput || !in[1].hasinput) { | if (in[0].hasinput || !in[1].hasinput) { | ||||
| /* use only first item and terminator */ | /* use only first item and terminator */ | ||||
| GPUNodeStack tmp_in[2]; | GPUNodeStack tmp_in[2]; | ||||
| memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack)); | memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack)); | ||||
| memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); | memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); | ||||
| GPU_stack_link(mat, names[node->custom1], tmp_in, out); | GPU_stack_link(mat, node, names[node->custom1], tmp_in, out); | ||||
| } | } | ||||
| else { | else { | ||||
| /* use only second item and terminator */ | /* use only second item and terminator */ | ||||
| GPUNodeStack tmp_in[2]; | GPUNodeStack tmp_in[2]; | ||||
| memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack)); | memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack)); | ||||
| memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); | memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack)); | ||||
| GPU_stack_link(mat, names[node->custom1], tmp_in, out); | GPU_stack_link(mat, node, names[node->custom1], tmp_in, out); | ||||
| } | } | ||||
| break; | break; | ||||
| default: | default: | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| Show All 15 Lines | |||||