Cleanup: Migrate all shader nodes to c++
This will be useful in the future to use the new socket builder API Aditional changes: - Declare variables where initialized - Do not use relative includes Differential Revision: https://developer.blender.org/D13465
This commit is contained in:
parent
b32f9bf801
commit
d5efda72f5
|
@ -157,97 +157,97 @@ set(SRC
|
|||
function/nodes/node_fn_value_to_string.cc
|
||||
function/node_function_util.cc
|
||||
|
||||
shader/nodes/node_shader_add_shader.c
|
||||
shader/nodes/node_shader_ambient_occlusion.c
|
||||
shader/nodes/node_shader_attribute.c
|
||||
shader/nodes/node_shader_background.c
|
||||
shader/nodes/node_shader_bevel.c
|
||||
shader/nodes/node_shader_blackbody.c
|
||||
shader/nodes/node_shader_brightness.c
|
||||
shader/nodes/node_shader_bsdf_anisotropic.c
|
||||
shader/nodes/node_shader_bsdf_diffuse.c
|
||||
shader/nodes/node_shader_bsdf_glass.c
|
||||
shader/nodes/node_shader_bsdf_glossy.c
|
||||
shader/nodes/node_shader_bsdf_hair.c
|
||||
shader/nodes/node_shader_bsdf_hair_principled.c
|
||||
shader/nodes/node_shader_bsdf_principled.c
|
||||
shader/nodes/node_shader_bsdf_refraction.c
|
||||
shader/nodes/node_shader_bsdf_toon.c
|
||||
shader/nodes/node_shader_bsdf_translucent.c
|
||||
shader/nodes/node_shader_bsdf_transparent.c
|
||||
shader/nodes/node_shader_bsdf_velvet.c
|
||||
shader/nodes/node_shader_bump.c
|
||||
shader/nodes/node_shader_camera.c
|
||||
shader/nodes/node_shader_add_shader.cc
|
||||
shader/nodes/node_shader_ambient_occlusion.cc
|
||||
shader/nodes/node_shader_attribute.cc
|
||||
shader/nodes/node_shader_background.cc
|
||||
shader/nodes/node_shader_bevel.cc
|
||||
shader/nodes/node_shader_blackbody.cc
|
||||
shader/nodes/node_shader_brightness.cc
|
||||
shader/nodes/node_shader_bsdf_anisotropic.cc
|
||||
shader/nodes/node_shader_bsdf_diffuse.cc
|
||||
shader/nodes/node_shader_bsdf_glass.cc
|
||||
shader/nodes/node_shader_bsdf_glossy.cc
|
||||
shader/nodes/node_shader_bsdf_hair.cc
|
||||
shader/nodes/node_shader_bsdf_hair_principled.cc
|
||||
shader/nodes/node_shader_bsdf_principled.cc
|
||||
shader/nodes/node_shader_bsdf_refraction.cc
|
||||
shader/nodes/node_shader_bsdf_toon.cc
|
||||
shader/nodes/node_shader_bsdf_translucent.cc
|
||||
shader/nodes/node_shader_bsdf_transparent.cc
|
||||
shader/nodes/node_shader_bsdf_velvet.cc
|
||||
shader/nodes/node_shader_bump.cc
|
||||
shader/nodes/node_shader_camera.cc
|
||||
shader/nodes/node_shader_clamp.cc
|
||||
shader/nodes/node_shader_common.c
|
||||
shader/nodes/node_shader_common.cc
|
||||
shader/nodes/node_shader_curves.cc
|
||||
shader/nodes/node_shader_displacement.c
|
||||
shader/nodes/node_shader_eevee_specular.c
|
||||
shader/nodes/node_shader_emission.c
|
||||
shader/nodes/node_shader_fresnel.c
|
||||
shader/nodes/node_shader_gamma.c
|
||||
shader/nodes/node_shader_geometry.c
|
||||
shader/nodes/node_shader_hair_info.c
|
||||
shader/nodes/node_shader_holdout.c
|
||||
shader/nodes/node_shader_hueSatVal.c
|
||||
shader/nodes/node_shader_ies_light.c
|
||||
shader/nodes/node_shader_invert.c
|
||||
shader/nodes/node_shader_layer_weight.c
|
||||
shader/nodes/node_shader_light_falloff.c
|
||||
shader/nodes/node_shader_light_path.c
|
||||
shader/nodes/node_shader_displacement.cc
|
||||
shader/nodes/node_shader_eevee_specular.cc
|
||||
shader/nodes/node_shader_emission.cc
|
||||
shader/nodes/node_shader_fresnel.cc
|
||||
shader/nodes/node_shader_gamma.cc
|
||||
shader/nodes/node_shader_geometry.cc
|
||||
shader/nodes/node_shader_hair_info.cc
|
||||
shader/nodes/node_shader_holdout.cc
|
||||
shader/nodes/node_shader_hueSatVal.cc
|
||||
shader/nodes/node_shader_ies_light.cc
|
||||
shader/nodes/node_shader_invert.cc
|
||||
shader/nodes/node_shader_layer_weight.cc
|
||||
shader/nodes/node_shader_light_falloff.cc
|
||||
shader/nodes/node_shader_light_path.cc
|
||||
shader/nodes/node_shader_map_range.cc
|
||||
shader/nodes/node_shader_mapping.c
|
||||
shader/nodes/node_shader_mapping.cc
|
||||
shader/nodes/node_shader_math.cc
|
||||
shader/nodes/node_shader_mixRgb.cc
|
||||
shader/nodes/node_shader_mix_shader.c
|
||||
shader/nodes/node_shader_normal.c
|
||||
shader/nodes/node_shader_normal_map.c
|
||||
shader/nodes/node_shader_object_info.c
|
||||
shader/nodes/node_shader_output_aov.c
|
||||
shader/nodes/node_shader_output_light.c
|
||||
shader/nodes/node_shader_output_linestyle.c
|
||||
shader/nodes/node_shader_output_material.c
|
||||
shader/nodes/node_shader_output_world.c
|
||||
shader/nodes/node_shader_particle_info.c
|
||||
shader/nodes/node_shader_rgb.c
|
||||
shader/nodes/node_shader_script.c
|
||||
shader/nodes/node_shader_sepcombHSV.c
|
||||
shader/nodes/node_shader_mix_shader.cc
|
||||
shader/nodes/node_shader_normal.cc
|
||||
shader/nodes/node_shader_normal_map.cc
|
||||
shader/nodes/node_shader_object_info.cc
|
||||
shader/nodes/node_shader_output_aov.cc
|
||||
shader/nodes/node_shader_output_light.cc
|
||||
shader/nodes/node_shader_output_linestyle.cc
|
||||
shader/nodes/node_shader_output_material.cc
|
||||
shader/nodes/node_shader_output_world.cc
|
||||
shader/nodes/node_shader_particle_info.cc
|
||||
shader/nodes/node_shader_rgb.cc
|
||||
shader/nodes/node_shader_script.cc
|
||||
shader/nodes/node_shader_sepcombHSV.cc
|
||||
shader/nodes/node_shader_sepcombRGB.cc
|
||||
shader/nodes/node_shader_sepcombXYZ.cc
|
||||
shader/nodes/node_shader_shaderToRgb.c
|
||||
shader/nodes/node_shader_squeeze.c
|
||||
shader/nodes/node_shader_subsurface_scattering.c
|
||||
shader/nodes/node_shader_tangent.c
|
||||
shader/nodes/node_shader_shaderToRgb.cc
|
||||
shader/nodes/node_shader_squeeze.cc
|
||||
shader/nodes/node_shader_subsurface_scattering.cc
|
||||
shader/nodes/node_shader_tangent.cc
|
||||
shader/nodes/node_shader_tex_brick.cc
|
||||
shader/nodes/node_shader_tex_checker.cc
|
||||
shader/nodes/node_shader_tex_coord.c
|
||||
shader/nodes/node_shader_tex_environment.c
|
||||
shader/nodes/node_shader_tex_coord.cc
|
||||
shader/nodes/node_shader_tex_environment.cc
|
||||
shader/nodes/node_shader_tex_gradient.cc
|
||||
shader/nodes/node_shader_tex_image.cc
|
||||
shader/nodes/node_shader_tex_magic.cc
|
||||
shader/nodes/node_shader_tex_musgrave.cc
|
||||
shader/nodes/node_shader_tex_noise.cc
|
||||
shader/nodes/node_shader_tex_pointdensity.c
|
||||
shader/nodes/node_shader_tex_sky.c
|
||||
shader/nodes/node_shader_tex_pointdensity.cc
|
||||
shader/nodes/node_shader_tex_sky.cc
|
||||
shader/nodes/node_shader_tex_voronoi.cc
|
||||
shader/nodes/node_shader_tex_wave.cc
|
||||
shader/nodes/node_shader_tex_white_noise.cc
|
||||
shader/nodes/node_shader_uvAlongStroke.c
|
||||
shader/nodes/node_shader_uvmap.c
|
||||
shader/nodes/node_shader_uvAlongStroke.cc
|
||||
shader/nodes/node_shader_uvmap.cc
|
||||
shader/nodes/node_shader_valToRgb.cc
|
||||
shader/nodes/node_shader_value.cc
|
||||
shader/nodes/node_shader_vectTransform.c
|
||||
shader/nodes/node_shader_vector_displacement.c
|
||||
shader/nodes/node_shader_vectTransform.cc
|
||||
shader/nodes/node_shader_vector_displacement.cc
|
||||
shader/nodes/node_shader_vector_math.cc
|
||||
shader/nodes/node_shader_vector_rotate.cc
|
||||
shader/nodes/node_shader_vertex_color.c
|
||||
shader/nodes/node_shader_volume_absorption.c
|
||||
shader/nodes/node_shader_volume_info.c
|
||||
shader/nodes/node_shader_volume_principled.c
|
||||
shader/nodes/node_shader_volume_scatter.c
|
||||
shader/nodes/node_shader_wavelength.c
|
||||
shader/nodes/node_shader_wireframe.c
|
||||
shader/node_shader_tree.c
|
||||
shader/nodes/node_shader_vertex_color.cc
|
||||
shader/nodes/node_shader_volume_absorption.cc
|
||||
shader/nodes/node_shader_volume_info.cc
|
||||
shader/nodes/node_shader_volume_principled.cc
|
||||
shader/nodes/node_shader_volume_scatter.cc
|
||||
shader/nodes/node_shader_wavelength.cc
|
||||
shader/nodes/node_shader_wireframe.cc
|
||||
shader/node_shader_tree.cc
|
||||
shader/node_shader_util.cc
|
||||
|
||||
texture/nodes/node_texture_at.c
|
||||
|
@ -293,7 +293,7 @@ set(SRC
|
|||
|
||||
composite/node_composite_util.hh
|
||||
function/node_function_util.hh
|
||||
shader/node_shader_util.h
|
||||
shader/node_shader_util.hh
|
||||
texture/node_texture_util.h
|
||||
|
||||
NOD_common.h
|
||||
|
|
|
@ -297,8 +297,8 @@ static bool node_poll_cryptomatte(bNodeType *UNUSED(ntype),
|
|||
}
|
||||
|
||||
if (scene == nullptr) {
|
||||
*r_disabled_hint =
|
||||
TIP_("The node tree must be the compositing node tree of any scene in the file");
|
||||
*r_disabled_hint = TIP_(
|
||||
"The node tree must be the compositing node tree of any scene in the file");
|
||||
}
|
||||
return scene != nullptr;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup nodes
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_linestyle_types.h"
|
||||
|
@ -56,12 +56,12 @@
|
|||
|
||||
#include "node_common.h"
|
||||
#include "node_exec.h"
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
#include "node_util.h"
|
||||
|
||||
typedef struct nTreeTags {
|
||||
struct nTreeTags {
|
||||
float ssr_id, sss_id;
|
||||
} nTreeTags;
|
||||
};
|
||||
|
||||
static void ntree_shader_tag_nodes(bNodeTree *ntree, bNode *output_node, nTreeTags *tags);
|
||||
|
||||
|
@ -91,7 +91,7 @@ static void shader_get_from_context(const bContext *C,
|
|||
if (ob) {
|
||||
*r_from = &ob->id;
|
||||
if (ob->type == OB_LAMP) {
|
||||
*r_id = ob->data;
|
||||
*r_id = (ID *)ob->data;
|
||||
*r_ntree = ((Light *)ob->data)->nodetree;
|
||||
}
|
||||
else {
|
||||
|
@ -107,7 +107,7 @@ static void shader_get_from_context(const bContext *C,
|
|||
else if (snode->shaderfrom == SNODE_SHADER_LINESTYLE) {
|
||||
FreestyleLineStyle *linestyle = BKE_linestyle_active_from_view_layer(view_layer);
|
||||
if (linestyle) {
|
||||
*r_from = NULL;
|
||||
*r_from = nullptr;
|
||||
*r_id = &linestyle->id;
|
||||
*r_ntree = linestyle->nodetree;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ static void shader_get_from_context(const bContext *C,
|
|||
#endif
|
||||
else { /* SNODE_SHADER_WORLD */
|
||||
if (scene->world) {
|
||||
*r_from = NULL;
|
||||
*r_from = nullptr;
|
||||
*r_id = &scene->world->id;
|
||||
*r_ntree = scene->world->nodetree;
|
||||
}
|
||||
|
@ -139,12 +139,8 @@ static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCa
|
|||
|
||||
static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
|
||||
{
|
||||
bNode *node, *node_next;
|
||||
|
||||
/* replace muted nodes and reroute nodes by internal links */
|
||||
for (node = localtree->nodes.first; node; node = node_next) {
|
||||
node_next = node->next;
|
||||
|
||||
LISTBASE_FOREACH (bNode *, node, &localtree->nodes) {
|
||||
if (node->flag & NODE_MUTED || node->type == NODE_REROUTE) {
|
||||
nodeInternalRelink(localtree, node);
|
||||
ntreeFreeLocalNode(localtree, node);
|
||||
|
@ -195,8 +191,8 @@ bNodeTreeType *ntreeType_Shader;
|
|||
|
||||
void register_node_tree_type_sh(void)
|
||||
{
|
||||
bNodeTreeType *tt = ntreeType_Shader = MEM_callocN(sizeof(bNodeTreeType),
|
||||
"shader node tree type");
|
||||
bNodeTreeType *tt = ntreeType_Shader = (bNodeTreeType *)MEM_callocN(sizeof(bNodeTreeType),
|
||||
"shader node tree type");
|
||||
|
||||
tt->type = NTREE_SHADER;
|
||||
strcpy(tt->idname, "ShaderNodeTree");
|
||||
|
@ -235,7 +231,7 @@ bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target)
|
|||
|
||||
/* Find output node that matches type and target. If there are
|
||||
* multiple, we prefer exact target match and active nodes. */
|
||||
bNode *output_node = NULL;
|
||||
bNode *output_node = nullptr;
|
||||
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (!ELEM(node->type, SH_NODE_OUTPUT_MATERIAL, SH_NODE_OUTPUT_WORLD, SH_NODE_OUTPUT_LIGHT)) {
|
||||
|
@ -243,7 +239,7 @@ bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target)
|
|||
}
|
||||
|
||||
if (node->custom1 == SHD_OUTPUT_ALL) {
|
||||
if (output_node == NULL) {
|
||||
if (output_node == nullptr) {
|
||||
output_node = node;
|
||||
}
|
||||
else if (output_node->custom1 == SHD_OUTPUT_ALL) {
|
||||
|
@ -253,7 +249,7 @@ bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target)
|
|||
}
|
||||
}
|
||||
else if (node->custom1 == target) {
|
||||
if (output_node == NULL) {
|
||||
if (output_node == nullptr) {
|
||||
output_node = node;
|
||||
}
|
||||
else if (output_node->custom1 == SHD_OUTPUT_ALL) {
|
||||
|
@ -271,12 +267,12 @@ bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target)
|
|||
/* Find socket with a specified identifier. */
|
||||
static bNodeSocket *ntree_shader_node_find_socket(ListBase *sockets, const char *identifier)
|
||||
{
|
||||
for (bNodeSocket *sock = sockets->first; sock != NULL; sock = sock->next) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, sockets) {
|
||||
if (STREQ(sock->identifier, identifier)) {
|
||||
return sock;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Find input socket with a specified identifier. */
|
||||
|
@ -305,37 +301,37 @@ static bool ntree_shader_expand_socket_default(bNodeTree *localtree,
|
|||
|
||||
switch (socket->type) {
|
||||
case SOCK_VECTOR:
|
||||
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB);
|
||||
value_node = nodeAddStaticNode(nullptr, localtree, SH_NODE_RGB);
|
||||
value_socket = ntree_shader_node_find_output(value_node, "Color");
|
||||
BLI_assert(value_socket != NULL);
|
||||
src_vector = socket->default_value;
|
||||
dst_rgba = value_socket->default_value;
|
||||
BLI_assert(value_socket != nullptr);
|
||||
src_vector = (bNodeSocketValueVector *)socket->default_value;
|
||||
dst_rgba = (bNodeSocketValueRGBA *)value_socket->default_value;
|
||||
copy_v3_v3(dst_rgba->value, src_vector->value);
|
||||
dst_rgba->value[3] = 1.0f; /* should never be read */
|
||||
break;
|
||||
case SOCK_RGBA:
|
||||
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGB);
|
||||
value_node = nodeAddStaticNode(nullptr, localtree, SH_NODE_RGB);
|
||||
value_socket = ntree_shader_node_find_output(value_node, "Color");
|
||||
BLI_assert(value_socket != NULL);
|
||||
src_rgba = socket->default_value;
|
||||
dst_rgba = value_socket->default_value;
|
||||
BLI_assert(value_socket != nullptr);
|
||||
src_rgba = (bNodeSocketValueRGBA *)socket->default_value;
|
||||
dst_rgba = (bNodeSocketValueRGBA *)value_socket->default_value;
|
||||
copy_v4_v4(dst_rgba->value, src_rgba->value);
|
||||
break;
|
||||
case SOCK_INT:
|
||||
/* HACK: Support as float. */
|
||||
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_VALUE);
|
||||
value_node = nodeAddStaticNode(nullptr, localtree, SH_NODE_VALUE);
|
||||
value_socket = ntree_shader_node_find_output(value_node, "Value");
|
||||
BLI_assert(value_socket != NULL);
|
||||
src_int = socket->default_value;
|
||||
dst_float = value_socket->default_value;
|
||||
BLI_assert(value_socket != nullptr);
|
||||
src_int = (bNodeSocketValueInt *)socket->default_value;
|
||||
dst_float = (bNodeSocketValueFloat *)value_socket->default_value;
|
||||
dst_float->value = (float)(src_int->value);
|
||||
break;
|
||||
case SOCK_FLOAT:
|
||||
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_VALUE);
|
||||
value_node = nodeAddStaticNode(nullptr, localtree, SH_NODE_VALUE);
|
||||
value_socket = ntree_shader_node_find_output(value_node, "Value");
|
||||
BLI_assert(value_socket != NULL);
|
||||
src_float = socket->default_value;
|
||||
dst_float = value_socket->default_value;
|
||||
BLI_assert(value_socket != nullptr);
|
||||
src_float = (bNodeSocketValueFloat *)socket->default_value;
|
||||
dst_float = (bNodeSocketValueFloat *)value_socket->default_value;
|
||||
dst_float->value = src_float->value;
|
||||
break;
|
||||
default:
|
||||
|
@ -348,11 +344,10 @@ static bool ntree_shader_expand_socket_default(bNodeTree *localtree,
|
|||
static void ntree_shader_unlink_hidden_value_sockets(bNode *group_node, bNodeSocket *isock)
|
||||
{
|
||||
bNodeTree *group_ntree = (bNodeTree *)group_node->id;
|
||||
bNode *node;
|
||||
bool removed_link = false;
|
||||
|
||||
for (node = group_ntree->nodes.first; node; node = node->next) {
|
||||
const bool is_group = ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && (node->id != NULL);
|
||||
LISTBASE_FOREACH (bNode *, node, &group_ntree->nodes) {
|
||||
const bool is_group = ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && (node->id != nullptr);
|
||||
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (!is_group && (sock->flag & SOCK_HIDE_VALUE) == 0) {
|
||||
|
@ -386,7 +381,7 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
|
|||
bool link_added = false;
|
||||
|
||||
LISTBASE_FOREACH (bNode *, node, &localtree->nodes) {
|
||||
const bool is_group = ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && (node->id != NULL);
|
||||
const bool is_group = ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && (node->id != nullptr);
|
||||
const bool is_group_output = node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT);
|
||||
|
||||
if (is_group) {
|
||||
|
@ -396,25 +391,30 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
|
|||
|
||||
if (is_group || is_group_output) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
|
||||
if (socket->link != NULL && !(socket->link->flag & NODE_LINK_MUTED)) {
|
||||
if (socket->link != nullptr && !(socket->link->flag & NODE_LINK_MUTED)) {
|
||||
bNodeLink *link = socket->link;
|
||||
/* Fix the case where the socket is actually converting the data. (see T71374)
|
||||
* We only do the case of lossy conversion to float. */
|
||||
if ((socket->type == SOCK_FLOAT) && (link->fromsock->type != link->tosock->type)) {
|
||||
if (link->fromsock->type == SOCK_RGBA) {
|
||||
bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_RGBTOBW);
|
||||
nodeAddLink(localtree, link->fromnode, link->fromsock, tmp, tmp->inputs.first);
|
||||
nodeAddLink(localtree, tmp, tmp->outputs.first, node, socket);
|
||||
bNode *tmp = nodeAddStaticNode(nullptr, localtree, SH_NODE_RGBTOBW);
|
||||
nodeAddLink(localtree,
|
||||
link->fromnode,
|
||||
link->fromsock,
|
||||
tmp,
|
||||
(bNodeSocket *)tmp->inputs.first);
|
||||
nodeAddLink(localtree, tmp, (bNodeSocket *)tmp->outputs.first, node, socket);
|
||||
}
|
||||
else if (link->fromsock->type == SOCK_VECTOR) {
|
||||
bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_VECTOR_MATH);
|
||||
bNode *tmp = nodeAddStaticNode(nullptr, localtree, SH_NODE_VECTOR_MATH);
|
||||
tmp->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT;
|
||||
bNodeSocket *dot_input1 = tmp->inputs.first;
|
||||
bNodeSocket *dot_input1 = (bNodeSocket *)tmp->inputs.first;
|
||||
bNodeSocket *dot_input2 = dot_input1->next;
|
||||
bNodeSocketValueVector *input2_socket_value = dot_input2->default_value;
|
||||
bNodeSocketValueVector *input2_socket_value = (bNodeSocketValueVector *)
|
||||
dot_input2->default_value;
|
||||
copy_v3_fl(input2_socket_value->value, 1.0f / 3.0f);
|
||||
nodeAddLink(localtree, link->fromnode, link->fromsock, tmp, dot_input1);
|
||||
nodeAddLink(localtree, tmp, tmp->outputs.last, node, socket);
|
||||
nodeAddLink(localtree, tmp, (bNodeSocket *)tmp->outputs.last, node, socket);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -440,15 +440,15 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
|
|||
|
||||
static void flatten_group_do(bNodeTree *ntree, bNode *gnode)
|
||||
{
|
||||
bNodeLink *link, *linkn, *tlink;
|
||||
bNodeLink *link, *tlink;
|
||||
bNode *node, *nextnode;
|
||||
bNodeTree *ngroup;
|
||||
LinkNode *group_interface_nodes = NULL;
|
||||
LinkNode *group_interface_nodes = nullptr;
|
||||
|
||||
ngroup = (bNodeTree *)gnode->id;
|
||||
|
||||
/* Add the nodes into the ntree */
|
||||
for (node = ngroup->nodes.first; node; node = nextnode) {
|
||||
for (node = (bNode *)ngroup->nodes.first; node; node = nextnode) {
|
||||
nextnode = node->next;
|
||||
/* Remove interface nodes.
|
||||
* This also removes remaining links to and from interface nodes.
|
||||
|
@ -465,25 +465,25 @@ static void flatten_group_do(bNodeTree *ntree, bNode *gnode)
|
|||
}
|
||||
|
||||
/* Save first and last link to iterate over flattened group links. */
|
||||
bNodeLink *glinks_first = ntree->links.last;
|
||||
bNodeLink *glinks_first = (bNodeLink *)ntree->links.last;
|
||||
|
||||
/* Add internal links to the ntree */
|
||||
for (link = ngroup->links.first; link; link = linkn) {
|
||||
linkn = link->next;
|
||||
LISTBASE_FOREACH (bNodeLink *, link, &ngroup->links) {
|
||||
BLI_remlink(&ngroup->links, link);
|
||||
BLI_addtail(&ntree->links, link);
|
||||
}
|
||||
|
||||
bNodeLink *glinks_last = ntree->links.last;
|
||||
bNodeLink *glinks_last = (bNodeLink *)ntree->links.last;
|
||||
|
||||
/* restore external links to and from the gnode */
|
||||
if (glinks_first != NULL) {
|
||||
if (glinks_first != nullptr) {
|
||||
/* input links */
|
||||
for (link = glinks_first->next; link != glinks_last->next; link = link->next) {
|
||||
if (link->fromnode->type == NODE_GROUP_INPUT) {
|
||||
const char *identifier = link->fromsock->identifier;
|
||||
/* find external links to this input */
|
||||
for (tlink = ntree->links.first; tlink != glinks_first->next; tlink = tlink->next) {
|
||||
for (tlink = (bNodeLink *)ntree->links.first; tlink != glinks_first->next;
|
||||
tlink = tlink->next) {
|
||||
if (tlink->tonode == gnode && STREQ(tlink->tosock->identifier, identifier)) {
|
||||
nodeAddLink(ntree, tlink->fromnode, tlink->fromsock, link->tonode, link->tosock);
|
||||
}
|
||||
|
@ -491,9 +491,10 @@ static void flatten_group_do(bNodeTree *ntree, bNode *gnode)
|
|||
}
|
||||
}
|
||||
/* Also iterate over the new links to cover passthrough links. */
|
||||
glinks_last = ntree->links.last;
|
||||
glinks_last = (bNodeLink *)ntree->links.last;
|
||||
/* output links */
|
||||
for (tlink = ntree->links.first; tlink != glinks_first->next; tlink = tlink->next) {
|
||||
for (tlink = (bNodeLink *)ntree->links.first; tlink != glinks_first->next;
|
||||
tlink = tlink->next) {
|
||||
if (tlink->fromnode == gnode) {
|
||||
const char *identifier = tlink->fromsock->identifier;
|
||||
/* find internal links to this output */
|
||||
|
@ -510,7 +511,7 @@ static void flatten_group_do(bNodeTree *ntree, bNode *gnode)
|
|||
}
|
||||
|
||||
while (group_interface_nodes) {
|
||||
node = BLI_linklist_pop(&group_interface_nodes);
|
||||
node = (bNode *)BLI_linklist_pop(&group_interface_nodes);
|
||||
ntreeFreeLocalNode(ntree, node);
|
||||
}
|
||||
|
||||
|
@ -522,8 +523,8 @@ static void ntree_shader_groups_flatten(bNodeTree *localtree)
|
|||
{
|
||||
/* This is effectively recursive as the flattened groups will add
|
||||
* nodes at the end of the list, which will also get evaluated. */
|
||||
for (bNode *node = localtree->nodes.first, *node_next; node; node = node_next) {
|
||||
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
|
||||
for (bNode *node = (bNode *)localtree->nodes.first, *node_next; node; node = node_next) {
|
||||
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != nullptr) {
|
||||
flatten_group_do(localtree, node);
|
||||
/* Continue even on new flattened nodes. */
|
||||
node_next = node->next;
|
||||
|
@ -554,7 +555,7 @@ static bool ntree_shader_has_displacement(bNodeTree *ntree,
|
|||
bNodeSocket **r_socket,
|
||||
bNodeLink **r_link)
|
||||
{
|
||||
if (output_node == NULL) {
|
||||
if (output_node == nullptr) {
|
||||
/* We can't have displacement without output node, apparently. */
|
||||
return false;
|
||||
}
|
||||
|
@ -562,12 +563,12 @@ static bool ntree_shader_has_displacement(bNodeTree *ntree,
|
|||
ntreeUpdateTree(G.main, ntree);
|
||||
bNodeSocket *displacement = ntree_shader_node_find_input(output_node, "Displacement");
|
||||
|
||||
if (displacement == NULL) {
|
||||
if (displacement == nullptr) {
|
||||
/* Non-cycles node is used as an output. */
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((displacement->link != NULL) && !(displacement->link->flag & NODE_LINK_MUTED)) {
|
||||
if ((displacement->link != nullptr) && !(displacement->link->flag & NODE_LINK_MUTED)) {
|
||||
*r_node = displacement->link->fromnode;
|
||||
*r_socket = displacement->link->fromsock;
|
||||
*r_link = displacement->link;
|
||||
|
@ -585,7 +586,7 @@ static void ntree_shader_relink_node_normal(bNodeTree *ntree,
|
|||
* matching?
|
||||
*/
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (STREQ(sock->identifier, "Normal") && sock->link == NULL) {
|
||||
if (STREQ(sock->identifier, "Normal") && sock->link == nullptr) {
|
||||
/* It's a normal input and nothing is connected to it. */
|
||||
nodeAddLink(ntree, node_from, socket_from, node, sock);
|
||||
}
|
||||
|
@ -605,7 +606,7 @@ static void ntree_shader_link_builtin_normal(bNodeTree *ntree,
|
|||
bNode *node_from,
|
||||
bNodeSocket *socket_from)
|
||||
{
|
||||
for (bNode *node = ntree->nodes.first; node != NULL; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node == node_from) {
|
||||
/* Don't connect node itself! */
|
||||
continue;
|
||||
|
@ -630,7 +631,7 @@ static void ntree_shader_bypass_bump_link(bNodeTree *ntree, bNode *bump_node, bN
|
|||
fromnode = bump_normal_input->link->fromnode;
|
||||
}
|
||||
else {
|
||||
fromnode = nodeAddStaticNode(NULL, ntree, SH_NODE_NEW_GEOMETRY);
|
||||
fromnode = nodeAddStaticNode(nullptr, ntree, SH_NODE_NEW_GEOMETRY);
|
||||
fromsock = ntree_shader_node_find_output(fromnode, "Normal");
|
||||
}
|
||||
/* Bypass the bump node by creating a link between the previous and next node. */
|
||||
|
@ -682,7 +683,7 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree,
|
|||
int node_count = 1;
|
||||
nodeChainIterBackwards(ntree, start_node, ntree_branch_count_and_tag_nodes, &node_count, 1);
|
||||
/* Make a full copy of the branch */
|
||||
bNode **nodes_copy = MEM_mallocN(sizeof(bNode *) * node_count, __func__);
|
||||
bNode **nodes_copy = (bNode **)MEM_mallocN(sizeof(bNode *) * node_count, __func__);
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node->tmp_flag >= 0) {
|
||||
int id = node->tmp_flag;
|
||||
|
@ -691,10 +692,10 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree,
|
|||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
/* Make sure to clear all sockets links as they are invalid. */
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &nodes_copy[id]->inputs) {
|
||||
sock->link = NULL;
|
||||
sock->link = nullptr;
|
||||
}
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &nodes_copy[id]->outputs) {
|
||||
sock->link = NULL;
|
||||
sock->link = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -727,7 +728,7 @@ static void ntree_shader_copy_branch_displacement(bNodeTree *ntree,
|
|||
/* Replace displacement socket/node/link. */
|
||||
bNode *tonode = displacement_link->tonode;
|
||||
bNodeSocket *tosock = displacement_link->tosock;
|
||||
displacement_node = ntree_shader_copy_branch(ntree, displacement_node, NULL, 0);
|
||||
displacement_node = ntree_shader_copy_branch(ntree, displacement_node, nullptr, 0);
|
||||
displacement_socket = ntree_shader_node_find_output(displacement_node,
|
||||
displacement_socket->identifier);
|
||||
nodeRemLink(ntree, displacement_link);
|
||||
|
@ -767,10 +768,10 @@ static void ntree_shader_relink_displacement(bNodeTree *ntree, bNode *output_nod
|
|||
nodeRemLink(ntree, displacement_link);
|
||||
|
||||
/* Convert displacement vector to bump height. */
|
||||
bNode *dot_node = nodeAddStaticNode(NULL, ntree, SH_NODE_VECTOR_MATH);
|
||||
bNode *geo_node = nodeAddStaticNode(NULL, ntree, SH_NODE_NEW_GEOMETRY);
|
||||
bNode *dot_node = nodeAddStaticNode(nullptr, ntree, SH_NODE_VECTOR_MATH);
|
||||
bNode *geo_node = nodeAddStaticNode(nullptr, ntree, SH_NODE_NEW_GEOMETRY);
|
||||
bNodeSocket *normal_socket = ntree_shader_node_find_output(geo_node, "Normal");
|
||||
bNodeSocket *dot_input1 = dot_node->inputs.first;
|
||||
bNodeSocket *dot_input1 = (bNodeSocket *)dot_node->inputs.first;
|
||||
bNodeSocket *dot_input2 = dot_input1->next;
|
||||
dot_node->custom1 = NODE_VECTOR_MATH_DOT_PRODUCT;
|
||||
|
||||
|
@ -782,11 +783,11 @@ static void ntree_shader_relink_displacement(bNodeTree *ntree, bNode *output_nod
|
|||
/* We can't connect displacement to normal directly, use bump node for that
|
||||
* and hope that it gives good enough approximation.
|
||||
*/
|
||||
bNode *bump_node = nodeAddStaticNode(NULL, ntree, SH_NODE_BUMP);
|
||||
bNode *bump_node = nodeAddStaticNode(nullptr, ntree, SH_NODE_BUMP);
|
||||
bNodeSocket *bump_input_socket = ntree_shader_node_find_input(bump_node, "Height");
|
||||
bNodeSocket *bump_output_socket = ntree_shader_node_find_output(bump_node, "Normal");
|
||||
BLI_assert(bump_input_socket != NULL);
|
||||
BLI_assert(bump_output_socket != NULL);
|
||||
BLI_assert(bump_input_socket != nullptr);
|
||||
BLI_assert(bump_output_socket != nullptr);
|
||||
/* Connect bump node to where displacement output was originally
|
||||
* connected to.
|
||||
*/
|
||||
|
@ -878,7 +879,7 @@ static bool ntree_tag_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void *user
|
|||
*/
|
||||
void ntree_shader_tag_nodes(bNodeTree *ntree, bNode *output_node, nTreeTags *tags)
|
||||
{
|
||||
if (output_node == NULL) {
|
||||
if (output_node == nullptr) {
|
||||
return;
|
||||
}
|
||||
/* Make sure sockets links pointers are correct. */
|
||||
|
@ -901,7 +902,7 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree,
|
|||
|
||||
ntree_shader_groups_flatten(localtree);
|
||||
|
||||
if (output == NULL) {
|
||||
if (output == nullptr) {
|
||||
/* Search again, now including flattened nodes. */
|
||||
output = ntreeShaderOutputNode(localtree, SHD_OUTPUT_EEVEE);
|
||||
}
|
||||
|
@ -917,19 +918,13 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree,
|
|||
LISTBASE_FOREACH (bNode *, node, &localtree->nodes) {
|
||||
if (node->type == SH_NODE_OUTPUT_AOV) {
|
||||
nodeChainIterBackwards(localtree, node, ntree_shader_bump_branches, localtree, 0);
|
||||
nTreeTags tags = {
|
||||
.ssr_id = 1.0,
|
||||
.sss_id = 1.0,
|
||||
};
|
||||
nTreeTags tags = {1.0, 1.0};
|
||||
ntree_shader_tag_nodes(localtree, node, &tags);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO(fclem): consider moving this to the gpu shader tree evaluation. */
|
||||
nTreeTags tags = {
|
||||
.ssr_id = 1.0,
|
||||
.sss_id = 1.0,
|
||||
};
|
||||
nTreeTags tags = {1.0, 1.0};
|
||||
ntree_shader_tag_nodes(localtree, output, &tags);
|
||||
|
||||
exec = ntreeShaderBeginExecTree(localtree);
|
||||
|
@ -945,15 +940,15 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree,
|
|||
*has_surface_output = false;
|
||||
*has_volume_output = false;
|
||||
|
||||
if (output != NULL) {
|
||||
if (output != nullptr) {
|
||||
bNodeSocket *surface_sock = ntree_shader_node_find_input(output, "Surface");
|
||||
bNodeSocket *volume_sock = ntree_shader_node_find_input(output, "Volume");
|
||||
|
||||
if (surface_sock != NULL) {
|
||||
if (surface_sock != nullptr) {
|
||||
*has_surface_output = (nodeCountSocketLinks(localtree, surface_sock) > 0);
|
||||
}
|
||||
|
||||
if (volume_sock != NULL) {
|
||||
if (volume_sock != nullptr) {
|
||||
*has_volume_output = (nodeCountSocketLinks(localtree, volume_sock) > 0);
|
||||
}
|
||||
}
|
||||
|
@ -963,19 +958,17 @@ bNodeTreeExec *ntreeShaderBeginExecTree_internal(bNodeExecContext *context,
|
|||
bNodeTree *ntree,
|
||||
bNodeInstanceKey parent_key)
|
||||
{
|
||||
bNodeTreeExec *exec;
|
||||
bNode *node;
|
||||
|
||||
/* ensures only a single output node is enabled */
|
||||
ntreeSetOutput(ntree);
|
||||
|
||||
/* common base initialization */
|
||||
exec = ntree_exec_begin(context, ntree, parent_key);
|
||||
bNodeTreeExec *exec = ntree_exec_begin(context, ntree, parent_key);
|
||||
|
||||
/* allocate the thread stack listbase array */
|
||||
exec->threadstack = MEM_callocN(BLENDER_MAX_THREADS * sizeof(ListBase), "thread stack array");
|
||||
exec->threadstack = (ListBase *)MEM_callocN(BLENDER_MAX_THREADS * sizeof(ListBase),
|
||||
"thread stack array");
|
||||
|
||||
for (node = exec->nodetree->nodes.first; node; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &exec->nodetree->nodes) {
|
||||
node->need_exec = 1;
|
||||
}
|
||||
|
||||
|
@ -1008,12 +1001,9 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree)
|
|||
|
||||
void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec)
|
||||
{
|
||||
bNodeThreadStack *nts;
|
||||
int a;
|
||||
|
||||
if (exec->threadstack) {
|
||||
for (a = 0; a < BLENDER_MAX_THREADS; a++) {
|
||||
for (nts = exec->threadstack[a].first; nts; nts = nts->next) {
|
||||
for (int a = 0; a < BLENDER_MAX_THREADS; a++) {
|
||||
LISTBASE_FOREACH (bNodeThreadStack *, nts, &exec->threadstack[a]) {
|
||||
if (nts->stack) {
|
||||
MEM_freeN(nts->stack);
|
||||
}
|
||||
|
@ -1022,7 +1012,7 @@ void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec)
|
|||
}
|
||||
|
||||
MEM_freeN(exec->threadstack);
|
||||
exec->threadstack = NULL;
|
||||
exec->threadstack = nullptr;
|
||||
}
|
||||
|
||||
ntree_exec_end(exec);
|
||||
|
@ -1036,6 +1026,6 @@ void ntreeShaderEndExecTree(bNodeTreeExec *exec)
|
|||
ntreeShaderEndExecTree_internal(exec);
|
||||
|
||||
/* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */
|
||||
ntree->execdata = NULL;
|
||||
ntree->execdata = nullptr;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "node_exec.h"
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "DNA_texture_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_float3.hh"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_math_base_safe.h"
|
||||
#include "BLI_rand.h"
|
||||
|
@ -55,7 +57,9 @@
|
|||
#include "BKE_node.h"
|
||||
#include "BKE_texture.h"
|
||||
|
||||
#include "NOD_multi_function.hh"
|
||||
#include "NOD_shader.h"
|
||||
#include "NOD_socket_declarations.hh"
|
||||
#include "node_util.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
@ -65,22 +69,12 @@
|
|||
#include "RE_pipeline.h"
|
||||
#include "RE_texture.h"
|
||||
|
||||
#include "FN_multi_function_builder.hh"
|
||||
|
||||
#include "GPU_material.h"
|
||||
#include "GPU_texture.h"
|
||||
#include "GPU_uniform_buffer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include "FN_multi_function_builder.hh"
|
||||
|
||||
# include "NOD_multi_function.hh"
|
||||
# include "NOD_socket_declarations.hh"
|
||||
|
||||
# include "BLI_color.hh"
|
||||
# include "BLI_float3.hh"
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool sh_node_poll_default(struct bNodeType *ntype,
|
||||
struct bNodeTree *ntree,
|
||||
const char **r_disabled_hint);
|
||||
|
@ -120,7 +114,3 @@ void ntreeExecGPUNodes(struct bNodeTreeExec *exec,
|
|||
struct GPUMaterial *mat,
|
||||
struct bNode *output_node);
|
||||
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -48,8 +48,8 @@ void register_node_type_sh_add_shader(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_add_shader_in, sh_node_add_shader_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_add_shader);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -72,7 +72,7 @@ void register_node_type_sh_ambient_occlusion(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_ambient_occlusion_in, sh_node_ambient_occlusion_out);
|
||||
node_type_init(&ntype, node_shader_init_ambient_occlusion);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_ambient_occlusion);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -31,7 +31,8 @@ static bNodeSocketTemplate sh_node_attribute_out[] = {
|
|||
|
||||
static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderAttribute *attr = MEM_callocN(sizeof(NodeShaderAttribute), "NodeShaderAttribute");
|
||||
NodeShaderAttribute *attr = (NodeShaderAttribute *)MEM_callocN(sizeof(NodeShaderAttribute),
|
||||
"NodeShaderAttribute");
|
||||
node->storage = attr;
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,7 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
|
|||
GPUNodeStack *in,
|
||||
GPUNodeStack *out)
|
||||
{
|
||||
NodeShaderAttribute *attr = node->storage;
|
||||
NodeShaderAttribute *attr = (NodeShaderAttribute *)node->storage;
|
||||
bool is_varying = attr->type == SHD_ATTRIBUTE_GEOMETRY;
|
||||
|
||||
if (GPU_material_is_volume_shader(mat) && is_varying) {
|
||||
|
@ -87,7 +88,7 @@ void register_node_type_sh_attribute(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_attribute_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_attribute_out);
|
||||
node_type_init(&ntype, node_shader_init_attribute);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -48,8 +48,8 @@ void register_node_type_sh_background(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_background_in, sh_node_background_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_background);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -62,7 +62,7 @@ void register_node_type_sh_bevel(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bevel_in, sh_node_bevel_out);
|
||||
node_type_init(&ntype, node_shader_init_bevel);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, gpu_shader_bevel);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Blackbody ******************** */
|
||||
static bNodeSocketTemplate sh_node_blackbody_in[] = {
|
||||
|
@ -37,7 +37,7 @@ static int node_shader_gpu_blackbody(GPUMaterial *mat,
|
|||
GPUNodeStack *out)
|
||||
{
|
||||
const int size = CM_TABLE + 1;
|
||||
float *data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture");
|
||||
float *data = (float *)MEM_mallocN(sizeof(float) * size * 4, "blackbody texture");
|
||||
|
||||
blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f);
|
||||
|
||||
|
@ -55,8 +55,8 @@ void register_node_type_sh_blackbody(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_BLACKBODY, "Blackbody", NODE_CLASS_CONVERTER, 0);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_socket_templates(&ntype, sh_node_blackbody_in, sh_node_blackbody_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_blackbody);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Bright and contrast ******************** */
|
||||
|
||||
|
@ -48,8 +48,8 @@ void register_node_type_sh_brightcontrast(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_brightcontrast_in, sh_node_brightcontrast_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, gpu_shader_brightcontrast);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -73,7 +73,7 @@ void register_node_type_sh_bsdf_anisotropic(void)
|
|||
node_type_socket_templates(&ntype, sh_node_bsdf_anisotropic_in, sh_node_bsdf_anisotropic_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_anisotropic);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_anisotropic);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -56,8 +56,8 @@ void register_node_type_sh_bsdf_diffuse(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_diffuse_in, sh_node_bsdf_diffuse_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_diffuse);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -53,7 +53,7 @@ static int node_shader_gpu_bsdf_glass(GPUMaterial *mat,
|
|||
GPU_link(mat, "set_value_zero", &in[1].link);
|
||||
}
|
||||
|
||||
GPU_material_flag_set(mat, GPU_MATFLAG_GLOSSY | GPU_MATFLAG_REFRACT);
|
||||
GPU_material_flag_set(mat, (eGPUMatFlag)(GPU_MATFLAG_GLOSSY | GPU_MATFLAG_REFRACT));
|
||||
|
||||
float use_multi_scatter = (node->custom1 == SHD_GLOSSY_MULTI_GGX) ? 1.0f : 0.0f;
|
||||
|
||||
|
@ -75,7 +75,7 @@ void register_node_type_sh_bsdf_glass(void)
|
|||
node_type_socket_templates(&ntype, sh_node_bsdf_glass_in, sh_node_bsdf_glass_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_glass);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_glass);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -74,7 +74,7 @@ void register_node_type_sh_bsdf_glossy(void)
|
|||
node_type_socket_templates(&ntype, sh_node_bsdf_glossy_in, sh_node_bsdf_glossy_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_glossy);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_glossy);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -52,8 +52,8 @@ void register_node_type_sh_bsdf_hair(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_hair_in, sh_node_bsdf_hair_out);
|
||||
node_type_size(&ntype, 150, 60, 200);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_hair);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -61,10 +61,9 @@ static void node_shader_init_hair_principled(bNodeTree *UNUSED(ntree), bNode *no
|
|||
/* Triggers (in)visibility of some sockets when changing Parametrization. */
|
||||
static void node_shader_update_hair_principled(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
int parametrization = node->custom1;
|
||||
|
||||
for (sock = node->inputs.first; sock; sock = sock->next) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (STREQ(sock->name, "Color")) {
|
||||
nodeSetSocketAvailability(ntree, sock, parametrization == SHD_PRINCIPLED_HAIR_REFLECTANCE);
|
||||
}
|
||||
|
@ -102,7 +101,7 @@ void register_node_type_sh_bsdf_hair_principled(void)
|
|||
&ntype, sh_node_bsdf_hair_principled_in, sh_node_bsdf_hair_principled_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
node_type_init(&ntype, node_shader_init_hair_principled);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_update(&ntype, node_shader_update_hair_principled);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -122,8 +122,8 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat,
|
|||
|
||||
/* SSS Profile */
|
||||
if (use_subsurf) {
|
||||
bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2);
|
||||
bNodeSocketValueRGBA *socket_data = socket->default_value;
|
||||
bNodeSocket *socket = (bNodeSocket *)BLI_findlink(&node->original->inputs, 2);
|
||||
bNodeSocketValueRGBA *socket_data = (bNodeSocketValueRGBA *)socket->default_value;
|
||||
/* For some reason it seems that the socket value is in ARGB format. */
|
||||
GPU_material_sss_profile_create(mat, &socket_data->value[1]);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ static int node_shader_gpu_bsdf_principled(GPUMaterial *mat,
|
|||
float f_use_refraction = use_refract ? 1.0f : 0.0f;
|
||||
float use_multi_scatter = (node->custom1 == SHD_GLOSSY_MULTI_GGX) ? 1.0f : 0.0f;
|
||||
|
||||
GPU_material_flag_set(mat, flag);
|
||||
GPU_material_flag_set(mat, (eGPUMatFlag)flag);
|
||||
|
||||
return GPU_stack_link(mat,
|
||||
node,
|
||||
|
@ -172,7 +172,7 @@ static void node_shader_update_principled(bNodeTree *ntree, bNode *node)
|
|||
const int distribution = node->custom1;
|
||||
const int sss_method = node->custom2;
|
||||
|
||||
for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (STREQ(sock->name, "Transmission Roughness")) {
|
||||
nodeSetSocketAvailability(ntree, sock, distribution == SHD_GLOSSY_GGX);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void register_node_type_sh_bsdf_principled(void)
|
|||
node_type_socket_templates(&ntype, sh_node_bsdf_principled_in, sh_node_bsdf_principled_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
node_type_init(&ntype, node_shader_init_principled);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_principled);
|
||||
node_type_update(&ntype, node_shader_update_principled);
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -67,7 +67,7 @@ void register_node_type_sh_bsdf_refraction(void)
|
|||
node_type_socket_templates(&ntype, sh_node_bsdf_refraction_in, sh_node_bsdf_refraction_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_refraction);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_refraction);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -57,8 +57,8 @@ void register_node_type_sh_bsdf_toon(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_toon_in, sh_node_bsdf_toon_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_toon);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -54,8 +54,8 @@ void register_node_type_sh_bsdf_translucent(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_translucent_in, sh_node_bsdf_translucent_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_translucent);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -47,8 +47,8 @@ void register_node_type_sh_bsdf_transparent(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_transparent_in, sh_node_bsdf_transparent_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_transparent);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -55,8 +55,8 @@ void register_node_type_sh_bsdf_velvet(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_velvet_in, sh_node_bsdf_velvet_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_velvet);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** BUMP ******************** */
|
||||
/* clang-format off */
|
||||
|
@ -61,7 +61,7 @@ void register_node_type_sh_bump(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_bump_in, sh_node_bump_out);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, gpu_shader_bump);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** CAMERA INFO ******************** */
|
||||
static bNodeSocketTemplate sh_node_camera_out[] = {
|
||||
|
@ -49,8 +49,8 @@ void register_node_type_sh_camera(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_camera_out);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_camera_out);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, gpu_shader_camera);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "NOD_common.h"
|
||||
#include "node_common.h"
|
||||
#include "node_exec.h"
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
|
@ -55,7 +55,7 @@ static void move_stack(bNodeStack *to, bNodeStack *from)
|
|||
to->datatype = from->datatype;
|
||||
to->is_copy = from->is_copy;
|
||||
|
||||
from->data = NULL;
|
||||
from->data = nullptr;
|
||||
from->is_copy = 0;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanc
|
|||
bNodeTreeExec *exec;
|
||||
|
||||
if (!ngroup) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* initialize the internal node tree execution */
|
||||
|
@ -91,15 +91,12 @@ static void group_freeexec(void *nodedata)
|
|||
static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
int a;
|
||||
|
||||
for (node = ngroup->nodes.first; node; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
if (node->type == NODE_GROUP_INPUT) {
|
||||
for (sock = node->outputs.first, a = 0; sock; sock = sock->next, a++) {
|
||||
ns = node_get_socket_stack(gstack, sock);
|
||||
int a;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, a) {
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
copy_stack(ns, in[a]);
|
||||
}
|
||||
|
@ -113,15 +110,12 @@ static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
|
|||
static void group_move_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
int a;
|
||||
|
||||
for (node = ngroup->nodes.first; node; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
|
||||
for (sock = node->inputs.first, a = 0; sock; sock = sock->next, a++) {
|
||||
ns = node_get_socket_stack(gstack, sock);
|
||||
int a;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, a) {
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
move_stack(out[a], ns);
|
||||
}
|
||||
|
@ -138,7 +132,7 @@ static void group_execute(void *data,
|
|||
struct bNodeStack **in,
|
||||
struct bNodeStack **out)
|
||||
{
|
||||
bNodeTreeExec *exec = execdata->data;
|
||||
bNodeTreeExec *exec = (bNodeTreeExec *)execdata->data;
|
||||
bNodeThreadStack *nts;
|
||||
|
||||
if (!exec) {
|
||||
|
@ -149,8 +143,7 @@ static void group_execute(void *data,
|
|||
* it's stupid, but just makes it work. compo redesign will do this better.
|
||||
*/
|
||||
{
|
||||
bNode *inode;
|
||||
for (inode = exec->nodetree->nodes.first; inode; inode = inode->next) {
|
||||
LISTBASE_FOREACH (bNode *, inode, &exec->nodetree->nodes) {
|
||||
inode->need_exec = 1;
|
||||
}
|
||||
}
|
||||
|
@ -167,15 +160,12 @@ static void group_execute(void *data,
|
|||
static void group_gpu_copy_inputs(bNode *gnode, GPUNodeStack *in, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
int a;
|
||||
|
||||
for (node = ngroup->nodes.first; node; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
if (node->type == NODE_GROUP_INPUT) {
|
||||
for (sock = node->outputs.first, a = 0; sock; sock = sock->next, a++) {
|
||||
ns = node_get_socket_stack(gstack, sock);
|
||||
int a;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, a) {
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
/* convert the external gpu stack back to internal node stack data */
|
||||
node_data_from_gpu_stack(ns, &in[a]);
|
||||
|
@ -190,15 +180,12 @@ static void group_gpu_copy_inputs(bNode *gnode, GPUNodeStack *in, bNodeStack *gs
|
|||
static void group_gpu_move_outputs(bNode *gnode, GPUNodeStack *out, bNodeStack *gstack)
|
||||
{
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
bNodeStack *ns;
|
||||
int a;
|
||||
|
||||
for (node = ngroup->nodes.first; node; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
|
||||
for (sock = node->inputs.first, a = 0; sock; sock = sock->next, a++) {
|
||||
ns = node_get_socket_stack(gstack, sock);
|
||||
int a;
|
||||
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, a) {
|
||||
bNodeStack *ns = node_get_socket_stack(gstack, sock);
|
||||
if (ns) {
|
||||
/* convert the node stack data result back to gpu stack */
|
||||
node_gpu_stack_from_data(&out[a], sock->type, ns);
|
||||
|
@ -212,14 +199,14 @@ static void group_gpu_move_outputs(bNode *gnode, GPUNodeStack *out, bNodeStack *
|
|||
static int gpu_group_execute(
|
||||
GPUMaterial *mat, bNode *node, bNodeExecData *execdata, GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
bNodeTreeExec *exec = execdata->data;
|
||||
bNodeTreeExec *exec = (bNodeTreeExec *)execdata->data;
|
||||
|
||||
if (!node->id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
group_gpu_copy_inputs(node, in, exec->stack);
|
||||
ntreeExecGPUNodes(exec, mat, NULL);
|
||||
ntreeExecGPUNodes(exec, mat, nullptr);
|
||||
group_gpu_move_outputs(node, out, exec->stack);
|
||||
|
||||
return 1;
|
||||
|
@ -238,10 +225,10 @@ void register_node_type_sh_group(void)
|
|||
ntype.poll_instance = node_group_poll_instance;
|
||||
ntype.insert_link = node_insert_link_default;
|
||||
ntype.rna_ext.srna = RNA_struct_find("ShaderNodeGroup");
|
||||
BLI_assert(ntype.rna_ext.srna != NULL);
|
||||
BLI_assert(ntype.rna_ext.srna != nullptr);
|
||||
RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype);
|
||||
|
||||
node_type_socket_templates(&ntype, NULL, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, nullptr);
|
||||
node_type_size(&ntype, 140, 60, 400);
|
||||
node_type_label(&ntype, node_group_label);
|
||||
node_type_group_update(&ntype, node_group_update);
|
||||
|
@ -254,10 +241,10 @@ void register_node_type_sh_group(void)
|
|||
void register_node_type_sh_custom_group(bNodeType *ntype)
|
||||
{
|
||||
/* These methods can be overridden but need a default implementation otherwise. */
|
||||
if (ntype->poll == NULL) {
|
||||
if (ntype->poll == nullptr) {
|
||||
ntype->poll = sh_node_poll_default;
|
||||
}
|
||||
if (ntype->insert_link == NULL) {
|
||||
if (ntype->insert_link == nullptr) {
|
||||
ntype->insert_link = node_insert_link_default;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -75,7 +75,7 @@ void register_node_type_sh_displacement(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_displacement_in, sh_node_displacement_out);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_init(&ntype, node_shader_init_displacement);
|
||||
node_type_gpu(&ntype, gpu_shader_displacement);
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -81,7 +81,7 @@ static int node_shader_gpu_eevee_specular(GPUMaterial *mat,
|
|||
GPU_link(mat, "set_value", GPU_constant(&one), &in[9].link);
|
||||
}
|
||||
|
||||
GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY);
|
||||
GPU_material_flag_set(mat, (eGPUMatFlag)(GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_GLOSSY));
|
||||
|
||||
return GPU_stack_link(mat, node, "node_eevee_specular", in, out, GPU_constant(&node->ssr_id));
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ void register_node_type_sh_eevee_specular(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_eevee_specular_in, sh_node_eevee_specular_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_eevee_specular);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -48,8 +48,8 @@ void register_node_type_sh_emission(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_emission_in, sh_node_emission_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_emission);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Fresnel ******************** */
|
||||
static bNodeSocketTemplate sh_node_fresnel_in[] = {
|
||||
|
@ -64,10 +64,10 @@ void register_node_type_sh_fresnel(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_fresnel_in, sh_node_fresnel_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_fresnel);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_fresnel);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_fresnel);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Gamma Tools ******************** */
|
||||
|
||||
|
@ -64,9 +64,9 @@ void register_node_type_sh_gamma(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_gamma_in, sh_node_gamma_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_gamma);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_gamma);
|
||||
node_type_gpu(&ntype, node_shader_gpu_gamma);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -79,7 +79,7 @@ static int node_shader_gpu_geometry(GPUMaterial *mat,
|
|||
out[i].link,
|
||||
out[i].link,
|
||||
&out[i].link,
|
||||
NULL);
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,9 +92,9 @@ void register_node_type_sh_geometry(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_geometry_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_geometry_out);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_geometry);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
static bNodeSocketTemplate outputs[] = {
|
||||
{SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
|
@ -49,9 +49,9 @@ void register_node_type_sh_hair_info(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, outputs);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, outputs);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_hair_info);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -46,8 +46,8 @@ void register_node_type_sh_holdout(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_HOLDOUT, "Holdout", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_holdout_in, sh_node_holdout_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, gpu_shader_rgb);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Hue Saturation ******************** */
|
||||
static bNodeSocketTemplate sh_node_hue_sat_in[] = {
|
||||
|
@ -92,7 +92,7 @@ void register_node_type_sh_hue_sat(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_hue_sat_in, sh_node_hue_sat_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_hue_sat);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_hue_sat);
|
||||
node_type_gpu(&ntype, gpu_shader_hue_sat);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** IES Light ******************** */
|
||||
|
||||
|
@ -34,7 +34,8 @@ static bNodeSocketTemplate sh_node_tex_ies_out[] = {
|
|||
|
||||
static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderTexIES *tex = MEM_callocN(sizeof(NodeShaderTexIES), "NodeShaderIESLight");
|
||||
NodeShaderTexIES *tex = (NodeShaderTexIES *)MEM_callocN(sizeof(NodeShaderTexIES),
|
||||
"NodeShaderIESLight");
|
||||
node->storage = tex;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** INVERT ******************** */
|
||||
static bNodeSocketTemplate sh_node_invert_in[] = {
|
||||
|
@ -71,7 +71,7 @@ void register_node_type_sh_invert(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_invert_in, sh_node_invert_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_invert);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_invert);
|
||||
node_type_gpu(&ntype, gpu_shader_invert);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Layer Weight ******************** */
|
||||
|
||||
|
@ -66,10 +66,10 @@ void register_node_type_sh_layer_weight(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_layer_weight_in, sh_node_layer_weight_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_layer_weight);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_layer_weight);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_layer_weight);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** INPUT ********************* */
|
||||
|
||||
|
@ -53,8 +53,8 @@ void register_node_type_sh_light_falloff(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_light_falloff_in, sh_node_light_falloff_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_light_falloff);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -53,9 +53,9 @@ void register_node_type_sh_light_path(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_light_path_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_light_path_out);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_light_path);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_math_base_safe.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** MAPPING ******************** */
|
||||
static bNodeSocketTemplate sh_node_mapping_in[] = {
|
||||
|
@ -44,10 +44,10 @@ static int gpu_shader_mapping(GPUMaterial *mat,
|
|||
GPUNodeStack *out)
|
||||
{
|
||||
static const char *names[] = {
|
||||
[NODE_MAPPING_TYPE_POINT] = "mapping_point",
|
||||
[NODE_MAPPING_TYPE_TEXTURE] = "mapping_texture",
|
||||
[NODE_MAPPING_TYPE_VECTOR] = "mapping_vector",
|
||||
[NODE_MAPPING_TYPE_NORMAL] = "mapping_normal",
|
||||
"mapping_point",
|
||||
"mapping_texture",
|
||||
"mapping_vector",
|
||||
"mapping_normal",
|
||||
};
|
||||
|
||||
if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) {
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "NOD_math_functions.hh"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -49,8 +49,8 @@ void register_node_type_sh_mix_shader(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_MIX_SHADER, "Mix Shader", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_mix_shader_in, sh_node_mix_shader_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_mix_shader);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** NORMAL ******************** */
|
||||
static bNodeSocketTemplate sh_node_normal_in[] = {
|
||||
|
@ -70,7 +70,7 @@ void register_node_type_sh_normal(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_normal_in, sh_node_normal_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_normal);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_normal);
|
||||
node_type_gpu(&ntype, gpu_shader_normal);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -34,7 +34,8 @@ static bNodeSocketTemplate sh_node_normal_map_out[] = {
|
|||
|
||||
static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderNormalMap *attr = MEM_callocN(sizeof(NodeShaderNormalMap), "NodeShaderNormalMap");
|
||||
NodeShaderNormalMap *attr = (NodeShaderNormalMap *)MEM_callocN(sizeof(NodeShaderNormalMap),
|
||||
"NodeShaderNormalMap");
|
||||
node->storage = attr;
|
||||
}
|
||||
|
||||
|
@ -53,15 +54,15 @@ static int gpu_shader_normal_map(GPUMaterial *mat,
|
|||
GPUNodeStack *in,
|
||||
GPUNodeStack *out)
|
||||
{
|
||||
NodeShaderNormalMap *nm = node->storage;
|
||||
NodeShaderNormalMap *nm = (NodeShaderNormalMap *)node->storage;
|
||||
|
||||
GPUNodeLink *strength;
|
||||
if (in[0].link) {
|
||||
strength = in[0].link;
|
||||
}
|
||||
else if (node->original) {
|
||||
bNodeSocket *socket = BLI_findlink(&node->original->inputs, 0);
|
||||
bNodeSocketValueFloat *socket_data = socket->default_value;
|
||||
bNodeSocket *socket = (bNodeSocket *)BLI_findlink(&node->original->inputs, 0);
|
||||
bNodeSocketValueFloat *socket_data = (bNodeSocketValueFloat *)socket->default_value;
|
||||
strength = GPU_uniform(&socket_data->value);
|
||||
}
|
||||
else {
|
||||
|
@ -73,8 +74,8 @@ static int gpu_shader_normal_map(GPUMaterial *mat,
|
|||
newnormal = in[1].link;
|
||||
}
|
||||
else if (node->original) {
|
||||
bNodeSocket *socket = BLI_findlink(&node->original->inputs, 1);
|
||||
bNodeSocketValueRGBA *socket_data = socket->default_value;
|
||||
bNodeSocket *socket = (bNodeSocket *)BLI_findlink(&node->original->inputs, 1);
|
||||
bNodeSocketValueRGBA *socket_data = (bNodeSocketValueRGBA *)socket->default_value;
|
||||
newnormal = GPU_uniform(socket_data->value);
|
||||
}
|
||||
else {
|
||||
|
@ -126,7 +127,7 @@ void register_node_type_sh_normal_map(void)
|
|||
node_type_storage(
|
||||
&ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage);
|
||||
node_type_gpu(&ntype, gpu_shader_normal_map);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_normal_map);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_normal_map);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -54,7 +54,7 @@ void register_node_type_sh_object_info(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_object_info_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_object_info_out);
|
||||
node_type_gpu(&ntype, node_shader_gpu_object_info);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_hash.h"
|
||||
|
||||
|
@ -31,7 +31,8 @@ static bNodeSocketTemplate sh_node_output_aov_in[] = {
|
|||
|
||||
static void node_shader_init_output_aov(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderOutputAOV *aov = MEM_callocN(sizeof(NodeShaderOutputAOV), "NodeShaderOutputAOV");
|
||||
NodeShaderOutputAOV *aov = (NodeShaderOutputAOV *)MEM_callocN(sizeof(NodeShaderOutputAOV),
|
||||
"NodeShaderOutputAOV");
|
||||
node->storage = aov;
|
||||
}
|
||||
|
||||
|
@ -58,7 +59,7 @@ void register_node_type_sh_output_aov(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_output_aov_in, NULL);
|
||||
node_type_socket_templates(&ntype, sh_node_output_aov_in, nullptr);
|
||||
node_type_init(&ntype, node_shader_init_output_aov);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -32,9 +32,9 @@ void register_node_type_sh_output_light(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LIGHT, "Light Output", NODE_CLASS_OUTPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_output_light_in, NULL);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, sh_node_output_light_in, nullptr);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
|
||||
ntype.no_muting = true;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -35,8 +35,8 @@ void register_node_type_sh_output_linestyle(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_output_linestyle_in, NULL);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_socket_templates(&ntype, sh_node_output_linestyle_in, nullptr);
|
||||
node_type_init(&ntype, nullptr);
|
||||
|
||||
ntype.no_muting = true;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BKE_scene.h"
|
||||
|
||||
|
@ -79,9 +79,9 @@ void register_node_type_sh_output_material(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_MATERIAL, "Material Output", NODE_CLASS_OUTPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_output_material_in, NULL);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, sh_node_output_material_in, nullptr);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_output_material);
|
||||
|
||||
ntype.no_muting = true;
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -47,9 +47,9 @@ void register_node_type_sh_output_world(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_WORLD, "World Output", NODE_CLASS_OUTPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_output_world_in, NULL);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, sh_node_output_world_in, nullptr);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_output_world);
|
||||
|
||||
ntype.no_muting = true;
|
|
@ -17,8 +17,8 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "RE_texture.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
static bNodeSocketTemplate outputs[] = {
|
||||
{SOCK_FLOAT, "Index"},
|
||||
|
@ -67,8 +67,8 @@ void register_node_type_sh_particle_info(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, outputs);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_particle_info);
|
||||
node_type_socket_templates(&ntype, nullptr, outputs);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_particle_info);
|
||||
node_type_gpu(&ntype, gpu_shader_particle_info);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** RGB ******************** */
|
||||
static bNodeSocketTemplate sh_node_rgb_out[] = {
|
||||
|
@ -44,7 +44,7 @@ void register_node_type_sh_rgb(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_rgb_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_rgb_out);
|
||||
node_type_gpu(&ntype, gpu_shader_rgb);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,19 +21,20 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Script ******************** */
|
||||
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderScript *nss = MEM_callocN(sizeof(NodeShaderScript), "shader script node");
|
||||
NodeShaderScript *nss = (NodeShaderScript *)MEM_callocN(sizeof(NodeShaderScript),
|
||||
"shader script node");
|
||||
node->storage = nss;
|
||||
}
|
||||
|
||||
static void node_free_script(bNode *node)
|
||||
{
|
||||
NodeShaderScript *nss = node->storage;
|
||||
NodeShaderScript *nss = (NodeShaderScript *)node->storage;
|
||||
|
||||
if (nss) {
|
||||
if (nss->bytecode) {
|
||||
|
@ -48,11 +49,11 @@ static void node_copy_script(bNodeTree *UNUSED(dest_ntree),
|
|||
bNode *dest_node,
|
||||
const bNode *src_node)
|
||||
{
|
||||
NodeShaderScript *src_nss = src_node->storage;
|
||||
NodeShaderScript *dest_nss = MEM_dupallocN(src_nss);
|
||||
NodeShaderScript *src_nss = (NodeShaderScript *)src_node->storage;
|
||||
NodeShaderScript *dest_nss = (NodeShaderScript *)MEM_dupallocN(src_nss);
|
||||
|
||||
if (src_nss->bytecode) {
|
||||
dest_nss->bytecode = MEM_dupallocN(src_nss->bytecode);
|
||||
dest_nss->bytecode = (char *)MEM_dupallocN(src_nss->bytecode);
|
||||
}
|
||||
|
||||
dest_node->storage = dest_nss;
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** SEPARATE HSV ******************** */
|
||||
static bNodeSocketTemplate sh_node_sephsv_in[] = {
|
||||
|
@ -63,7 +63,7 @@ void register_node_type_sh_sephsv(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_sephsv_in, sh_node_sephsv_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_sephsv);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_sephsv);
|
||||
node_type_gpu(&ntype, gpu_shader_sephsv);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
@ -111,7 +111,7 @@ void register_node_type_sh_combhsv(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_combhsv_in, sh_node_combhsv_out);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_combhsv);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_combhsv);
|
||||
node_type_gpu(&ntype, gpu_shader_combhsv);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -52,8 +52,8 @@ void register_node_type_sh_shadertorgb(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_SHADERTORGB, "Shader to RGB", NODE_CLASS_CONVERTER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_shadertorgb_in, sh_node_shadertorgb_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_shadertorgb);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** VALUE SQUEEZE ******************** */
|
||||
static bNodeSocketTemplate sh_node_squeeze_in[] = {
|
||||
|
@ -63,8 +63,8 @@ void register_node_type_sh_squeeze(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_squeeze_in, sh_node_squeeze_out);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_squeeze);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_squeeze);
|
||||
node_type_gpu(&ntype, gpu_shader_squeeze);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -53,14 +53,14 @@ static int node_shader_gpu_subsurface_scattering(GPUMaterial *mat,
|
|||
}
|
||||
|
||||
if (node->sss_id > 0) {
|
||||
bNodeSocket *socket = BLI_findlink(&node->original->inputs, 2);
|
||||
bNodeSocketValueRGBA *socket_data = socket->default_value;
|
||||
bNodeSocket *socket = (bNodeSocket *)BLI_findlink(&node->original->inputs, 2);
|
||||
bNodeSocketValueRGBA *socket_data = (bNodeSocketValueRGBA *)socket->default_value;
|
||||
/* For some reason it seems that the socket value is in ARGB format. */
|
||||
GPU_material_sss_profile_create(mat, &socket_data->value[1]);
|
||||
|
||||
/* sss_id is 0 only the node is not connected to any output.
|
||||
* In this case flagging the material would trigger a bug (see T68736). */
|
||||
GPU_material_flag_set(mat, GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_SSS);
|
||||
GPU_material_flag_set(mat, (eGPUMatFlag)(GPU_MATFLAG_DIFFUSE | GPU_MATFLAG_SSS));
|
||||
}
|
||||
|
||||
return GPU_stack_link(
|
||||
|
@ -71,7 +71,7 @@ static void node_shader_update_subsurface_scattering(bNodeTree *ntree, bNode *no
|
|||
{
|
||||
const int sss_method = node->custom1;
|
||||
|
||||
for (bNodeSocket *sock = node->inputs.first; sock; sock = sock->next) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (STR_ELEM(sock->name, "IOR", "Anisotropy")) {
|
||||
nodeSetSocketAvailability(ntree, sock, sss_method != SHD_SUBSURFACE_BURLEY);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void register_node_type_sh_subsurface_scattering(void)
|
|||
&ntype, sh_node_subsurface_scattering_in, sh_node_subsurface_scattering_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_subsurface_scattering);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_subsurface_scattering);
|
||||
node_type_update(&ntype, node_shader_update_subsurface_scattering);
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -28,7 +28,8 @@ static bNodeSocketTemplate sh_node_tangent_out[] = {
|
|||
|
||||
static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderTangent *attr = MEM_callocN(sizeof(NodeShaderTangent), "NodeShaderTangent");
|
||||
NodeShaderTangent *attr = (NodeShaderTangent *)MEM_callocN(sizeof(NodeShaderTangent),
|
||||
"NodeShaderTangent");
|
||||
attr->axis = SHD_TANGENT_AXIS_Z;
|
||||
node->storage = attr;
|
||||
}
|
||||
|
@ -39,7 +40,7 @@ static int node_shader_gpu_tangent(GPUMaterial *mat,
|
|||
GPUNodeStack *in,
|
||||
GPUNodeStack *out)
|
||||
{
|
||||
NodeShaderTangent *attr = node->storage;
|
||||
NodeShaderTangent *attr = (NodeShaderTangent *)node->storage;
|
||||
|
||||
if (attr->direction_type == SHD_TANGENT_UVMAP) {
|
||||
return GPU_stack_link(
|
||||
|
@ -74,7 +75,7 @@ void register_node_type_sh_tangent(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_tangent_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_tangent_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_tangent);
|
||||
node_type_gpu(&ntype, node_shader_gpu_tangent);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_float2.hh"
|
||||
#include "BLI_float4.hh"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
|
@ -42,11 +42,12 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
|
|||
{
|
||||
Object *ob = (Object *)node->id;
|
||||
|
||||
GPUNodeLink *inv_obmat = (ob != NULL) ? GPU_uniform(&ob->imat[0][0]) :
|
||||
GPU_builtin(GPU_INVERSE_OBJECT_MATRIX);
|
||||
GPUNodeLink *inv_obmat = (ob != nullptr) ? GPU_uniform(&ob->imat[0][0]) :
|
||||
GPU_builtin(GPU_INVERSE_OBJECT_MATRIX);
|
||||
|
||||
/* Opti: don't request orco if not needed. */
|
||||
GPUNodeLink *orco = (!out[0].hasoutput) ? GPU_constant((float[4]){0.0f, 0.0f, 0.0f, 0.0f}) :
|
||||
const float default_coords[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
GPUNodeLink *orco = (!out[0].hasoutput) ? GPU_constant(default_coords) :
|
||||
GPU_attribute(mat, CD_ORCO, "");
|
||||
GPUNodeLink *mtface = GPU_attribute(mat, CD_MTFACE, "");
|
||||
GPUNodeLink *viewpos = GPU_builtin(GPU_VIEW_POSITION);
|
||||
|
@ -75,7 +76,7 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
|
|||
out[i].link,
|
||||
out[i].link,
|
||||
&out[i].link,
|
||||
NULL);
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,9 +89,9 @@ void register_node_type_sh_tex_coord(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_tex_coord_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_tex_coord_out);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_tex_coord);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -33,7 +33,8 @@ static bNodeSocketTemplate sh_node_tex_environment_out[] = {
|
|||
|
||||
static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexEnvironment *tex = MEM_callocN(sizeof(NodeTexEnvironment), "NodeTexEnvironment");
|
||||
NodeTexEnvironment *tex = (NodeTexEnvironment *)MEM_callocN(sizeof(NodeTexEnvironment),
|
||||
"NodeTexEnvironment");
|
||||
BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT);
|
||||
BKE_texture_colormapping_default(&tex->base.color_mapping);
|
||||
tex->projection = SHD_PROJ_EQUIRECTANGULAR;
|
||||
|
@ -49,12 +50,12 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat,
|
|||
GPUNodeStack *out)
|
||||
{
|
||||
Image *ima = (Image *)node->id;
|
||||
NodeTexEnvironment *tex = node->storage;
|
||||
NodeTexEnvironment *tex = (NodeTexEnvironment *)node->storage;
|
||||
|
||||
/* We get the image user from the original node, since GPU image keeps
|
||||
* a pointer to it and the dependency refreshes the original. */
|
||||
bNode *node_original = node->original ? node->original : node;
|
||||
NodeTexImage *tex_original = node_original->storage;
|
||||
NodeTexImage *tex_original = (NodeTexImage *)node_original->storage;
|
||||
ImageUser *iuser = &tex_original->iuser;
|
||||
eGPUSamplerState sampler = GPU_SAMPLER_REPEAT | GPU_SAMPLER_ANISO | GPU_SAMPLER_FILTER;
|
||||
/* TODO(fclem): For now assume mipmap is always enabled. */
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "RE_texture.h"
|
||||
|
||||
|
@ -36,8 +36,8 @@ static bNodeSocketTemplate sh_node_tex_pointdensity_out[] = {
|
|||
|
||||
static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderTexPointDensity *point_density = MEM_callocN(sizeof(NodeShaderTexPointDensity),
|
||||
"new pd node");
|
||||
NodeShaderTexPointDensity *point_density = (NodeShaderTexPointDensity *)MEM_callocN(
|
||||
sizeof(NodeShaderTexPointDensity), "new pd node");
|
||||
point_density->resolution = 100;
|
||||
point_density->radius = 0.3f;
|
||||
point_density->space = SHD_POINTDENSITY_SPACE_OBJECT;
|
||||
|
@ -47,7 +47,7 @@ static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), bNode *n
|
|||
|
||||
static void node_shader_free_tex_pointdensity(bNode *node)
|
||||
{
|
||||
NodeShaderTexPointDensity *point_density = node->storage;
|
||||
NodeShaderTexPointDensity *point_density = (NodeShaderTexPointDensity *)node->storage;
|
||||
PointDensity *pd = &point_density->pd;
|
||||
RE_point_density_free(pd);
|
||||
BKE_texture_pointdensity_free_data(pd);
|
||||
|
@ -60,7 +60,7 @@ static void node_shader_copy_tex_pointdensity(bNodeTree *UNUSED(dest_ntree),
|
|||
const bNode *src_node)
|
||||
{
|
||||
dest_node->storage = MEM_dupallocN(src_node->storage);
|
||||
NodeShaderTexPointDensity *point_density = dest_node->storage;
|
||||
NodeShaderTexPointDensity *point_density = (NodeShaderTexPointDensity *)dest_node->storage;
|
||||
PointDensity *pd = &point_density->pd;
|
||||
memset(pd, 0, sizeof(*pd));
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
#include "sky_model.h"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
@ -34,7 +34,7 @@ static bNodeSocketTemplate sh_node_tex_sky_out[] = {
|
|||
|
||||
static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexSky *tex = MEM_callocN(sizeof(NodeTexSky), "NodeTexSky");
|
||||
NodeTexSky *tex = (NodeTexSky *)MEM_callocN(sizeof(NodeTexSky), "NodeTexSky");
|
||||
BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT);
|
||||
BKE_texture_colormapping_default(&tex->base.color_mapping);
|
||||
tex->sun_direction[0] = 0.0f;
|
||||
|
@ -55,10 +55,10 @@ static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
|
|||
node->storage = tex;
|
||||
}
|
||||
|
||||
typedef struct SkyModelPreetham {
|
||||
struct SkyModelPreetham {
|
||||
float config_Y[5], config_x[5], config_y[5]; /* named after xyY color space */
|
||||
float radiance[3];
|
||||
} SkyModelPreetham;
|
||||
};
|
||||
|
||||
static float sky_perez_function(const float *lam, float theta, float gamma)
|
||||
{
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -32,8 +32,8 @@ void register_node_type_sh_uvalongstroke(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_uvalongstroke_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_uvalongstroke_out);
|
||||
node_type_init(&ntype, nullptr);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
|
@ -30,7 +30,8 @@ static bNodeSocketTemplate sh_node_uvmap_out[] = {
|
|||
|
||||
static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderUVMap *attr = MEM_callocN(sizeof(NodeShaderUVMap), "NodeShaderUVMap");
|
||||
NodeShaderUVMap *attr = (NodeShaderUVMap *)MEM_callocN(sizeof(NodeShaderUVMap),
|
||||
"NodeShaderUVMap");
|
||||
node->storage = attr;
|
||||
}
|
||||
|
||||
|
@ -40,7 +41,7 @@ static int node_shader_gpu_uvmap(GPUMaterial *mat,
|
|||
GPUNodeStack *in,
|
||||
GPUNodeStack *out)
|
||||
{
|
||||
NodeShaderUVMap *attr = node->storage;
|
||||
NodeShaderUVMap *attr = (NodeShaderUVMap *)node->storage;
|
||||
GPUNodeLink *mtface = GPU_attribute(mat, CD_MTFACE, attr->uv_map);
|
||||
|
||||
GPU_stack_link(mat, node, "node_uvmap", in, out, mtface);
|
||||
|
@ -56,7 +57,7 @@ void register_node_type_sh_uvmap(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_uvmap_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_uvmap_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, node_shader_init_uvmap);
|
||||
node_type_storage(
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "BLI_color.hh"
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Vector Transform ******************** */
|
||||
static bNodeSocketTemplate sh_node_vect_transform_in[] = {
|
||||
|
@ -34,8 +34,8 @@ static bNodeSocketTemplate sh_node_vect_transform_out[] = {
|
|||
|
||||
static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderVectTransform *vect = MEM_callocN(sizeof(NodeShaderVectTransform),
|
||||
"NodeShaderVectTransform");
|
||||
NodeShaderVectTransform *vect = (NodeShaderVectTransform *)MEM_callocN(
|
||||
sizeof(NodeShaderVectTransform), "NodeShaderVectTransform");
|
||||
|
||||
/* Convert World into Object Space per default */
|
||||
vect->convert_to = 1;
|
||||
|
@ -58,7 +58,7 @@ static GPUNodeLink *get_gpulink_matrix_from_to(short from, short to)
|
|||
case SHD_VECT_TRANSFORM_SPACE_OBJECT:
|
||||
switch (to) {
|
||||
case SHD_VECT_TRANSFORM_SPACE_OBJECT:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
case SHD_VECT_TRANSFORM_SPACE_WORLD:
|
||||
return GPU_builtin(GPU_OBJECT_MATRIX);
|
||||
case SHD_VECT_TRANSFORM_SPACE_CAMERA:
|
||||
|
@ -68,7 +68,7 @@ static GPUNodeLink *get_gpulink_matrix_from_to(short from, short to)
|
|||
case SHD_VECT_TRANSFORM_SPACE_WORLD:
|
||||
switch (to) {
|
||||
case SHD_VECT_TRANSFORM_SPACE_WORLD:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
case SHD_VECT_TRANSFORM_SPACE_CAMERA:
|
||||
return GPU_builtin(GPU_VIEW_MATRIX);
|
||||
case SHD_VECT_TRANSFORM_SPACE_OBJECT:
|
||||
|
@ -78,7 +78,7 @@ static GPUNodeLink *get_gpulink_matrix_from_to(short from, short to)
|
|||
case SHD_VECT_TRANSFORM_SPACE_CAMERA:
|
||||
switch (to) {
|
||||
case SHD_VECT_TRANSFORM_SPACE_CAMERA:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
case SHD_VECT_TRANSFORM_SPACE_WORLD:
|
||||
return GPU_builtin(GPU_INVERSE_VIEW_MATRIX);
|
||||
case SHD_VECT_TRANSFORM_SPACE_OBJECT:
|
||||
|
@ -86,7 +86,7 @@ static GPUNodeLink *get_gpulink_matrix_from_to(short from, short to)
|
|||
}
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
static int gpu_shader_vect_transform(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
|
@ -99,7 +99,7 @@ static int gpu_shader_vect_transform(GPUMaterial *mat,
|
|||
|
||||
const char *vtransform = "direction_transform_m4v3";
|
||||
const char *ptransform = "point_transform_m4v3";
|
||||
const char *func_name = 0;
|
||||
const char *func_name = nullptr;
|
||||
|
||||
NodeShaderVectTransform *nodeprop = (NodeShaderVectTransform *)node->storage;
|
||||
|
||||
|
@ -146,7 +146,7 @@ void register_node_type_sh_vect_transform(void)
|
|||
node_type_socket_templates(&ntype, sh_node_vect_transform_in, sh_node_vect_transform_out);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage);
|
||||
node_type_exec(&ntype, NULL, NULL, node_shader_exec_vect_transform);
|
||||
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_vect_transform);
|
||||
node_type_gpu(&ntype, gpu_shader_vect_transform);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -72,7 +72,7 @@ void register_node_type_sh_vector_displacement(void)
|
|||
&ntype, SH_NODE_VECTOR_DISPLACEMENT, "Vector Displacement", NODE_CLASS_OP_VECTOR, 0);
|
||||
node_type_socket_templates(
|
||||
&ntype, sh_node_vector_displacement_in, sh_node_vector_displacement_out);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_init(&ntype, node_shader_init_vector_displacement);
|
||||
node_type_gpu(&ntype, gpu_shader_vector_displacement);
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "NOD_math_functions.hh"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* \ingroup shdnodes
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
static bNodeSocketTemplate sh_node_vertex_color_out[] = {
|
||||
{SOCK_RGBA, N_("Color")},
|
||||
|
@ -27,8 +27,8 @@ static bNodeSocketTemplate sh_node_vertex_color_out[] = {
|
|||
|
||||
static void node_shader_init_vertex_color(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderVertexColor *vertexColor = MEM_callocN(sizeof(NodeShaderVertexColor),
|
||||
"NodeShaderVertexColor");
|
||||
NodeShaderVertexColor *vertexColor = (NodeShaderVertexColor *)MEM_callocN(
|
||||
sizeof(NodeShaderVertexColor), "NodeShaderVertexColor");
|
||||
node->storage = vertexColor;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ void register_node_type_sh_vertex_color(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_vertex_color_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_vertex_color_out);
|
||||
node_type_init(&ntype, node_shader_init_vertex_color);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -48,8 +48,8 @@ void register_node_type_sh_volume_absorption(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_volume_absorption_in, sh_node_volume_absorption_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_volume_absorption);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
static bNodeSocketTemplate sh_node_volume_info_out[] = {
|
||||
{SOCK_RGBA, N_("Color")},
|
||||
|
@ -54,7 +54,7 @@ void register_node_type_sh_volume_info(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, NULL, sh_node_volume_info_out);
|
||||
node_type_socket_templates(&ntype, nullptr, sh_node_volume_info_out);
|
||||
node_type_gpu(&ntype, node_shader_gpu_volume_info);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -64,14 +64,14 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat,
|
|||
bool use_blackbody = (in[8].link || in[8].vec[0] != 0.0f);
|
||||
|
||||
/* Get volume attributes. */
|
||||
GPUNodeLink *density = NULL, *color = NULL, *temperature = NULL;
|
||||
GPUNodeLink *density = nullptr, *color = nullptr, *temperature = nullptr;
|
||||
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (sock->typeinfo->type != SOCK_STRING) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bNodeSocketValueString *value = sock->default_value;
|
||||
bNodeSocketValueString *value = (bNodeSocketValueString *)sock->default_value;
|
||||
const char *attribute_name = value->value;
|
||||
if (attribute_name[0] == '\0') {
|
||||
continue;
|
||||
|
@ -106,11 +106,11 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat,
|
|||
const int size = CM_TABLE + 1;
|
||||
float *data, layer;
|
||||
if (use_blackbody) {
|
||||
data = MEM_mallocN(sizeof(float) * size * 4, "blackbody texture");
|
||||
data = (float *)MEM_mallocN(sizeof(float) * size * 4, "blackbody texture");
|
||||
blackbody_temperature_to_rgb_table(data, size, 965.0f, 12000.0f);
|
||||
}
|
||||
else {
|
||||
data = MEM_callocN(sizeof(float) * size * 4, "blackbody black");
|
||||
data = (float *)MEM_callocN(sizeof(float) * size * 4, "blackbody black");
|
||||
}
|
||||
GPUNodeLink *spectrummap = GPU_color_band(mat, size, data, &layer);
|
||||
|
||||
|
@ -135,7 +135,7 @@ void register_node_type_sh_volume_principled(void)
|
|||
node_type_socket_templates(&ntype, sh_node_volume_principled_in, sh_node_volume_principled_out);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
node_type_init(&ntype, node_shader_init_volume_principled);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_volume_principled);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
|
@ -49,8 +49,8 @@ void register_node_type_sh_volume_scatter(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_VOLUME_SCATTER, "Volume Scatter", NODE_CLASS_SHADER, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_volume_scatter_in, sh_node_volume_scatter_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_volume_scatter);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Wavelength ******************** */
|
||||
static bNodeSocketTemplate sh_node_wavelength_in[] = {
|
||||
|
@ -37,7 +37,7 @@ static int node_shader_gpu_wavelength(GPUMaterial *mat,
|
|||
GPUNodeStack *out)
|
||||
{
|
||||
const int size = CM_TABLE + 1;
|
||||
float *data = MEM_mallocN(sizeof(float) * size * 4, "cie_xyz texture");
|
||||
float *data = (float *)MEM_mallocN(sizeof(float) * size * 4, "cie_xyz texture");
|
||||
|
||||
wavelength_to_xyz_table(data, size);
|
||||
|
||||
|
@ -65,8 +65,8 @@ void register_node_type_sh_wavelength(void)
|
|||
sh_node_type_base(&ntype, SH_NODE_WAVELENGTH, "Wavelength", NODE_CLASS_CONVERTER, 0);
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_socket_templates(&ntype, sh_node_wavelength_in, sh_node_wavelength_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_wavelength);
|
||||
|
||||
nodeRegisterType(&ntype);
|
|
@ -17,7 +17,7 @@
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
/* **************** Wireframe ******************** */
|
||||
static bNodeSocketTemplate sh_node_wireframe_in[] = {
|
||||
|
@ -59,8 +59,8 @@ void register_node_type_sh_wireframe(void)
|
|||
|
||||
sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, sh_node_wireframe_in, sh_node_wireframe_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_init(&ntype, nullptr);
|
||||
node_type_storage(&ntype, "", nullptr, nullptr);
|
||||
node_type_gpu(&ntype, node_shader_gpu_wireframe);
|
||||
|
||||
nodeRegisterType(&ntype);
|
Loading…
Reference in New Issue