diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_node_graph.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_node_graph.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 0d5cc46c0b9..0eb62bf5b2f 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -123,6 +123,10 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType input->source = GPU_SOURCE_VOLUME_GRID; input->volume_grid = link->volume_grid; break; + case GPU_NODE_LINK_VOLUME_GRID_TRANSFORM: + input->source = GPU_SOURCE_VOLUME_GRID_TRANSFORM; + input->volume_grid = link->volume_grid; + break; case GPU_NODE_LINK_ATTR: input->source = GPU_SOURCE_ATTR; input->attr = link->attr; @@ -342,6 +346,7 @@ static GPUMaterialVolumeGrid *gpu_node_graph_add_volume_grid(GPUNodeGraph *graph grid = MEM_callocN(sizeof(*grid), __func__); grid->name = BLI_strdup(name); BLI_snprintf(grid->sampler_name, sizeof(grid->sampler_name), "vsamp%d", num_grids); + BLI_snprintf(grid->transform_name, sizeof(grid->transform_name), "vtfm%d", num_grids); BLI_addtail(&graph->volume_grids, grid); } @@ -432,16 +437,20 @@ GPUNodeLink *GPU_volume_grid(GPUMaterial *mat, const char *name) link->link_type = GPU_NODE_LINK_VOLUME_GRID; link->volume_grid = gpu_node_graph_add_volume_grid(graph, name); + GPUNodeLink *transform_link = gpu_node_link_create(); + transform_link->link_type = GPU_NODE_LINK_VOLUME_GRID_TRANSFORM; + transform_link->volume_grid = link->volume_grid; + /* Two special cases, where we adjust the output values of smoke grids to * bring the into standard range without having to modify the grid values. */ if (strcmp(name, "color") == 0) { - GPU_link(mat, "node_attribute_volume_color", link, &link); + GPU_link(mat, "node_attribute_volume_color", link, transform_link, &link); } else if (strcmp(name, "temperature") == 0) { - GPU_link(mat, "node_attribute_volume_temperature", link, &link); + GPU_link(mat, "node_attribute_volume_temperature", link, transform_link, &link); } else { - GPU_link(mat, "node_attribute_volume", link, &link); + GPU_link(mat, "node_attribute_volume", link, transform_link, &link); } return link; @@ -590,7 +599,7 @@ static void gpu_inputs_free(ListBase *inputs) else if (ELEM(input->source, GPU_SOURCE_TEX, GPU_SOURCE_TEX_TILED_MAPPING)) { input->texture->users--; } - else if (ELEM(input->source, GPU_SOURCE_VOLUME_GRID)) { + else if (ELEM(input->source, GPU_SOURCE_VOLUME_GRID, GPU_SOURCE_VOLUME_GRID_TRANSFORM)) { input->volume_grid->users--; } |