Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/shader/nodes/node_shader_volume_principled.cc')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_principled.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
index d414b4b2ef7..d4d5c4789ed 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc
@@ -43,6 +43,18 @@ static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *
}
}
+static void attribute_post_process(GPUMaterial *mat,
+ const char *attribute_name,
+ GPUNodeLink **attribute_link)
+{
+ if (STREQ(attribute_name, "color")) {
+ GPU_link(mat, "node_attribute_color", *attribute_link, attribute_link);
+ }
+ else if (STREQ(attribute_name, "temperature")) {
+ GPU_link(mat, "node_attribute_temperature", *attribute_link, attribute_link);
+ }
+}
+
static int node_shader_gpu_volume_principled(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -67,13 +79,16 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat,
}
if (STREQ(sock->name, "Density Attribute")) {
- density = GPU_volume_grid(mat, attribute_name, GPU_VOLUME_DEFAULT_1);
+ density = GPU_attribute_with_default(mat, CD_AUTO_FROM_NAME, attribute_name, GPU_DEFAULT_1);
+ attribute_post_process(mat, attribute_name, &density);
}
else if (STREQ(sock->name, "Color Attribute")) {
- color = GPU_volume_grid(mat, attribute_name, GPU_VOLUME_DEFAULT_1);
+ color = GPU_attribute_with_default(mat, CD_AUTO_FROM_NAME, attribute_name, GPU_DEFAULT_1);
+ attribute_post_process(mat, attribute_name, &color);
}
else if (use_blackbody && STREQ(sock->name, "Temperature Attribute")) {
- temperature = GPU_volume_grid(mat, attribute_name, GPU_VOLUME_DEFAULT_0);
+ temperature = GPU_attribute(mat, CD_AUTO_FROM_NAME, attribute_name);
+ attribute_post_process(mat, attribute_name, &temperature);
}
}