Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_volume_principled.c
| Show All 38 Lines | |||||
| static bNodeSocketTemplate sh_node_volume_principled_out[] = { | static bNodeSocketTemplate sh_node_volume_principled_out[] = { | ||||
| {SOCK_SHADER, N_("Volume")}, | {SOCK_SHADER, N_("Volume")}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node) | static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) { | LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { | ||||
| if (STREQ(sock->name, "Density Attribute")) { | if (STREQ(sock->name, "Density Attribute")) { | ||||
| strcpy(((bNodeSocketValueString *)sock->default_value)->value, "density"); | strcpy(((bNodeSocketValueString *)sock->default_value)->value, "density"); | ||||
| } | } | ||||
| else if (STREQ(sock->name, "Temperature Attribute")) { | else if (STREQ(sock->name, "Temperature Attribute")) { | ||||
| strcpy(((bNodeSocketValueString *)sock->default_value)->value, "temperature"); | strcpy(((bNodeSocketValueString *)sock->default_value)->value, "temperature"); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static int node_shader_gpu_volume_principled(GPUMaterial *mat, | static int node_shader_gpu_volume_principled(GPUMaterial *mat, | ||||
| bNode *node, | bNode *node, | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| GPUNodeStack *in, | GPUNodeStack *in, | ||||
| GPUNodeStack *out) | GPUNodeStack *out) | ||||
| { | { | ||||
| /* Test if blackbody intensity is enabled. */ | /* Test if blackbody intensity is enabled. */ | ||||
| bool use_blackbody = (in[8].link || in[8].vec[0] != 0.0f); | bool use_blackbody = (in[8].link || in[8].vec[0] != 0.0f); | ||||
| /* Get volume attributes. */ | /* Get volume attributes. */ | ||||
| GPUNodeLink *density = NULL, *color = NULL, *temperature = NULL; | GPUNodeLink *density = NULL, *color = NULL, *temperature = NULL; | ||||
| for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) { | LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { | ||||
| if (sock->typeinfo->type != SOCK_STRING) { | if (sock->typeinfo->type != SOCK_STRING) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| bNodeSocketValueString *value = sock->default_value; | bNodeSocketValueString *value = sock->default_value; | ||||
| const char *attribute_name = value->value; | const char *attribute_name = value->value; | ||||
| if (attribute_name[0] == '\0') { | if (attribute_name[0] == '\0') { | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||