Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_attribute.c
| Show All 36 Lines | |||||
| static int node_shader_gpu_attribute(GPUMaterial *mat, | static int node_shader_gpu_attribute(GPUMaterial *mat, | ||||
| bNode *node, | bNode *node, | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| GPUNodeStack *in, | GPUNodeStack *in, | ||||
| GPUNodeStack *out) | GPUNodeStack *out) | ||||
| { | { | ||||
| NodeShaderAttribute *attr = node->storage; | NodeShaderAttribute *attr = node->storage; | ||||
| /* FIXME : if an attribute layer (like vertex color) has one of these names, | if (GPU_material_is_volume_shader(mat)) { | ||||
| * it will not work as expected. */ | if (out[0].hasoutput) { | ||||
| if (strcmp(attr->name, "density") == 0) { | out[0].link = GPU_volume_grid(mat, attr->name); | ||||
| return GPU_stack_link( | } | ||||
| mat, node, "node_attribute_volume_density", in, out, GPU_builtin(GPU_VOLUME_DENSITY)); | if (out[1].hasoutput) { | ||||
| } | out[1].link = GPU_volume_grid(mat, attr->name); | ||||
| else if (strcmp(attr->name, "color") == 0) { | } | ||||
| return GPU_stack_link( | if (out[2].hasoutput) { | ||||
| mat, node, "node_attribute_volume_color", in, out, GPU_builtin(GPU_VOLUME_COLOR)); | out[2].link = GPU_volume_grid(mat, attr->name); | ||||
| } | } | ||||
| else if (strcmp(attr->name, "flame") == 0) { | |||||
| return GPU_stack_link( | return 1; | ||||
| mat, node, "node_attribute_volume_flame", in, out, GPU_builtin(GPU_VOLUME_FLAME)); | |||||
| } | |||||
| else if (strcmp(attr->name, "temperature") == 0) { | |||||
| return GPU_stack_link(mat, | |||||
| node, | |||||
| "node_attribute_volume_temperature", | |||||
| in, | |||||
| out, | |||||
| GPU_builtin(GPU_VOLUME_FLAME), | |||||
| GPU_builtin(GPU_VOLUME_TEMPERATURE)); | |||||
| } | } | ||||
| else { | else { | ||||
| GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name); | GPUNodeLink *cd_attr = GPU_attribute(mat, CD_AUTO_FROM_NAME, attr->name); | ||||
| GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); | GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); | ||||
| /* for each output. */ | /* for each output. */ | ||||
| for (int i = 0; sh_node_attribute_out[i].type != -1; i++) { | for (int i = 0; sh_node_attribute_out[i].type != -1; i++) { | ||||
| node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); | node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); | ||||
| Show All 20 Lines | |||||