diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-29 06:51:57 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-29 06:51:57 +0300 |
commit | ba38b06a97aa12318a04efb5b426a5dd1adabf88 (patch) | |
tree | 81a83aa9b6d76541d8861e0467721a94cb69c74a /source | |
parent | b92ef379b7bb9ebbe881cb7194b00af151f47926 (diff) |
Nodes: Convert shader, shader category nodes to c++
Also add file namespace
This is needed to use new node APIs
Differential Revision: https://developer.blender.org/D13684
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/nodes/shader/CMakeLists.txt | 38 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_add_shader.cc (renamed from source/blender/nodes/shader/nodes/node_shader_add_shader.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c) | 19 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c) | 19 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c) | 27 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc (renamed from source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_mix_shader.cc (renamed from source/blender/nodes/shader/nodes/node_shader_mix_shader.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc (renamed from source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc (renamed from source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c) | 29 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc (renamed from source/blender/nodes/shader/nodes/node_shader_volume_absorption.c) | 17 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_volume_principled.cc (renamed from source/blender/nodes/shader/nodes/node_shader_volume_principled.c) | 25 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc (renamed from source/blender/nodes/shader/nodes/node_shader_volume_scatter.c) | 17 |
20 files changed, 263 insertions, 132 deletions
diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt index fc6ea1f188e..e0e7a97bf50 100644 --- a/source/blender/nodes/shader/CMakeLists.txt +++ b/source/blender/nodes/shader/CMakeLists.txt @@ -40,25 +40,25 @@ set(INC set(SRC - nodes/node_shader_add_shader.c + nodes/node_shader_add_shader.cc nodes/node_shader_ambient_occlusion.c nodes/node_shader_attribute.c nodes/node_shader_background.c nodes/node_shader_bevel.c nodes/node_shader_blackbody.c nodes/node_shader_brightness.c - nodes/node_shader_bsdf_anisotropic.c - nodes/node_shader_bsdf_diffuse.c - nodes/node_shader_bsdf_glass.c - nodes/node_shader_bsdf_glossy.c - nodes/node_shader_bsdf_hair.c - nodes/node_shader_bsdf_hair_principled.c - nodes/node_shader_bsdf_principled.c - nodes/node_shader_bsdf_refraction.c - nodes/node_shader_bsdf_toon.c - nodes/node_shader_bsdf_translucent.c - nodes/node_shader_bsdf_transparent.c - nodes/node_shader_bsdf_velvet.c + nodes/node_shader_bsdf_anisotropic.cc + nodes/node_shader_bsdf_diffuse.cc + nodes/node_shader_bsdf_glass.cc + nodes/node_shader_bsdf_glossy.cc + nodes/node_shader_bsdf_hair.cc + nodes/node_shader_bsdf_hair_principled.cc + nodes/node_shader_bsdf_principled.cc + nodes/node_shader_bsdf_refraction.cc + nodes/node_shader_bsdf_toon.cc + nodes/node_shader_bsdf_translucent.cc + nodes/node_shader_bsdf_transparent.cc + nodes/node_shader_bsdf_velvet.cc nodes/node_shader_bump.cc nodes/node_shader_camera.c nodes/node_shader_clamp.cc @@ -83,7 +83,7 @@ set(SRC nodes/node_shader_mapping.c nodes/node_shader_math.cc nodes/node_shader_mix_rgb.cc - nodes/node_shader_mix_shader.c + nodes/node_shader_mix_shader.cc nodes/node_shader_normal.c nodes/node_shader_normal_map.c nodes/node_shader_object_info.c @@ -99,9 +99,9 @@ set(SRC nodes/node_shader_sepcomb_hsv.c nodes/node_shader_sepcomb_rgb.cc nodes/node_shader_sepcomb_xyz.cc - nodes/node_shader_shader_to_rgb.c + nodes/node_shader_shader_to_rgb.cc nodes/node_shader_squeeze.c - nodes/node_shader_subsurface_scattering.c + nodes/node_shader_subsurface_scattering.cc nodes/node_shader_tangent.c nodes/node_shader_tex_brick.cc nodes/node_shader_tex_checker.cc @@ -125,10 +125,10 @@ set(SRC nodes/node_shader_vector_rotate.cc nodes/node_shader_vector_transform.c nodes/node_shader_vertex_color.c - nodes/node_shader_volume_absorption.c + nodes/node_shader_volume_absorption.cc nodes/node_shader_volume_info.c - nodes/node_shader_volume_principled.c - nodes/node_shader_volume_scatter.c + nodes/node_shader_volume_principled.cc + nodes/node_shader_volume_scatter.cc nodes/node_shader_wavelength.c nodes/node_shader_wireframe.c diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.c b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc index 12c138ac9d5..02f9e2b29f3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_add_shader_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_add_shader_in[] = { @@ -41,16 +43,21 @@ static int node_shader_gpu_add_shader(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_add_shader", in, out); } +} // namespace blender::nodes::node_shader_add_shader_cc + /* node type definition */ -void register_node_type_sh_add_shader(void) +void register_node_type_sh_add_shader() { + namespace file_ns = blender::nodes::node_shader_add_shader_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_add_shader); + node_type_socket_templates( + &ntype, file_ns::sh_node_add_shader_in, file_ns::sh_node_add_shader_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_add_shader); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc index 499f62da683..6f56a562e42 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_anisotropic_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = { @@ -64,17 +66,22 @@ static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, GPU_constant(&node->ssr_id)); } +} // namespace blender::nodes::node_shader_bsdf_anisotropic_cc + /* node type definition */ -void register_node_type_sh_bsdf_anisotropic(void) +void register_node_type_sh_bsdf_anisotropic() { + namespace file_ns = blender::nodes::node_shader_bsdf_anisotropic_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER, 0); - node_type_socket_templates(&ntype, sh_node_bsdf_anisotropic_in, sh_node_bsdf_anisotropic_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_anisotropic_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_anisotropic); + node_type_init(&ntype, file_ns::node_shader_init_anisotropic); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_anisotropic); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc index f4f1d274826..c2f14d7bcc5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_diffuse_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = { @@ -48,17 +50,22 @@ static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_diffuse", in, out); } +} // namespace blender::nodes::node_shader_bsdf_diffuse_cc + /* node type definition */ -void register_node_type_sh_bsdf_diffuse(void) +void register_node_type_sh_bsdf_diffuse() { + namespace file_ns = blender::nodes::node_shader_bsdf_diffuse_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_bsdf_diffuse_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_diffuse); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_diffuse); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc index 5fc946e3509..c1b124a7b94 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_glass_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_glass_in[] = { @@ -53,7 +55,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; @@ -66,17 +68,22 @@ static int node_shader_gpu_bsdf_glass(GPUMaterial *mat, GPU_constant(&node->ssr_id)); } +} // namespace blender::nodes::node_shader_bsdf_glass_cc + /* node type definition */ -void register_node_type_sh_bsdf_glass(void) +void register_node_type_sh_bsdf_glass() { + namespace file_ns = blender::nodes::node_shader_bsdf_glass_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER, 0); - node_type_socket_templates(&ntype, sh_node_bsdf_glass_in, sh_node_bsdf_glass_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_glass_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_glass); + node_type_init(&ntype, file_ns::node_shader_init_glass); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glass); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc index 13b1b21c7fc..13d50e1c519 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_glossy_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = { @@ -65,17 +67,22 @@ static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat, GPU_constant(&node->ssr_id)); } +} // namespace blender::nodes::node_shader_bsdf_glossy_cc + /* node type definition */ -void register_node_type_sh_bsdf_glossy(void) +void register_node_type_sh_bsdf_glossy() { + namespace file_ns = blender::nodes::node_shader_bsdf_glossy_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER, 0); - node_type_socket_templates(&ntype, sh_node_bsdf_glossy_in, sh_node_bsdf_glossy_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_glossy_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_glossy); + node_type_init(&ntype, file_ns::node_shader_init_glossy); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glossy); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc index fb2decec5f4..2cecbb98d90 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_hair_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_hair_in[] = { @@ -44,17 +46,22 @@ static int node_shader_gpu_bsdf_hair(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_hair", in, out); } +} // namespace blender::nodes::node_shader_bsdf_hair_cc + /* node type definition */ -void register_node_type_sh_bsdf_hair(void) +void register_node_type_sh_bsdf_hair() { + namespace file_ns = blender::nodes::node_shader_bsdf_hair_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_bsdf_hair_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_hair); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_hair); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc index d2b40a7ec39..0fdf1afdb77 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_hair_principled_cc { + /* **************** OUTPUT ******************** */ /* Color, melanin and absorption coefficient default to approximately same brownish hair. */ @@ -61,10 +63,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); } @@ -91,19 +92,23 @@ static void node_shader_update_hair_principled(bNodeTree *ntree, bNode *node) } } +} // namespace blender::nodes::node_shader_bsdf_hair_principled_cc + /* node type definition */ -void register_node_type_sh_bsdf_hair_principled(void) +void register_node_type_sh_bsdf_hair_principled() { + namespace file_ns = blender::nodes::node_shader_bsdf_hair_principled_cc; + static bNodeType ntype; sh_node_type_base( &ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER, 0); node_type_socket_templates( - &ntype, sh_node_bsdf_hair_principled_in, sh_node_bsdf_hair_principled_out); + &ntype, file_ns::sh_node_bsdf_hair_principled_in, file_ns::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_update(&ntype, node_shader_update_hair_principled); + node_type_init(&ntype, file_ns::node_shader_init_hair_principled); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_update(&ntype, file_ns::node_shader_update_hair_principled); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc index b9f4106c79a..bd89b68e3ce 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_principled_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_principled_in[] = { @@ -122,8 +124,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 +153,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 +174,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); } @@ -183,18 +185,23 @@ static void node_shader_update_principled(bNodeTree *ntree, bNode *node) } } +} // namespace blender::nodes::node_shader_bsdf_principled_cc + /* node type definition */ -void register_node_type_sh_bsdf_principled(void) +void register_node_type_sh_bsdf_principled() { + namespace file_ns = blender::nodes::node_shader_bsdf_principled_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER, 0); - node_type_socket_templates(&ntype, sh_node_bsdf_principled_in, sh_node_bsdf_principled_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_principled_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_principled); - node_type_update(&ntype, node_shader_update_principled); + node_type_init(&ntype, file_ns::node_shader_init_principled); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_principled); + node_type_update(&ntype, file_ns::node_shader_update_principled); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc index ff33b3456db..3fbccc76495 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_refraction_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = { @@ -58,17 +60,22 @@ static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_refraction", in, out); } +} // namespace blender::nodes::node_shader_bsdf_refraction_cc + /* node type definition */ -void register_node_type_sh_bsdf_refraction(void) +void register_node_type_sh_bsdf_refraction() { + namespace file_ns = blender::nodes::node_shader_bsdf_refraction_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER, 0); - node_type_socket_templates(&ntype, sh_node_bsdf_refraction_in, sh_node_bsdf_refraction_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_refraction_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_refraction); + node_type_init(&ntype, file_ns::node_shader_init_refraction); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_refraction); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc index 2d04fcee40c..c9df1a92803 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_toon_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_toon_in[] = { @@ -49,17 +51,22 @@ static int node_shader_gpu_bsdf_toon(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_toon", in, out); } +} // namespace blender::nodes::node_shader_bsdf_toon_cc + /* node type definition */ -void register_node_type_sh_bsdf_toon(void) +void register_node_type_sh_bsdf_toon() { + namespace file_ns = blender::nodes::node_shader_bsdf_toon_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_bsdf_toon_in, file_ns::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_gpu(&ntype, node_shader_gpu_bsdf_toon); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_toon); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc index d2e1a276645..b9e4d47eabd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_translucent_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = { @@ -47,16 +49,21 @@ static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_translucent", in, out); } +} // namespace blender::nodes::node_shader_bsdf_translucent_cc + /* node type definition */ -void register_node_type_sh_bsdf_translucent(void) +void register_node_type_sh_bsdf_translucent() { + namespace file_ns = blender::nodes::node_shader_bsdf_translucent_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_bsdf_translucent); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_translucent_in, file_ns::sh_node_bsdf_translucent_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_translucent); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc index 45f8ebf1d52..23742498a2d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_transparent_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = { @@ -40,16 +42,21 @@ static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_transparent", in, out); } +} // namespace blender::nodes::node_shader_bsdf_transparent_cc + /* node type definition */ -void register_node_type_sh_bsdf_transparent(void) +void register_node_type_sh_bsdf_transparent() { + namespace file_ns = blender::nodes::node_shader_bsdf_transparent_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_bsdf_transparent); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_transparent_in, file_ns::sh_node_bsdf_transparent_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_transparent); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc index 59e8bbd3c63..f23e7e2c35f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_bsdf_velvet_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = { @@ -48,16 +50,21 @@ static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bsdf_velvet", in, out); } +} // namespace blender::nodes::node_shader_bsdf_velvet_cc + /* node type definition */ -void register_node_type_sh_bsdf_velvet(void) +void register_node_type_sh_bsdf_velvet() { + namespace file_ns = blender::nodes::node_shader_bsdf_velvet_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_bsdf_velvet); + node_type_socket_templates( + &ntype, file_ns::sh_node_bsdf_velvet_in, file_ns::sh_node_bsdf_velvet_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_velvet); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc index 33cbf34543c..84754b2eb5f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.c +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_mix_shader_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_mix_shader_in[] = { @@ -42,16 +44,21 @@ static int node_shader_gpu_mix_shader(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_mix_shader", in, out); } +} // namespace blender::nodes::node_shader_mix_shader_cc + /* node type definition */ -void register_node_type_sh_mix_shader(void) +void register_node_type_sh_mix_shader() { + namespace file_ns = blender::nodes::node_shader_mix_shader_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_mix_shader); + node_type_socket_templates( + &ntype, file_ns::sh_node_mix_shader_in, file_ns::sh_node_mix_shader_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_mix_shader); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.c b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc index 25c30aa4081..aab721e7ac1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.c +++ b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_shader_to_rgb_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_shadertorgb_in[] = { @@ -45,16 +47,21 @@ static int node_shader_gpu_shadertorgb(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_shader_to_rgba", in, out); } +} // namespace blender::nodes::node_shader_shader_to_rgb_cc + /* node type definition */ -void register_node_type_sh_shadertorgb(void) +void register_node_type_sh_shadertorgb() { + namespace file_ns = blender::nodes::node_shader_shader_to_rgb_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_shadertorgb); + node_type_socket_templates( + &ntype, file_ns::sh_node_shadertorgb_in, file_ns::sh_node_shadertorgb_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_shadertorgb); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc index 85a4a6aa425..4526017c2bf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_subsurface_scattering_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = { @@ -53,14 +55,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,27 +73,32 @@ 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); } } } +} // namespace blender::nodes::node_shader_subsurface_scattering_cc + /* node type definition */ -void register_node_type_sh_subsurface_scattering(void) +void register_node_type_sh_subsurface_scattering() { + namespace file_ns = blender::nodes::node_shader_subsurface_scattering_cc; + static bNodeType ntype; sh_node_type_base( &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER, 0); - node_type_socket_templates( - &ntype, sh_node_subsurface_scattering_in, sh_node_subsurface_scattering_out); + node_type_socket_templates(&ntype, + file_ns::sh_node_subsurface_scattering_in, + file_ns::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_gpu(&ntype, node_shader_gpu_subsurface_scattering); - node_type_update(&ntype, node_shader_update_subsurface_scattering); + node_type_init(&ntype, file_ns::node_shader_init_subsurface_scattering); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_subsurface_scattering); + node_type_update(&ntype, file_ns::node_shader_update_subsurface_scattering); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc index abf2e63e6d5..11479013d57 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_volume_absorption_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_volume_absorption_in[] = { @@ -41,16 +43,21 @@ static int node_shader_gpu_volume_absorption(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_volume_absorption", in, out); } +} // namespace blender::nodes::node_shader_volume_absorption_cc + /* node type definition */ -void register_node_type_sh_volume_absorption(void) +void register_node_type_sh_volume_absorption() { + namespace file_ns = blender::nodes::node_shader_volume_absorption_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_volume_absorption); + node_type_socket_templates( + &ntype, file_ns::sh_node_volume_absorption_in, file_ns::sh_node_volume_absorption_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_absorption); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc index 1a25aec5cb8..9fdc1a4821b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_volume_principled_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_volume_principled_in[] = { @@ -64,14 +66,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 +108,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); @@ -126,17 +128,22 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat, GPU_constant(&layer)); } +} // namespace blender::nodes::node_shader_volume_principled_cc + /* node type definition */ -void register_node_type_sh_volume_principled(void) +void register_node_type_sh_volume_principled() { + namespace file_ns = blender::nodes::node_shader_volume_principled_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER, 0); - node_type_socket_templates(&ntype, sh_node_volume_principled_in, sh_node_volume_principled_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_volume_principled_in, file_ns::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_gpu(&ntype, node_shader_gpu_volume_principled); + node_type_init(&ntype, file_ns::node_shader_init_volume_principled); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_principled); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc index f4cfe7729ca..9aa86c44ec3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c +++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc @@ -19,6 +19,8 @@ #include "../node_shader_util.h" +namespace blender::nodes::node_shader_volume_scatter_cc { + /* **************** OUTPUT ******************** */ static bNodeSocketTemplate sh_node_volume_scatter_in[] = { @@ -42,16 +44,21 @@ static int node_shader_gpu_volume_scatter(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_volume_scatter", in, out); } +} // namespace blender::nodes::node_shader_volume_scatter_cc + /* node type definition */ -void register_node_type_sh_volume_scatter(void) +void register_node_type_sh_volume_scatter() { + namespace file_ns = blender::nodes::node_shader_volume_scatter_cc; + static bNodeType ntype; 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_gpu(&ntype, node_shader_gpu_volume_scatter); + node_type_socket_templates( + &ntype, file_ns::sh_node_volume_scatter_in, file_ns::sh_node_volume_scatter_out); + node_type_init(&ntype, nullptr); + node_type_storage(&ntype, "", nullptr, nullptr); + node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_scatter); nodeRegisterType(&ntype); } |