diff options
author | Aaron Carlisle <Blendify> | 2021-12-06 01:46:45 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-06 01:47:33 +0300 |
commit | 3f7014ecc9d523997062eadd62888af5fc70a2b6 (patch) | |
tree | d084b014e9b116d2ab579f54c332dd49c311828c /source/blender/nodes/shader | |
parent | 0a8a22fc04d3475d2c5f41f2e022c8e28d099520 (diff) |
Shader Nodes: Declare nodes in their own namespace
Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5
This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly
- The namespace name is derived from the file name.
That makes it possible to write some tooling that checks the names later on.
The filename extension (cc) is added to the namespace name as well.
This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.
- In the register function of every node, I added a namespace alias namespace `file_ns = blender::nodes::node_shader_*_cc`;.
This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect.
The name `file_ns` stands for "file namespace" and also indicates that this namespace corresponds to the current file.
In the future some nodes will be split up to separate files and given their own namespace
This will allow function names to be simplified similar to rBfab39440e94
Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13480
Diffstat (limited to 'source/blender/nodes/shader')
89 files changed, 890 insertions, 428 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc index 5ebbdc73026..ea06c11326b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_add_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_add_shader.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_add_shader_cc { + static bNodeSocketTemplate sh_node_add_shader_in[] = { {SOCK_SHADER, N_("Shader")}, {SOCK_SHADER, N_("Shader")}, @@ -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() { + 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_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, node_shader_gpu_add_shader); + node_type_gpu(&ntype, file_ns::node_shader_gpu_add_shader); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc index 3b8e3f3ce7e..cf201aab7d8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_ambient_occlusion_cc { + static bNodeSocketTemplate sh_node_ambient_occlusion_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -64,16 +66,21 @@ static void node_shader_init_ambient_occlusion(bNodeTree *UNUSED(ntree), bNode * node->custom2 = 0; } +} // namespace blender::nodes::node_shader_ambient_occlusion_cc + /* node type definition */ void register_node_type_sh_ambient_occlusion() { + namespace file_ns = blender::nodes::node_shader_ambient_occlusion_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_ambient_occlusion_in, file_ns::sh_node_ambient_occlusion_out); + node_type_init(&ntype, file_ns::node_shader_init_ambient_occlusion); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_ambient_occlusion); + node_type_gpu(&ntype, file_ns::node_shader_gpu_ambient_occlusion); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index 246c4b071da..068d1266caa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_attribute_cc { + static bNodeSocketTemplate sh_node_attribute_out[] = { {SOCK_RGBA, N_("Color")}, {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -82,17 +84,21 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, return 1; } +} // namespace blender::nodes::node_shader_attribute_cc + /* node type definition */ void register_node_type_sh_attribute() { + namespace file_ns = blender::nodes::node_shader_attribute_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_attribute_out); - node_type_init(&ntype, node_shader_init_attribute); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out); + node_type_init(&ntype, file_ns::node_shader_init_attribute); node_type_storage( &ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_attribute); + node_type_gpu(&ntype, file_ns::node_shader_gpu_attribute); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc index e7174a22b06..68ff2a3fb40 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.cc +++ b/source/blender/nodes/shader/nodes/node_shader_background.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_background_cc { + static bNodeSocketTemplate sh_node_background_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, @@ -41,16 +43,21 @@ static int node_shader_gpu_background(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_background", in, out); } +} // namespace blender::nodes::node_shader_background_cc + /* node type definition */ void register_node_type_sh_background() { + namespace file_ns = blender::nodes::node_shader_background_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_background_in, file_ns::sh_node_background_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_background); + node_type_gpu(&ntype, file_ns::node_shader_gpu_background); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc index 577af8fb294..f34e9e99f37 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bevel_cc { + static bNodeSocketTemplate sh_node_bevel_in[] = { {SOCK_FLOAT, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, @@ -54,16 +56,20 @@ static int gpu_shader_bevel(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_bevel", in, out); } +} // namespace blender::nodes::node_shader_bevel_cc + /* node type definition */ void register_node_type_sh_bevel() { + namespace file_ns = blender::nodes::node_shader_bevel_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_bevel_in, file_ns::sh_node_bevel_out); + node_type_init(&ntype, file_ns::node_shader_init_bevel); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, gpu_shader_bevel); + node_type_gpu(&ntype, file_ns::gpu_shader_bevel); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc index abaac628bae..de5bf98fd79 100644 --- a/source/blender/nodes/shader/nodes/node_shader_blackbody.cc +++ b/source/blender/nodes/shader/nodes/node_shader_blackbody.cc @@ -20,6 +20,9 @@ #include "node_shader_util.hh" /* **************** Blackbody ******************** */ + +namespace blender::nodes::node_shader_blackbody_cc { + static bNodeSocketTemplate sh_node_blackbody_in[] = { {SOCK_FLOAT, N_("Temperature"), 1500.0f, 0.0f, 0.0f, 0.0f, 800.0f, 12000.0f}, {-1, ""}, @@ -47,17 +50,22 @@ static int node_shader_gpu_blackbody(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_blackbody", in, out, ramp_texture, GPU_constant(&layer)); } +} // namespace blender::nodes::node_shader_blackbody_cc + /* node type definition */ void register_node_type_sh_blackbody() { + namespace file_ns = blender::nodes::node_shader_blackbody_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_blackbody_in, file_ns::sh_node_blackbody_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_blackbody); + node_type_gpu(&ntype, file_ns::node_shader_gpu_blackbody); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc index e87c78d0a0b..3e76a2cb0b1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc +++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc @@ -21,6 +21,8 @@ /* **************** Bright and contrast ******************** */ +namespace blender::nodes::node_shader_brightness_cc { + static bNodeSocketTemplate sh_node_brightcontrast_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, @@ -42,15 +44,20 @@ static int gpu_shader_brightcontrast(GPUMaterial *mat, return GPU_stack_link(mat, node, "brightness_contrast", in, out); } +} // namespace blender::nodes::node_shader_brightness_cc + void register_node_type_sh_brightcontrast() { + namespace file_ns = blender::nodes::node_shader_brightness_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_brightcontrast_in, file_ns::sh_node_brightcontrast_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, gpu_shader_brightcontrast); + node_type_gpu(&ntype, file_ns::gpu_shader_brightcontrast); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc index 3237ed2e4d5..5a614e7b155 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_anisotropic_cc { + static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -64,17 +66,22 @@ static int node_shader_gpu_bsdf_anisotropic(GPUMaterial *mat, GPU_constant(&node->ssr_id)); } +} // namespace blender::nodes::node_shader_anisotropic_cc + /* node type definition */ void register_node_type_sh_bsdf_anisotropic() { + namespace file_ns = blender::nodes::node_shader_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_init(&ntype, file_ns::node_shader_init_anisotropic); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_anisotropic); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc index b838881ba61..8b30436db09 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_diffuse_cc { + static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_diffuse); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc index 67311777da6..78ad2d7b121 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_glass_cc { + static bNodeSocketTemplate sh_node_bsdf_glass_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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_init(&ntype, file_ns::node_shader_init_glass); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_glass); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc index 1ec0203347f..cd12eac79e0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_glossy_cc { + static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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_init(&ntype, file_ns::node_shader_init_glossy); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_glossy); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc index 8969e53731e..dfd8c219f87 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_hair_cc { + static bNodeSocketTemplate sh_node_bsdf_hair_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE}, @@ -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() { + 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, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_hair); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc index 930c40b5720..4916728240c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_hair_principled_cc { + /* Color, melanin and absorption coefficient default to approximately same brownish hair. */ static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = { {SOCK_RGBA, N_("Color"), 0.017513f, 0.005763f, 0.002059f, 1.0f, 0.0f, 1.0f}, @@ -90,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() { + 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_init(&ntype, file_ns::node_shader_init_hair_principled); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_update(&ntype, node_shader_update_hair_principled); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc index 61c0a14c67f..00036bfb662 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_principled_cc { + static bNodeSocketTemplate sh_node_bsdf_principled_in[] = { {SOCK_RGBA, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Subsurface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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_init(&ntype, file_ns::node_shader_init_principled); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_principled); - node_type_update(&ntype, node_shader_update_principled); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc index 3f50e33c316..5918364e1cf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_refraction_cc { + static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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_init(&ntype, file_ns::node_shader_init_refraction); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_refraction); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc index 4eae82a8eae..73a3d552b9a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_toon_cc { + static bNodeSocketTemplate sh_node_bsdf_toon_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_bsdf_toon); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc index 0e8b4cfe62f..662a8dd57fe 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_translucent_cc { + static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, @@ -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() { + 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_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, node_shader_gpu_bsdf_translucent); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc index 39b925e0222..f2fc7344bbb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_transparent_cc { + static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}, @@ -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() { + 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_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, node_shader_gpu_bsdf_transparent); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc index f5c02c620aa..667eef663c2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_velvet_cc { + static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Sigma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -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() { + 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_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, node_shader_gpu_bsdf_velvet); + node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_velvet); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc index 6e520b159c9..40871c9ab32 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** BUMP ******************** */ + +namespace blender::nodes::node_shader_bump_cc { + /* clang-format off */ static bNodeSocketTemplate sh_node_bump_in[] = { {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -54,15 +57,19 @@ static int gpu_shader_bump(GPUMaterial *mat, mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); } +} // namespace blender::nodes::node_shader_bump_cc + /* node type definition */ void register_node_type_sh_bump() { + namespace file_ns = blender::nodes::node_shader_bump_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_bump_in, file_ns::sh_node_bump_out); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, gpu_shader_bump); + node_type_gpu(&ntype, file_ns::gpu_shader_bump); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.cc b/source/blender/nodes/shader/nodes/node_shader_camera.cc index 0dfc72adc74..d9349ccf86c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.cc +++ b/source/blender/nodes/shader/nodes/node_shader_camera.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** CAMERA INFO ******************** */ + +namespace blender::nodes::node_shader_camera_cc { + static bNodeSocketTemplate sh_node_camera_out[] = { {SOCK_VECTOR, N_("View Vector")}, {SOCK_FLOAT, N_("View Z Depth")}, @@ -44,14 +47,18 @@ static int gpu_shader_camera(GPUMaterial *mat, return GPU_stack_link(mat, node, "camera", in, out, viewvec); } +} // namespace blender::nodes::node_shader_camera_cc + void register_node_type_sh_camera() { + namespace file_ns = blender::nodes::node_shader_camera_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_camera_out); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_camera_out); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, gpu_shader_camera); + node_type_gpu(&ntype, file_ns::gpu_shader_camera); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc index f8ba1359ed5..50577749977 100644 --- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc @@ -23,7 +23,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_clamp_cc { static void sh_node_clamp_declare(NodeDeclarationBuilder &b) { @@ -34,8 +34,6 @@ static void sh_node_clamp_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Result")); }; -} // namespace blender::nodes - static void node_shader_init_clamp(bNodeTree *UNUSED(ntree), bNode *node) { node->custom1 = NODE_CLAMP_MINMAX; /* clamp type */ @@ -75,15 +73,19 @@ static void sh_node_clamp_build_multi_function(blender::nodes::NodeMultiFunction } } +} // namespace blender::nodes::node_shader_clamp_cc + void register_node_type_sh_clamp() { + namespace file_ns = blender::nodes::node_shader_clamp_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_clamp_declare; - node_type_init(&ntype, node_shader_init_clamp); - node_type_gpu(&ntype, gpu_shader_clamp); - ntype.build_multi_function = sh_node_clamp_build_multi_function; + ntype.declare = file_ns::sh_node_clamp_declare; + node_type_init(&ntype, file_ns::node_shader_init_clamp); + node_type_gpu(&ntype, file_ns::gpu_shader_clamp); + ntype.build_multi_function = file_ns::sh_node_clamp_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc index 77eaeebb330..55bf75217c4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.cc +++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc @@ -23,7 +23,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_curve_vec_cc { static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b) { @@ -33,8 +33,6 @@ static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b) b.add_output<decl::Vector>(N_("Vector")); }; -} // namespace blender::nodes - static void node_shader_exec_curve_vec(void *UNUSED(data), int UNUSED(thread), bNode *node, @@ -152,25 +150,29 @@ static void sh_node_curve_vec_build_multi_function( builder.construct_and_set_matching_fn<CurveVecFunction>(*cumap); } +} // namespace blender::nodes::node_shader_curve_vec_cc + void register_node_type_sh_curve_vec() { + namespace file_ns = blender::nodes::node_shader_curve_vec_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); - ntype.declare = blender::nodes::sh_node_curve_vec_declare; - node_type_init(&ntype, node_shader_init_curve_vec); + ntype.declare = file_ns::sh_node_curve_vec_declare; + node_type_init(&ntype, file_ns::node_shader_init_curve_vec); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - node_type_exec(&ntype, node_initexec_curves, nullptr, node_shader_exec_curve_vec); - node_type_gpu(&ntype, gpu_shader_curve_vec); - ntype.build_multi_function = sh_node_curve_vec_build_multi_function; + node_type_exec(&ntype, node_initexec_curves, nullptr, file_ns::node_shader_exec_curve_vec); + node_type_gpu(&ntype, file_ns::gpu_shader_curve_vec); + ntype.build_multi_function = file_ns::sh_node_curve_vec_build_multi_function; nodeRegisterType(&ntype); } /* **************** CURVE RGB ******************** */ -namespace blender::nodes { +namespace blender::nodes::node_shader_curve_rgb_cc { static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b) { @@ -180,8 +182,6 @@ static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b) b.add_output<decl::Color>(N_("Color")); }; -} // namespace blender::nodes - static void node_shader_exec_curve_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, @@ -329,25 +329,29 @@ static void sh_node_curve_rgb_build_multi_function( builder.construct_and_set_matching_fn<CurveRGBFunction>(*cumap); } +} // namespace blender::nodes::node_shader_curve_rgb_cc + void register_node_type_sh_curve_rgb() { + namespace file_ns = blender::nodes::node_shader_curve_rgb_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0); - ntype.declare = blender::nodes::sh_node_curve_rgb_declare; - node_type_init(&ntype, node_shader_init_curve_rgb); + ntype.declare = file_ns::sh_node_curve_rgb_declare; + node_type_init(&ntype, file_ns::node_shader_init_curve_rgb); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - node_type_exec(&ntype, node_initexec_curves, nullptr, node_shader_exec_curve_rgb); - node_type_gpu(&ntype, gpu_shader_curve_rgb); - ntype.build_multi_function = sh_node_curve_rgb_build_multi_function; + node_type_exec(&ntype, node_initexec_curves, nullptr, file_ns::node_shader_exec_curve_rgb); + node_type_gpu(&ntype, file_ns::gpu_shader_curve_rgb); + ntype.build_multi_function = file_ns::sh_node_curve_rgb_build_multi_function; nodeRegisterType(&ntype); } /* **************** CURVE FLOAT ******************** */ -namespace blender::nodes { +namespace blender::nodes::node_shader_curve_float_cc { static void sh_node_curve_float_declare(NodeDeclarationBuilder &b) { @@ -361,8 +365,6 @@ static void sh_node_curve_float_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Value")); }; -} // namespace blender::nodes - static void node_shader_exec_curve_float(void *UNUSED(data), int UNUSED(thread), bNode *node, @@ -473,18 +475,22 @@ static void sh_node_curve_float_build_multi_function( builder.construct_and_set_matching_fn<CurveFloatFunction>(*cumap); } +} // namespace blender::nodes::node_shader_curve_float_cc + void register_node_type_sh_curve_float() { + namespace file_ns = blender::nodes::node_shader_curve_float_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_curve_float_declare; - node_type_init(&ntype, node_shader_init_curve_float); + ntype.declare = file_ns::sh_node_curve_float_declare; + node_type_init(&ntype, file_ns::node_shader_init_curve_float); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); - node_type_exec(&ntype, node_initexec_curves, nullptr, node_shader_exec_curve_float); - node_type_gpu(&ntype, gpu_shader_curve_float); - ntype.build_multi_function = sh_node_curve_float_build_multi_function; + node_type_exec(&ntype, node_initexec_curves, nullptr, file_ns::node_shader_exec_curve_float); + node_type_gpu(&ntype, file_ns::gpu_shader_curve_float); + ntype.build_multi_function = file_ns::sh_node_curve_float_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_displacement.cc index ca21870d360..238f2014fa7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_displacement.cc +++ b/source/blender/nodes/shader/nodes/node_shader_displacement.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_displacement_cc { + static bNodeSocketTemplate sh_node_displacement_in[] = { {SOCK_FLOAT, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, {SOCK_FLOAT, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -68,16 +70,21 @@ static int gpu_shader_displacement(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_displacement_world", in, out); } +} // namespace blender::nodes::node_shader_displacement_cc + /* node type definition */ void register_node_type_sh_displacement() { + namespace file_ns = blender::nodes::node_shader_displacement_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_displacement_in, file_ns::sh_node_displacement_out); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_init(&ntype, node_shader_init_displacement); - node_type_gpu(&ntype, gpu_shader_displacement); + node_type_init(&ntype, file_ns::node_shader_init_displacement); + node_type_gpu(&ntype, file_ns::gpu_shader_displacement); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc index bbe51b7b751..190ed0c1590 100644 --- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_eevee_specular_cc { + static bNodeSocketTemplate sh_node_eevee_specular_in[] = { {SOCK_RGBA, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f}, {SOCK_RGBA, N_("Specular"), 0.03f, 0.03f, 0.03f, 1.0f}, @@ -86,16 +88,21 @@ static int node_shader_gpu_eevee_specular(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_eevee_specular", in, out, GPU_constant(&node->ssr_id)); } +} // namespace blender::nodes::node_shader_eevee_specular_cc + /* node type definition */ void register_node_type_sh_eevee_specular() { + namespace file_ns = blender::nodes::node_shader_eevee_specular_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_eevee_specular_in, file_ns::sh_node_eevee_specular_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_eevee_specular); + node_type_gpu(&ntype, file_ns::node_shader_gpu_eevee_specular); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.cc b/source/blender/nodes/shader/nodes/node_shader_emission.cc index f759092a7b2..8026879e656 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.cc +++ b/source/blender/nodes/shader/nodes/node_shader_emission.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_emission_cc { + static bNodeSocketTemplate sh_node_emission_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, @@ -41,16 +43,20 @@ static int node_shader_gpu_emission(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_emission", in, out, GPU_builtin(GPU_VIEW_NORMAL)); } +} // namespace blender::nodes::node_shader_emission_cc + /* node type definition */ void register_node_type_sh_emission() { + namespace file_ns = blender::nodes::node_shader_emission_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_emission_in, file_ns::sh_node_emission_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_emission); + node_type_gpu(&ntype, file_ns::node_shader_gpu_emission); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc index 2c2c1bba245..92688fbabea 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc @@ -20,6 +20,9 @@ #include "node_shader_util.hh" /* **************** Fresnel ******************** */ + +namespace blender::nodes::node_shader_fresnel_cc { + static bNodeSocketTemplate sh_node_fresnel_in[] = { {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, @@ -57,17 +60,21 @@ static void node_shader_exec_fresnel(void *UNUSED(data), { } +} // namespace blender::nodes::node_shader_fresnel_cc + /* node type definition */ void register_node_type_sh_fresnel() { + namespace file_ns = blender::nodes::node_shader_fresnel_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_fresnel_in, file_ns::sh_node_fresnel_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_fresnel); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_fresnel); + node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_fresnel); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_gamma.cc b/source/blender/nodes/shader/nodes/node_shader_gamma.cc index f9389475694..ecac578701a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_gamma.cc +++ b/source/blender/nodes/shader/nodes/node_shader_gamma.cc @@ -21,6 +21,8 @@ /* **************** Gamma Tools ******************** */ +namespace blender::nodes::node_shader_gamma_cc { + static bNodeSocketTemplate sh_node_gamma_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_FLOAT, N_("Gamma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.001f, 10.0f, PROP_UNSIGNED}, @@ -58,16 +60,20 @@ static int node_shader_gpu_gamma(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_gamma", in, out); } +} // namespace blender::nodes::node_shader_gamma_cc + void register_node_type_sh_gamma() { + namespace file_ns = blender::nodes::node_shader_gamma_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_gamma_in, file_ns::sh_node_gamma_out); 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); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_gamma); + node_type_gpu(&ntype, file_ns::node_shader_gpu_gamma); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_geometry.cc b/source/blender/nodes/shader/nodes/node_shader_geometry.cc index 620a571f2f4..22c865cf82c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_geometry.cc +++ b/source/blender/nodes/shader/nodes/node_shader_geometry.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_geometry_cc { + static bNodeSocketTemplate sh_node_geometry_out[] = { {SOCK_VECTOR, N_("Position"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -86,16 +88,20 @@ static int node_shader_gpu_geometry(GPUMaterial *mat, return success; } +} // namespace blender::nodes::node_shader_geometry_cc + /* node type definition */ void register_node_type_sh_geometry() { + namespace file_ns = blender::nodes::node_shader_geometry_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_geometry_out); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_geometry_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_geometry); + node_type_gpu(&ntype, file_ns::node_shader_gpu_geometry); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc index 7f106f251d1..76d5553c0d0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc @@ -19,6 +19,8 @@ #include "node_shader_util.hh" +namespace blender::nodes::node_shader_hair_info_cc { + static bNodeSocketTemplate outputs[] = { {SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -43,16 +45,20 @@ static int node_shader_gpu_hair_info(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link); } +} // namespace blender::nodes::node_shader_hair_info_cc + /* node type definition */ void register_node_type_sh_hair_info() { + namespace file_ns = blender::nodes::node_shader_hair_info_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, outputs); + node_type_socket_templates(&ntype, nullptr, file_ns::outputs); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_hair_info); + node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_holdout.cc b/source/blender/nodes/shader/nodes/node_shader_holdout.cc index 55833660110..a0e8124d9dd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_holdout.cc +++ b/source/blender/nodes/shader/nodes/node_shader_holdout.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_holdout_cc { + static bNodeSocketTemplate sh_node_holdout_in[] = { {-1, ""}, }; @@ -39,16 +41,20 @@ static int gpu_shader_rgb(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_holdout", in, out); } +} // namespace blender::nodes::node_shader_holdout_cc + /* node type definition */ void register_node_type_sh_holdout() { + namespace file_ns = blender::nodes::node_shader_holdout_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_holdout_in, file_ns::sh_node_holdout_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, gpu_shader_rgb); + node_type_gpu(&ntype, file_ns::gpu_shader_rgb); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc index efa9365c37e..101166b1e6d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** Hue Saturation ******************** */ + +namespace blender::nodes::node_shader_hueSatVal_cc { + static bNodeSocketTemplate sh_node_hue_sat_in[] = { {SOCK_FLOAT, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, {SOCK_FLOAT, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, @@ -85,15 +88,19 @@ static int gpu_shader_hue_sat(GPUMaterial *mat, return GPU_stack_link(mat, node, "hue_sat", in, out); } +} // namespace blender::nodes::node_shader_hueSatVal_cc + void register_node_type_sh_hue_sat() { + namespace file_ns = blender::nodes::node_shader_hueSatVal_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_hue_sat_in, file_ns::sh_node_hue_sat_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_hue_sat); - node_type_gpu(&ntype, gpu_shader_hue_sat); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_hue_sat); + node_type_gpu(&ntype, file_ns::gpu_shader_hue_sat); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc index 50793a48a21..9bf402d055c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc @@ -21,6 +21,8 @@ /* **************** IES Light ******************** */ +namespace blender::nodes::node_shader_ies_light_cc { + static bNodeSocketTemplate sh_node_tex_ies_in[] = { {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f, PROP_NONE}, @@ -39,14 +41,18 @@ static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node) node->storage = tex; } +} // namespace blender::nodes::node_shader_ies_light_cc + /* node type definition */ void register_node_type_sh_tex_ies() { + namespace file_ns = blender::nodes::node_shader_ies_light_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE, 0); - node_type_socket_templates(&ntype, sh_node_tex_ies_in, sh_node_tex_ies_out); - node_type_init(&ntype, node_shader_init_tex_ies); + node_type_socket_templates(&ntype, file_ns::sh_node_tex_ies_in, file_ns::sh_node_tex_ies_out); + node_type_init(&ntype, file_ns::node_shader_init_tex_ies); node_type_storage( &ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc index 8b6b5ca0a01..e3981eab88c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.cc +++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** INVERT ******************** */ + +namespace blender::nodes::node_shader_invert_cc { + static bNodeSocketTemplate sh_node_invert_in[] = { {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, @@ -65,14 +68,18 @@ static int gpu_shader_invert(GPUMaterial *mat, return GPU_stack_link(mat, node, "invert", in, out); } +} // namespace blender::nodes::node_shader_invert_cc + void register_node_type_sh_invert() { + namespace file_ns = blender::nodes::node_shader_invert_cc; + static bNodeType ntype; 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, nullptr, nullptr, node_shader_exec_invert); - node_type_gpu(&ntype, gpu_shader_invert); + node_type_socket_templates(&ntype, file_ns::sh_node_invert_in, file_ns::sh_node_invert_out); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_invert); + node_type_gpu(&ntype, file_ns::gpu_shader_invert); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc index dbb4fb619c4..b87f25eb483 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc @@ -21,6 +21,8 @@ /* **************** Layer Weight ******************** */ +namespace blender::nodes::node_shader_layer_weight_cc { + static bNodeSocketTemplate sh_node_layer_weight_in[] = { {SOCK_FLOAT, N_("Blend"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, @@ -59,17 +61,22 @@ static void node_shader_exec_layer_weight(void *UNUSED(data), { } +} // namespace blender::nodes::node_shader_layer_weight_cc + /* node type definition */ void register_node_type_sh_layer_weight() { + namespace file_ns = blender::nodes::node_shader_layer_weight_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_layer_weight_in, file_ns::sh_node_layer_weight_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_layer_weight); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_layer_weight); + node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_layer_weight); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc index c9118135e5f..7568505b9f1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc @@ -21,6 +21,8 @@ /* **************** INPUT ********************* */ +namespace blender::nodes::node_shader_light_falloff_cc { + static bNodeSocketTemplate sh_node_light_falloff_in[] = { {SOCK_FLOAT, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, {SOCK_FLOAT, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -45,17 +47,22 @@ static int node_shader_gpu_light_falloff(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_light_falloff", in, out); } +} // namespace blender::nodes::node_shader_light_falloff_cc + /* node type definition */ void register_node_type_sh_light_falloff() { + namespace file_ns = blender::nodes::node_shader_light_falloff_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_light_falloff_in, file_ns::sh_node_light_falloff_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_light_falloff); + node_type_gpu(&ntype, file_ns::node_shader_gpu_light_falloff); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.cc b/source/blender/nodes/shader/nodes/node_shader_light_path.cc index 73923a5bf43..5e3f316ad7a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_light_path_cc { + static bNodeSocketTemplate sh_node_light_path_out[] = { {SOCK_FLOAT, N_("Is Camera Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Is Shadow Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -47,16 +49,20 @@ static int node_shader_gpu_light_path(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_light_path", in, out); } +} // namespace blender::nodes::node_shader_light_path_cc + /* node type definition */ void register_node_type_sh_light_path() { + namespace file_ns = blender::nodes::node_shader_light_path_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_light_path_out); + node_type_socket_templates(&ntype, nullptr, file_ns::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); + node_type_gpu(&ntype, file_ns::node_shader_gpu_light_path); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc index 929f016c475..f8fcd15a1c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -25,7 +25,7 @@ #include "BLI_math_base_safe.h" -namespace blender::nodes { +namespace blender::nodes::node_shader_map_range_cc { static void sh_node_map_range_declare(NodeDeclarationBuilder &b) { @@ -39,8 +39,6 @@ static void sh_node_map_range_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Result")); }; -} // namespace blender::nodes - static void node_shader_update_map_range(bNodeTree *ntree, bNode *node) { bNodeSocket *sockSteps = nodeFindSocket(node, SOCK_IN, "Steps"); @@ -307,16 +305,20 @@ static void sh_node_map_range_build_multi_function( } } +} // namespace blender::nodes::node_shader_map_range_cc + void register_node_type_sh_map_range() { + namespace file_ns = blender::nodes::node_shader_map_range_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_map_range_declare; - node_type_init(&ntype, node_shader_init_map_range); - node_type_update(&ntype, node_shader_update_map_range); - node_type_gpu(&ntype, gpu_shader_map_range); - ntype.build_multi_function = sh_node_map_range_build_multi_function; + ntype.declare = file_ns::sh_node_map_range_declare; + node_type_init(&ntype, file_ns::node_shader_init_map_range); + node_type_update(&ntype, file_ns::node_shader_update_map_range); + node_type_gpu(&ntype, file_ns::gpu_shader_map_range); + ntype.build_multi_function = file_ns::sh_node_map_range_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc index 45141b11362..ef72dc59095 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** MAPPING ******************** */ + +namespace blender::nodes::node_shader_mapping_cc { + static bNodeSocketTemplate sh_node_mapping_in[] = { {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_NONE}, {SOCK_VECTOR, N_("Location"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION}, @@ -64,14 +67,18 @@ static void node_shader_update_mapping(bNodeTree *ntree, bNode *node) ntree, sock, ELEM(node->custom1, NODE_MAPPING_TYPE_POINT, NODE_MAPPING_TYPE_TEXTURE)); } +} // namespace blender::nodes::node_shader_mapping_cc + void register_node_type_sh_mapping() { + namespace file_ns = blender::nodes::node_shader_mapping_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, sh_node_mapping_in, sh_node_mapping_out); - node_type_gpu(&ntype, gpu_shader_mapping); - node_type_update(&ntype, node_shader_update_mapping); + node_type_socket_templates(&ntype, file_ns::sh_node_mapping_in, file_ns::sh_node_mapping_out); + node_type_gpu(&ntype, file_ns::gpu_shader_mapping); + node_type_update(&ntype, file_ns::node_shader_update_mapping); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc index aa6d3e4fc6a..5fca37aecb4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_math.cc @@ -27,7 +27,7 @@ /* **************** SCALAR MATH ******************** */ -namespace blender::nodes { +namespace blender::nodes::node_shader_math_cc { static void sh_node_math_declare(NodeDeclarationBuilder &b) { @@ -44,8 +44,6 @@ static void sh_node_math_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Value")); }; -} // namespace blender::nodes - static const char *gpu_shader_get_name(int mode) { const blender::nodes::FloatMathOperationInfo *info = @@ -161,16 +159,20 @@ static void sh_node_math_build_multi_function(blender::nodes::NodeMultiFunctionB } } +} // namespace blender::nodes::node_shader_math_cc + void register_node_type_sh_math() { + namespace file_ns = blender::nodes::node_shader_math_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_math_declare; + ntype.declare = file_ns::sh_node_math_declare; node_type_label(&ntype, node_math_label); - node_type_gpu(&ntype, gpu_shader_math); + node_type_gpu(&ntype, file_ns::gpu_shader_math); node_type_update(&ntype, node_math_update); - ntype.build_multi_function = sh_node_math_build_multi_function; + ntype.build_multi_function = file_ns::sh_node_math_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc b/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc index 77bddc75442..c41bd438084 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc @@ -23,7 +23,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_mixRgb_cc { static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b) { @@ -34,8 +34,6 @@ static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b) b.add_output<decl::Color>(N_("Color")); }; -} // namespace blender::nodes - static void node_shader_exec_mix_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, @@ -183,16 +181,20 @@ static void sh_node_mix_rgb_build_multi_function(blender::nodes::NodeMultiFuncti builder.construct_and_set_matching_fn<MixRGBFunction>(clamp, mix_type); } +} // namespace blender::nodes::node_shader_mixRgb_cc + void register_node_type_sh_mix_rgb() { + namespace file_ns = blender::nodes::node_shader_mixRgb_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); - ntype.declare = blender::nodes::sh_node_mix_rgb_declare; + ntype.declare = file_ns::sh_node_mix_rgb_declare; node_type_label(&ntype, node_blend_label); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_mix_rgb); - node_type_gpu(&ntype, gpu_shader_mix_rgb); - ntype.build_multi_function = sh_node_mix_rgb_build_multi_function; + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_mix_rgb); + node_type_gpu(&ntype, file_ns::gpu_shader_mix_rgb); + ntype.build_multi_function = file_ns::sh_node_mix_rgb_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc index ee27a4150a1..d9cdd43490a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_mix_shader_cc { + static bNodeSocketTemplate sh_node_mix_shader_in[] = { {SOCK_FLOAT, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, {SOCK_SHADER, N_("Shader")}, @@ -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() { + 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_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, node_shader_gpu_mix_shader); + node_type_gpu(&ntype, file_ns::node_shader_gpu_mix_shader); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc index 6aad5cb88f2..3f8e2e7fc26 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** NORMAL ******************** */ + +namespace blender::nodes::node_shader_normal_cc { + static bNodeSocketTemplate sh_node_normal_in[] = { {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, {-1, ""}, @@ -64,14 +67,18 @@ static int gpu_shader_normal(GPUMaterial *mat, return GPU_stack_link(mat, node, "normal_new_shading", in, out, vec); } +} // namespace blender::nodes::node_shader_normal_cc + void register_node_type_sh_normal() { + namespace file_ns = blender::nodes::node_shader_normal_cc; + static bNodeType ntype; 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, nullptr, nullptr, node_shader_exec_normal); - node_type_gpu(&ntype, gpu_shader_normal); + node_type_socket_templates(&ntype, file_ns::sh_node_normal_in, file_ns::sh_node_normal_out); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_normal); + node_type_gpu(&ntype, file_ns::gpu_shader_normal); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc index 09ff6d716ab..ec77fcfeefe 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_normal_map_cc { + static bNodeSocketTemplate sh_node_normal_map_in[] = { {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f}, @@ -115,19 +117,24 @@ static int gpu_shader_normal_map(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_normal_map_cc + /* node type definition */ void register_node_type_sh_normal_map() { + namespace file_ns = blender::nodes::node_shader_normal_map_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, 0); - node_type_socket_templates(&ntype, sh_node_normal_map_in, sh_node_normal_map_out); + node_type_socket_templates( + &ntype, file_ns::sh_node_normal_map_in, file_ns::sh_node_normal_map_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, node_shader_init_normal_map); + node_type_init(&ntype, file_ns::node_shader_init_normal_map); 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, nullptr, nullptr, node_shader_exec_normal_map); + node_type_gpu(&ntype, file_ns::gpu_shader_normal_map); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_normal_map); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.cc b/source/blender/nodes/shader/nodes/node_shader_object_info.cc index 42b163bfaa2..928756284ab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_object_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_object_info.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_object_info_cc { + static bNodeSocketTemplate sh_node_object_info_out[] = { {SOCK_VECTOR, N_("Location"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -49,13 +51,17 @@ static int node_shader_gpu_object_info(GPUMaterial *mat, GPU_constant(&index)); } +} // namespace blender::nodes::node_shader_object_info_cc + void register_node_type_sh_object_info() { + namespace file_ns = blender::nodes::node_shader_object_info_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_object_info_out); - node_type_gpu(&ntype, node_shader_gpu_object_info); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_object_info_out); + node_type_gpu(&ntype, file_ns::node_shader_gpu_object_info); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc index 3e6fadf58c0..363d8da3f92 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc @@ -23,6 +23,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_output_aov_cc { + static bNodeSocketTemplate sh_node_output_aov_in[] = { {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -53,17 +55,21 @@ static int node_shader_gpu_output_aov(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_output_aov_cc + /* node type definition */ void register_node_type_sh_output_aov() { + namespace file_ns = blender::nodes::node_shader_output_aov_cc; + 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, nullptr); - node_type_init(&ntype, node_shader_init_output_aov); + node_type_socket_templates(&ntype, file_ns::sh_node_output_aov_in, nullptr); + node_type_init(&ntype, file_ns::node_shader_init_output_aov); node_type_storage( &ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_output_aov); + node_type_gpu(&ntype, file_ns::node_shader_gpu_output_aov); ntype.no_muting = true; diff --git a/source/blender/nodes/shader/nodes/node_shader_output_light.cc b/source/blender/nodes/shader/nodes/node_shader_output_light.cc index 3d2f65aa311..00518271672 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc @@ -21,18 +21,24 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_output_light_cc { + static bNodeSocketTemplate sh_node_output_light_in[] = { {SOCK_SHADER, N_("Surface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}, }; +} // namespace blender::nodes::node_shader_output_light_cc + /* node type definition */ void register_node_type_sh_output_light() { + namespace file_ns = blender::nodes::node_shader_output_light_cc; + 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, nullptr); + node_type_socket_templates(&ntype, file_ns::sh_node_output_light_in, nullptr); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc index 9dbdb2e6749..3c39ff8e2c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_output_linestyle_cc { + static bNodeSocketTemplate sh_node_output_linestyle_in[] = { {SOCK_RGBA, N_("Color"), 1.0f, 0.0f, 1.0f, 1.0f}, {SOCK_FLOAT, N_("Color Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, @@ -29,13 +31,17 @@ static bNodeSocketTemplate sh_node_output_linestyle_in[] = { {-1, ""}, }; +} // namespace blender::nodes::node_shader_output_linestyle_cc + /* node type definition */ void register_node_type_sh_output_linestyle() { + namespace file_ns = blender::nodes::node_shader_output_linestyle_cc; + 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, nullptr); + node_type_socket_templates(&ntype, file_ns::sh_node_output_linestyle_in, nullptr); node_type_init(&ntype, nullptr); ntype.no_muting = true; diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.cc b/source/blender/nodes/shader/nodes/node_shader_output_material.cc index aa9a325ae66..c111115f108 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc @@ -23,6 +23,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_output_material_cc { + static bNodeSocketTemplate sh_node_output_material_in[] = { {SOCK_SHADER, N_("Surface")}, {SOCK_SHADER, N_("Volume")}, @@ -73,16 +75,20 @@ static int node_shader_gpu_output_material(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_output_material_cc + /* node type definition */ void register_node_type_sh_output_material() { + namespace file_ns = blender::nodes::node_shader_output_material_cc; + 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, nullptr); + node_type_socket_templates(&ntype, file_ns::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); + node_type_gpu(&ntype, file_ns::node_shader_gpu_output_material); ntype.no_muting = true; diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.cc b/source/blender/nodes/shader/nodes/node_shader_output_world.cc index 07b32a4ac96..545342ccaa5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_output_world_cc { + static bNodeSocketTemplate sh_node_output_world_in[] = { {SOCK_SHADER, N_("Surface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_SHADER, N_("Volume"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -41,16 +43,20 @@ static int node_shader_gpu_output_world(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_output_world_cc + /* node type definition */ void register_node_type_sh_output_world() { + namespace file_ns = blender::nodes::node_shader_output_world_cc; + 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, nullptr); + node_type_socket_templates(&ntype, file_ns::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); + node_type_gpu(&ntype, file_ns::node_shader_gpu_output_world); ntype.no_muting = true; diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc index 4aa1b5130eb..0f71eebc050 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc @@ -21,6 +21,8 @@ #include "node_shader_util.hh" +namespace blender::nodes::node_shader_particle_info_cc { + static bNodeSocketTemplate outputs[] = { {SOCK_FLOAT, "Index"}, {SOCK_FLOAT, "Random"}, @@ -62,15 +64,19 @@ static int gpu_shader_particle_info(GPUMaterial *mat, GPU_builtin(GPU_PARTICLE_ANG_VELOCITY)); } +} // namespace blender::nodes::node_shader_particle_info_cc + /* node type definition */ void register_node_type_sh_particle_info() { + namespace file_ns = blender::nodes::node_shader_particle_info_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT, 0); - 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); + node_type_socket_templates(&ntype, nullptr, file_ns::outputs); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_particle_info); + node_type_gpu(&ntype, file_ns::gpu_shader_particle_info); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_rgb.cc index 2ae4e13decc..65dfba604af 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_rgb.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** RGB ******************** */ + +namespace blender::nodes::node_shader_rgb_cc { + static bNodeSocketTemplate sh_node_rgb_out[] = { {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f}, {-1, ""}, @@ -39,13 +42,17 @@ static int gpu_shader_rgb(GPUMaterial *mat, return GPU_stack_link(mat, node, "set_rgba", in, out, link); } +} // namespace blender::nodes::node_shader_rgb_cc + void register_node_type_sh_rgb() { + namespace file_ns = blender::nodes::node_shader_rgb_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_rgb_out); - node_type_gpu(&ntype, gpu_shader_rgb); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_rgb_out); + node_type_gpu(&ntype, file_ns::gpu_shader_rgb); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc index 09123d627c0..7dbf2449832 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.cc +++ b/source/blender/nodes/shader/nodes/node_shader_script.cc @@ -25,6 +25,8 @@ /* **************** Script ******************** */ +namespace blender::nodes::node_shader_script_cc { + static void init(bNodeTree *UNUSED(ntree), bNode *node) { NodeShaderScript *nss = (NodeShaderScript *)MEM_callocN(sizeof(NodeShaderScript), @@ -59,13 +61,18 @@ static void node_copy_script(bNodeTree *UNUSED(dest_ntree), dest_node->storage = dest_nss; } +} // namespace blender::nodes::node_shader_script_cc + void register_node_type_sh_script() { + namespace file_ns = blender::nodes::node_shader_script_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT, 0); - node_type_init(&ntype, init); - node_type_storage(&ntype, "NodeShaderScript", node_free_script, node_copy_script); + node_type_init(&ntype, file_ns::init); + node_type_storage( + &ntype, "NodeShaderScript", file_ns::node_free_script, file_ns::node_copy_script); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.cc b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.cc index 8e496d1bc15..b47c98fadec 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombHSV.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** SEPARATE HSV ******************** */ + +namespace blender::nodes::node_shader_sepcombHSV_cc { + static bNodeSocketTemplate sh_node_sephsv_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, {-1, ""}, @@ -57,19 +60,8 @@ static int gpu_shader_sephsv(GPUMaterial *mat, return GPU_stack_link(mat, node, "separate_hsv", in, out); } -void register_node_type_sh_sephsv() -{ - static bNodeType ntype; - - 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, nullptr, nullptr, node_shader_exec_sephsv); - node_type_gpu(&ntype, gpu_shader_sephsv); - - nodeRegisterType(&ntype); -} - /* **************** COMBINE HSV ******************** */ + static bNodeSocketTemplate sh_node_combhsv_in[] = { {SOCK_FLOAT, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, {SOCK_FLOAT, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, @@ -105,14 +97,32 @@ static int gpu_shader_combhsv(GPUMaterial *mat, return GPU_stack_link(mat, node, "combine_hsv", in, out); } +} // namespace blender::nodes::node_shader_sepcombHSV_cc + +void register_node_type_sh_sephsv() +{ + namespace file_ns = blender::nodes::node_shader_sepcombHSV_cc; + + static bNodeType ntype; + + sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER, 0); + node_type_socket_templates(&ntype, file_ns::sh_node_sephsv_in, file_ns::sh_node_sephsv_out); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_sephsv); + node_type_gpu(&ntype, file_ns::gpu_shader_sephsv); + + nodeRegisterType(&ntype); +} + void register_node_type_sh_combhsv() { + namespace file_ns = blender::nodes::node_shader_sepcombHSV_cc; + static bNodeType ntype; 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, nullptr, nullptr, node_shader_exec_combhsv); - node_type_gpu(&ntype, gpu_shader_combhsv); + node_type_socket_templates(&ntype, file_ns::sh_node_combhsv_in, file_ns::sh_node_combhsv_out); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combhsv); + node_type_gpu(&ntype, file_ns::gpu_shader_combhsv); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc index fab8f9bfd18..0b8c8ad443d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc @@ -23,7 +23,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_sepcombRGB_cc { static void sh_node_seprgb_declare(NodeDeclarationBuilder &b) { @@ -34,8 +34,6 @@ static void sh_node_seprgb_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("B")); }; -} // namespace blender::nodes - static void node_shader_exec_seprgb(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), @@ -103,21 +101,6 @@ static void sh_node_seprgb_build_multi_function(blender::nodes::NodeMultiFunctio builder.set_matching_fn(fn); } -void register_node_type_sh_seprgb() -{ - static bNodeType ntype; - - sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_seprgb_declare; - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_seprgb); - node_type_gpu(&ntype, gpu_shader_seprgb); - ntype.build_multi_function = sh_node_seprgb_build_multi_function; - - nodeRegisterType(&ntype); -} - -namespace blender::nodes { - static void sh_node_combrgb_declare(NodeDeclarationBuilder &b) { b.is_function_node(); @@ -127,8 +110,6 @@ static void sh_node_combrgb_declare(NodeDeclarationBuilder &b) b.add_output<decl::Color>(N_("Image")); }; -} // namespace blender::nodes - static void node_shader_exec_combrgb(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), @@ -163,15 +144,34 @@ static void sh_node_combrgb_build_multi_function(blender::nodes::NodeMultiFuncti builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_shader_sepcombRGB_cc + +void register_node_type_sh_seprgb() +{ + namespace file_ns = blender::nodes::node_shader_sepcombRGB_cc; + + static bNodeType ntype; + + sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER, 0); + ntype.declare = file_ns::sh_node_seprgb_declare; + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_seprgb); + node_type_gpu(&ntype, file_ns::gpu_shader_seprgb); + ntype.build_multi_function = file_ns::sh_node_seprgb_build_multi_function; + + nodeRegisterType(&ntype); +} + void register_node_type_sh_combrgb() { + namespace file_ns = blender::nodes::node_shader_sepcombRGB_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_combrgb_declare; - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_combrgb); - node_type_gpu(&ntype, gpu_shader_combrgb); - ntype.build_multi_function = sh_node_combrgb_build_multi_function; + ntype.declare = file_ns::sh_node_combrgb_declare; + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combrgb); + node_type_gpu(&ntype, file_ns::gpu_shader_combrgb); + ntype.build_multi_function = file_ns::sh_node_combrgb_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.cc b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.cc index 9101ea68bcf..c5e83789a8e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombXYZ.cc @@ -23,7 +23,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_sepcombXYZ_cc { static void sh_node_sepxyz_declare(NodeDeclarationBuilder &b) { @@ -34,8 +34,6 @@ static void sh_node_sepxyz_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Z")); }; -} // namespace blender::nodes - static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), @@ -88,20 +86,6 @@ static void sh_node_sepxyz_build_multi_function(blender::nodes::NodeMultiFunctio builder.set_matching_fn(separate_fn); } -void register_node_type_sh_sepxyz() -{ - static bNodeType ntype; - - sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_sepxyz_declare; - node_type_gpu(&ntype, gpu_shader_sepxyz); - ntype.build_multi_function = sh_node_sepxyz_build_multi_function; - - nodeRegisterType(&ntype); -} - -namespace blender::nodes { - static void sh_node_combxyz_declare(NodeDeclarationBuilder &b) { b.is_function_node(); @@ -111,8 +95,6 @@ static void sh_node_combxyz_declare(NodeDeclarationBuilder &b) b.add_output<decl::Vector>(N_("Vector")); }; -} // namespace blender::nodes - static int gpu_shader_combxyz(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), @@ -129,14 +111,32 @@ static void sh_node_combxyz_build_multi_function(blender::nodes::NodeMultiFuncti builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_shader_sepcombXYZ_cc + +void register_node_type_sh_sepxyz() +{ + namespace file_ns = blender::nodes::node_shader_sepcombXYZ_cc; + + static bNodeType ntype; + + sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER, 0); + ntype.declare = file_ns::sh_node_sepxyz_declare; + node_type_gpu(&ntype, file_ns::gpu_shader_sepxyz); + ntype.build_multi_function = file_ns::sh_node_sepxyz_build_multi_function; + + nodeRegisterType(&ntype); +} + void register_node_type_sh_combxyz() { + namespace file_ns = blender::nodes::node_shader_sepcombXYZ_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_combxyz_declare; - node_type_gpu(&ntype, gpu_shader_combxyz); - ntype.build_multi_function = sh_node_combxyz_build_multi_function; + ntype.declare = file_ns::sh_node_combxyz_declare; + node_type_gpu(&ntype, file_ns::gpu_shader_combxyz); + ntype.build_multi_function = file_ns::sh_node_combxyz_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.cc b/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.cc index aa224938927..69b1099a76a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_shaderToRgb.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_shaderToRgb_cc { + static bNodeSocketTemplate sh_node_shadertorgb_in[] = { {SOCK_SHADER, N_("Shader")}, {-1, ""}, @@ -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_shaderToRgb_cc + /* node type definition */ void register_node_type_sh_shadertorgb() { + namespace file_ns = blender::nodes::node_shader_shaderToRgb_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_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, node_shader_gpu_shadertorgb); + node_type_gpu(&ntype, file_ns::node_shader_gpu_shadertorgb); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index fd96cc1d48f..55c25ffbdb7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** VALUE SQUEEZE ******************** */ + +namespace blender::nodes::node_shader_squeeze_cc { + static bNodeSocketTemplate sh_node_squeeze_in[] = { {SOCK_FLOAT, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, {SOCK_FLOAT, N_("Width"), 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, @@ -57,15 +60,19 @@ static int gpu_shader_squeeze(GPUMaterial *mat, return GPU_stack_link(mat, node, "squeeze", in, out); } +} // namespace blender::nodes::node_shader_squeeze_cc + void register_node_type_sh_squeeze() { + namespace file_ns = blender::nodes::node_shader_squeeze_cc; + static bNodeType ntype; 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_socket_templates(&ntype, file_ns::sh_node_squeeze_in, file_ns::sh_node_squeeze_out); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_squeeze); - node_type_gpu(&ntype, gpu_shader_squeeze); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_squeeze); + node_type_gpu(&ntype, file_ns::gpu_shader_squeeze); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc index 37fe669004f..017ef71754b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_subsurface_scattering_cc { + static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -78,20 +80,25 @@ static void node_shader_update_subsurface_scattering(bNodeTree *ntree, bNode *no } } +} // namespace blender::nodes::node_shader_subsurface_scattering_cc + /* node type definition */ 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_init(&ntype, file_ns::node_shader_init_subsurface_scattering); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_subsurface_scattering); - node_type_update(&ntype, node_shader_update_subsurface_scattering); + 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_tangent.cc b/source/blender/nodes/shader/nodes/node_shader_tangent.cc index ae50d64ca00..90148c5bf4c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tangent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tangent.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_tangent_cc { + static bNodeSocketTemplate sh_node_tangent_out[] = { {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}, @@ -69,16 +71,20 @@ static int node_shader_gpu_tangent(GPUMaterial *mat, GPU_builtin(GPU_OBJECT_MATRIX)); } +} // namespace blender::nodes::node_shader_tangent_cc + /* node type definition */ void register_node_type_sh_tangent() { + namespace file_ns = blender::nodes::node_shader_tangent_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_tangent_out); + node_type_socket_templates(&ntype, nullptr, file_ns::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); + node_type_init(&ntype, file_ns::node_shader_init_tangent); + node_type_gpu(&ntype, file_ns::node_shader_gpu_tangent); node_type_storage( &ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc index 16394c36619..14f0b71b957 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -22,7 +22,7 @@ #include "BLI_float2.hh" #include "BLI_float4.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_brick_cc { static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b) { @@ -57,8 +57,6 @@ static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")); }; -} // namespace blender::nodes - static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexBrick *tex = (NodeTexBrick *)MEM_callocN(sizeof(NodeTexBrick), "NodeTexBrick"); @@ -101,8 +99,6 @@ static int node_shader_gpu_tex_brick(GPUMaterial *mat, GPU_constant(&squash_freq)); } -namespace blender::nodes { - class BrickFunction : public fn::MultiFunction { private: const float offset_; @@ -266,20 +262,22 @@ static void sh_node_brick_build_multi_function(blender::nodes::NodeMultiFunction tex->offset, tex->offset_freq, tex->squash, tex->squash_freq); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_brick_cc void register_node_type_sh_tex_brick() { + namespace file_ns = blender::nodes::node_shader_tex_brick_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_brick_declare; + ntype.declare = file_ns::sh_node_tex_brick_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, node_shader_init_tex_brick); + node_type_init(&ntype, file_ns::node_shader_init_tex_brick); node_type_storage( &ntype, "NodeTexBrick", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_brick); - ntype.build_multi_function = blender::nodes::sh_node_brick_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_brick); + ntype.build_multi_function = file_ns::sh_node_brick_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc index 1d97d5e41a4..714fdc129e5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -19,7 +19,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_checker_cc { static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b) { @@ -36,8 +36,6 @@ static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")); }; -} // namespace blender::nodes - static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexChecker *tex = (NodeTexChecker *)MEM_callocN(sizeof(NodeTexChecker), "NodeTexChecker"); @@ -59,8 +57,6 @@ static int node_shader_gpu_tex_checker(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_tex_checker", in, out); } -namespace blender::nodes { - class NodeTexChecker : public fn::MultiFunction { public: NodeTexChecker() @@ -121,19 +117,21 @@ static void sh_node_tex_checker_build_multi_function( builder.set_matching_fn(fn); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_checker_cc void register_node_type_sh_tex_checker() { + namespace file_ns = blender::nodes::node_shader_tex_checker_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_checker_declare; - node_type_init(&ntype, node_shader_init_tex_checker); + ntype.declare = file_ns::sh_node_tex_checker_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_checker); node_type_storage( &ntype, "NodeTexChecker", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_checker); - ntype.build_multi_function = blender::nodes::sh_node_tex_checker_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_checker); + ntype.build_multi_function = file_ns::sh_node_tex_checker_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc index 63f0e9fc757..50411f10aed 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc @@ -23,6 +23,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_tex_coord_cc { + static bNodeSocketTemplate sh_node_tex_coord_out[] = { {SOCK_VECTOR, N_("Generated"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -83,16 +85,20 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, return 1; } +} // namespace blender::nodes::node_shader_tex_coord_cc + /* node type definition */ void register_node_type_sh_tex_coord() { + namespace file_ns = blender::nodes::node_shader_tex_coord_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_tex_coord_out); + node_type_socket_templates(&ntype, nullptr, file_ns::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); + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc index c53d93eed69..936d3a3011a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_tex_environment_cc { + static bNodeSocketTemplate sh_node_tex_environment_in[] = { {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, {-1, ""}, @@ -133,17 +135,22 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_tex_environment_cc + /* node type definition */ void register_node_type_sh_tex_environment() { + namespace file_ns = blender::nodes::node_shader_tex_environment_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE, 0); - node_type_socket_templates(&ntype, sh_node_tex_environment_in, sh_node_tex_environment_out); - node_type_init(&ntype, node_shader_init_tex_environment); + node_type_socket_templates( + &ntype, file_ns::sh_node_tex_environment_in, file_ns::sh_node_tex_environment_out); + node_type_init(&ntype, file_ns::node_shader_init_tex_environment); node_type_storage( &ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_environment); + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_environment); node_type_label(&ntype, node_image_label); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc index bcc6f49e042..c6094409206 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -19,7 +19,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_gradient_cc { static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b) { @@ -29,8 +29,6 @@ static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")).no_muted_links(); }; -} // namespace blender::nodes - static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexGradient *tex = (NodeTexGradient *)MEM_callocN(sizeof(NodeTexGradient), @@ -56,8 +54,6 @@ static int node_shader_gpu_tex_gradient(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_tex_gradient", in, out, GPU_constant(&gradient_type)); } -namespace blender::nodes { - class GradientFunction : public fn::MultiFunction { private: int gradient_type_; @@ -158,19 +154,21 @@ static void sh_node_gradient_tex_build_multi_function( builder.construct_and_set_matching_fn<GradientFunction>(tex->gradient_type); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_gradient_cc void register_node_type_sh_tex_gradient() { + namespace file_ns = blender::nodes::node_shader_tex_gradient_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_gradient_declare; - node_type_init(&ntype, node_shader_init_tex_gradient); + ntype.declare = file_ns::sh_node_tex_gradient_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_gradient); node_type_storage( &ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_gradient); - ntype.build_multi_function = blender::nodes::sh_node_gradient_tex_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_gradient); + ntype.build_multi_function = file_ns::sh_node_gradient_tex_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc index b89a4f674e0..fd20c556d00 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc @@ -19,7 +19,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_image_cc { static void sh_node_tex_image_declare(NodeDeclarationBuilder &b) { @@ -29,8 +29,6 @@ static void sh_node_tex_image_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Alpha")).no_muted_links(); }; -}; // namespace blender::nodes - static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexImage *tex = (NodeTexImage *)MEM_callocN(sizeof(NodeTexImage), "NodeTexImage"); @@ -173,17 +171,21 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_tex_image_cc + /* node type definition */ void register_node_type_sh_tex_image() { + namespace file_ns = blender::nodes::node_shader_tex_image_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_image_declare; - node_type_init(&ntype, node_shader_init_tex_image); + ntype.declare = file_ns::sh_node_tex_image_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_image); node_type_storage( &ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_image); + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_image); node_type_label(&ntype, node_image_label); node_type_size_preset(&ntype, NODE_SIZE_LARGE); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc index fe1454b853e..9b19dc2907b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -19,7 +19,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_magic_cc { static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b) { @@ -31,8 +31,6 @@ static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")).no_muted_links(); }; -} // namespace blender::nodes - static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexMagic *tex = (NodeTexMagic *)MEM_callocN(sizeof(NodeTexMagic), "NodeTexMagic"); @@ -58,8 +56,6 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_tex_magic", in, out, GPU_constant(&depth)); } -namespace blender::nodes { - class MagicFunction : public fn::MultiFunction { private: int depth_; @@ -179,19 +175,21 @@ static void sh_node_magic_tex_build_multi_function( builder.construct_and_set_matching_fn<MagicFunction>(tex->depth); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_magic_cc void register_node_type_sh_tex_magic() { + namespace file_ns = blender::nodes::node_shader_tex_magic_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_magic_declare; - node_type_init(&ntype, node_shader_init_tex_magic); + ntype.declare = file_ns::sh_node_tex_magic_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_magic); node_type_storage( &ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_magic); - ntype.build_multi_function = blender::nodes::sh_node_magic_tex_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_magic); + ntype.build_multi_function = file_ns::sh_node_magic_tex_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc index bb2790dfa42..70c78f75736 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -21,7 +21,7 @@ #include "BLI_noise.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_musgrave_cc { static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) { @@ -37,8 +37,6 @@ static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")).no_muted_links(); }; -} // namespace blender::nodes - static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexMusgrave *tex = (NodeTexMusgrave *)MEM_callocN(sizeof(NodeTexMusgrave), @@ -128,8 +126,6 @@ static void node_shader_update_tex_musgrave(bNodeTree *ntree, bNode *node) node_sock_label(outFacSock, "Height"); } -namespace blender::nodes { - class MusgraveFunction : public fn::MultiFunction { private: const int dimensions_; @@ -529,21 +525,23 @@ static void sh_node_musgrave_build_multi_function( builder.construct_and_set_matching_fn<MusgraveFunction>(tex->dimensions, tex->musgrave_type); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_musgrave_cc void register_node_type_sh_tex_musgrave() { + namespace file_ns = blender::nodes::node_shader_tex_musgrave_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_musgrave_declare; + ntype.declare = file_ns::sh_node_tex_musgrave_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, node_shader_init_tex_musgrave); + node_type_init(&ntype, file_ns::node_shader_init_tex_musgrave); node_type_storage( &ntype, "NodeTexMusgrave", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_musgrave); - node_type_update(&ntype, node_shader_update_tex_musgrave); - ntype.build_multi_function = blender::nodes::sh_node_musgrave_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_musgrave); + node_type_update(&ntype, file_ns::node_shader_update_tex_musgrave); + ntype.build_multi_function = file_ns::sh_node_musgrave_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc index 73bd7d232f5..13537be2249 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -21,7 +21,7 @@ #include "BLI_noise.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_noise_cc { static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) { @@ -40,8 +40,6 @@ static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) b.add_output<decl::Color>(N_("Color")).no_muted_links(); }; -} // namespace blender::nodes - static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexNoise *tex = (NodeTexNoise *)MEM_callocN(sizeof(NodeTexNoise), "NodeTexNoise"); @@ -86,8 +84,6 @@ static void node_shader_update_tex_noise(bNodeTree *ntree, bNode *node) nodeSetSocketAvailability(ntree, sockW, tex->dimensions == 1 || tex->dimensions == 4); } -namespace blender::nodes { - class NoiseFunction : public fn::MultiFunction { private: int dimensions_; @@ -246,21 +242,23 @@ static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunction builder.construct_and_set_matching_fn<NoiseFunction>(tex->dimensions); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_noise_cc /* node type definition */ void register_node_type_sh_tex_noise() { + namespace file_ns = blender::nodes::node_shader_tex_noise_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_noise_declare; - node_type_init(&ntype, node_shader_init_tex_noise); + ntype.declare = file_ns::sh_node_tex_noise_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_noise); node_type_storage( &ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_noise); - node_type_update(&ntype, node_shader_update_tex_noise); - ntype.build_multi_function = blender::nodes::sh_node_noise_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_noise); + node_type_update(&ntype, file_ns::node_shader_update_tex_noise); + ntype.build_multi_function = file_ns::sh_node_noise_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc index 84ace833255..73812da029c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc @@ -23,6 +23,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_tex_pointdensity_cc { + static bNodeSocketTemplate sh_node_tex_pointdensity_in[] = { {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, {-1, ""}, @@ -65,18 +67,23 @@ static void node_shader_copy_tex_pointdensity(bNodeTree *UNUSED(dest_ntree), memset(pd, 0, sizeof(*pd)); } +} // namespace blender::nodes::node_shader_tex_pointdensity_cc + /* node type definition */ void register_node_type_sh_tex_pointdensity() { + namespace file_ns = blender::nodes::node_shader_tex_pointdensity_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE, 0); - node_type_socket_templates(&ntype, sh_node_tex_pointdensity_in, sh_node_tex_pointdensity_out); - node_type_init(&ntype, node_shader_init_tex_pointdensity); + node_type_socket_templates( + &ntype, file_ns::sh_node_tex_pointdensity_in, file_ns::sh_node_tex_pointdensity_out); + node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity); node_type_storage(&ntype, "NodeShaderTexPointDensity", - node_shader_free_tex_pointdensity, - node_shader_copy_tex_pointdensity); + file_ns::node_shader_free_tex_pointdensity, + file_ns::node_shader_copy_tex_pointdensity); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc index a42044a7427..2ee271b5d24 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc @@ -22,6 +22,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_tex_sky_cc { + static bNodeSocketTemplate sh_node_tex_sky_in[] = { {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, {-1, ""}, @@ -203,19 +205,23 @@ static void node_shader_update_sky(bNodeTree *ntree, bNode *node) nodeSetSocketAvailability(ntree, sockVector, !(tex->sky_model == 2 && tex->sun_disc == 1)); } +} // namespace blender::nodes::node_shader_tex_sky_cc + /* node type definition */ void register_node_type_sh_tex_sky() { + namespace file_ns = blender::nodes::node_shader_tex_sky_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE, 0); - node_type_socket_templates(&ntype, sh_node_tex_sky_in, sh_node_tex_sky_out); + node_type_socket_templates(&ntype, file_ns::sh_node_tex_sky_in, file_ns::sh_node_tex_sky_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, node_shader_init_tex_sky); + node_type_init(&ntype, file_ns::node_shader_init_tex_sky); node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_sky); + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_sky); /* remove Vector input for Nishita */ - node_type_update(&ntype, node_shader_update_sky); + node_type_update(&ntype, file_ns::node_shader_update_sky); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc index d8d963a6d1f..a1e54749b71 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -21,7 +21,7 @@ #include "BLI_noise.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_voronoi_cc { static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) { @@ -47,8 +47,6 @@ static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Radius")).no_muted_links(); }; -} // namespace blender::nodes - static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexVoronoi *tex = (NodeTexVoronoi *)MEM_callocN(sizeof(NodeTexVoronoi), "NodeTexVoronoi"); @@ -165,8 +163,6 @@ static void node_shader_update_tex_voronoi(bNodeTree *ntree, bNode *node) nodeSetSocketAvailability(ntree, outRadiusSock, tex->feature == SHD_VORONOI_N_SPHERE_RADIUS); } -namespace blender::nodes { - static MultiFunction::ExecutionHints voronoi_execution_hints{50, false}; class VoronoiMinowskiFunction : public fn::MultiFunction { @@ -1321,20 +1317,22 @@ static void sh_node_voronoi_build_multi_function(blender::nodes::NodeMultiFuncti } } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_voronoi_cc void register_node_type_sh_tex_voronoi() { + namespace file_ns = blender::nodes::node_shader_tex_voronoi_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_voronoi_declare; - node_type_init(&ntype, node_shader_init_tex_voronoi); + ntype.declare = file_ns::sh_node_tex_voronoi_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_voronoi); node_type_storage( &ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_voronoi); - node_type_update(&ntype, node_shader_update_tex_voronoi); - ntype.build_multi_function = blender::nodes::sh_node_voronoi_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_voronoi); + node_type_update(&ntype, file_ns::node_shader_update_tex_voronoi); + ntype.build_multi_function = file_ns::sh_node_voronoi_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc index d1768b4b500..bcb3091c1ce 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -21,7 +21,7 @@ #include "BLI_noise.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_wave_cc { static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b) { @@ -41,8 +41,6 @@ static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")).no_muted_links(); }; -} // namespace blender::nodes - static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexWave *tex = (NodeTexWave *)MEM_callocN(sizeof(NodeTexWave), "NodeTexWave"); @@ -81,8 +79,6 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat, GPU_constant(&wave_profile)); } -namespace blender::nodes { - class WaveFunction : public fn::MultiFunction { private: int wave_type_; @@ -216,19 +212,21 @@ static void sh_node_wave_tex_build_multi_function( tex->wave_type, tex->bands_direction, tex->rings_direction, tex->wave_profile); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_wave_cc void register_node_type_sh_tex_wave() { + namespace file_ns = blender::nodes::node_shader_tex_wave_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_wave_declare; + ntype.declare = file_ns::sh_node_tex_wave_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, node_shader_init_tex_wave); + node_type_init(&ntype, file_ns::node_shader_init_tex_wave); node_type_storage(&ntype, "NodeTexWave", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_tex_wave); - ntype.build_multi_function = blender::nodes::sh_node_wave_tex_build_multi_function; + node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_wave); + ntype.build_multi_function = file_ns::sh_node_wave_tex_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc index 6629591e5e0..5ea82991c25 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc @@ -21,7 +21,7 @@ #include "BLI_noise.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_tex_white_noise_cc { static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b) { @@ -32,8 +32,6 @@ static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b) b.add_output<decl::Color>(N_("Color")); }; -} // namespace blender::nodes - static void node_shader_init_tex_white_noise(bNodeTree *UNUSED(ntree), bNode *node) { node->custom1 = 3; @@ -67,8 +65,6 @@ static void node_shader_update_tex_white_noise(bNodeTree *ntree, bNode *node) nodeSetSocketAvailability(ntree, sockW, node->custom1 == 1 || node->custom1 == 4); } -namespace blender::nodes { - class WhiteNoiseFunction : public fn::MultiFunction { private: int dimensions_; @@ -189,19 +185,21 @@ static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunction builder.construct_and_set_matching_fn<WhiteNoiseFunction>((int)node.custom1); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_tex_white_noise_cc void register_node_type_sh_tex_white_noise() { + namespace file_ns = blender::nodes::node_shader_tex_white_noise_cc; + static bNodeType ntype; sh_fn_node_type_base( &ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE, 0); - ntype.declare = blender::nodes::sh_node_tex_white_noise_declare; - node_type_init(&ntype, node_shader_init_tex_white_noise); - node_type_gpu(&ntype, gpu_shader_tex_white_noise); - node_type_update(&ntype, node_shader_update_tex_white_noise); - ntype.build_multi_function = blender::nodes::sh_node_noise_build_multi_function; + ntype.declare = file_ns::sh_node_tex_white_noise_declare; + node_type_init(&ntype, file_ns::node_shader_init_tex_white_noise); + node_type_gpu(&ntype, file_ns::gpu_shader_tex_white_noise); + node_type_update(&ntype, file_ns::node_shader_update_tex_white_noise); + ntype.build_multi_function = file_ns::sh_node_noise_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.cc b/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.cc index 275cb9a0966..cdcb5f34bb9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uvAlongStroke.cc @@ -21,18 +21,24 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_uvAlongStroke_cc { + static bNodeSocketTemplate sh_node_uvalongstroke_out[] = { {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}, }; +} // namespace blender::nodes::node_shader_uvAlongStroke_cc + /* node type definition */ void register_node_type_sh_uvalongstroke() { + namespace file_ns = blender::nodes::node_shader_uvAlongStroke_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_uvalongstroke_out); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_uvalongstroke_out); node_type_init(&ntype, nullptr); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc index c807e792423..12feb9c7d09 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc @@ -23,6 +23,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_uvmap_cc { + static bNodeSocketTemplate sh_node_uvmap_out[] = { {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}, @@ -51,18 +53,22 @@ static int node_shader_gpu_uvmap(GPUMaterial *mat, return 1; } +} // namespace blender::nodes::node_shader_uvmap_cc + /* node type definition */ void register_node_type_sh_uvmap() { + namespace file_ns = blender::nodes::node_shader_uvmap_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_uvmap_out); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_uvmap_out); node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); - node_type_init(&ntype, node_shader_init_uvmap); + node_type_init(&ntype, file_ns::node_shader_init_uvmap); node_type_storage( &ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_uvmap); + node_type_gpu(&ntype, file_ns::node_shader_gpu_uvmap); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc b/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc index 4c2b637a6cb..b65269f8e35 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc @@ -29,7 +29,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_valToRgb_cc { static void sh_node_valtorgb_declare(NodeDeclarationBuilder &b) { @@ -39,8 +39,6 @@ static void sh_node_valtorgb_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Alpha")); }; -} // namespace blender::nodes - static void node_shader_exec_valtorgb(void *UNUSED(data), int UNUSED(thread), bNode *node, @@ -172,32 +170,12 @@ static void sh_node_valtorgb_build_multi_function( builder.construct_and_set_matching_fn<ColorBandFunction>(*color_band); } -void register_node_type_sh_valtorgb() -{ - static bNodeType ntype; - - sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_valtorgb_declare; - node_type_init(&ntype, node_shader_init_valtorgb); - node_type_size_preset(&ntype, NODE_SIZE_LARGE); - node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_valtorgb); - node_type_gpu(&ntype, gpu_shader_valtorgb); - ntype.build_multi_function = sh_node_valtorgb_build_multi_function; - - nodeRegisterType(&ntype); -} - -namespace blender::nodes { - static void sh_node_rgbtobw_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); b.add_output<decl::Float>(N_("Val")); }; -} // namespace blender::nodes - static void node_shader_exec_rgbtobw(void *UNUSED(data), int UNUSED(thread), bNode *UNUSED(node), @@ -222,14 +200,36 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat, return GPU_stack_link(mat, node, "rgbtobw", in, out); } +} // namespace blender::nodes::node_shader_valToRgb_cc + +void register_node_type_sh_valtorgb() +{ + namespace file_ns = blender::nodes::node_shader_valToRgb_cc; + + static bNodeType ntype; + + sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0); + ntype.declare = file_ns::sh_node_valtorgb_declare; + node_type_init(&ntype, file_ns::node_shader_init_valtorgb); + node_type_size_preset(&ntype, NODE_SIZE_LARGE); + node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_valtorgb); + node_type_gpu(&ntype, file_ns::gpu_shader_valtorgb); + ntype.build_multi_function = file_ns::sh_node_valtorgb_build_multi_function; + + nodeRegisterType(&ntype); +} + void register_node_type_sh_rgbtobw() { + namespace file_ns = blender::nodes::node_shader_valToRgb_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0); - ntype.declare = blender::nodes::sh_node_rgbtobw_declare; - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_rgbtobw); - node_type_gpu(&ntype, gpu_shader_rgbtobw); + ntype.declare = file_ns::sh_node_rgbtobw_declare; + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_rgbtobw); + node_type_gpu(&ntype, file_ns::gpu_shader_rgbtobw); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index 19e5ba61e04..9ff523f42f7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.cc +++ b/source/blender/nodes/shader/nodes/node_shader_value.cc @@ -23,15 +23,13 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_value_cc { static void sh_node_value_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Float>(N_("Value")); }; -} // namespace blender::nodes - static int gpu_shader_value(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), @@ -49,14 +47,18 @@ static void sh_node_value_build_multi_function(blender::nodes::NodeMultiFunction builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<float>>(value->value); } +} // namespace blender::nodes::node_shader_value_cc + void register_node_type_sh_value() { + namespace file_ns = blender::nodes::node_shader_value_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); - ntype.declare = blender::nodes::sh_node_value_declare; - node_type_gpu(&ntype, gpu_shader_value); - ntype.build_multi_function = sh_node_value_build_multi_function; + ntype.declare = file_ns::sh_node_value_declare; + node_type_gpu(&ntype, file_ns::gpu_shader_value); + ntype.build_multi_function = file_ns::sh_node_value_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_vectTransform.cc b/source/blender/nodes/shader/nodes/node_shader_vectTransform.cc index 8947f5cf8b9..bfaca357c5c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectTransform.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vectTransform.cc @@ -24,6 +24,9 @@ #include "node_shader_util.hh" /* **************** Vector Transform ******************** */ + +namespace blender::nodes::node_shader_vectTransform_cc { + static bNodeSocketTemplate sh_node_vect_transform_in[] = { {SOCK_VECTOR, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, {-1, ""}}; @@ -137,17 +140,22 @@ static int gpu_shader_vect_transform(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_vectTransform_cc + void register_node_type_sh_vect_transform() { + namespace file_ns = blender::nodes::node_shader_vectTransform_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR, 0); - node_type_init(&ntype, node_shader_init_vect_transform); - node_type_socket_templates(&ntype, sh_node_vect_transform_in, sh_node_vect_transform_out); + node_type_init(&ntype, file_ns::node_shader_init_vect_transform); + node_type_socket_templates( + &ntype, file_ns::sh_node_vect_transform_in, file_ns::sh_node_vect_transform_out); node_type_storage( &ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage); - node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_vect_transform); - node_type_gpu(&ntype, gpu_shader_vect_transform); + node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_vect_transform); + node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc index 7523108aec0..9683f889134 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_displacement.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_vector_displacement_cc { + static bNodeSocketTemplate sh_node_vector_displacement_in[] = { {SOCK_RGBA, N_("Vector"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE}, {SOCK_FLOAT, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -63,18 +65,22 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_vector_displacement_world", in, out); } +} // namespace blender::nodes::node_shader_vector_displacement_cc + /* node type definition */ void register_node_type_sh_vector_displacement() { + namespace file_ns = blender::nodes::node_shader_vector_displacement_cc; + static bNodeType ntype; sh_node_type_base( &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); + &ntype, file_ns::sh_node_vector_displacement_in, file_ns::sh_node_vector_displacement_out); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_init(&ntype, node_shader_init_vector_displacement); - node_type_gpu(&ntype, gpu_shader_vector_displacement); + node_type_init(&ntype, file_ns::node_shader_init_vector_displacement); + node_type_gpu(&ntype, file_ns::gpu_shader_vector_displacement); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc index 8dc2af22e6b..3a5cbad70dc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc @@ -25,7 +25,7 @@ #include "NOD_math_functions.hh" -namespace blender::nodes { +namespace blender::nodes::node_vector_math_shader_cc { static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) { @@ -38,8 +38,6 @@ static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Value")); }; -} // namespace blender::nodes - static const char *gpu_shader_get_name(int mode) { switch (mode) { @@ -279,16 +277,20 @@ static void sh_node_vector_math_build_multi_function( builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_vector_math_shader_cc + void register_node_type_sh_vect_math() { + namespace file_ns = blender::nodes::node_vector_math_shader_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR, 0); - ntype.declare = blender::nodes::sh_node_vector_math_declare; + ntype.declare = file_ns::sh_node_vector_math_declare; node_type_label(&ntype, node_vector_math_label); - node_type_gpu(&ntype, gpu_shader_vector_math); - node_type_update(&ntype, node_shader_update_vector_math); - ntype.build_multi_function = sh_node_vector_math_build_multi_function; + node_type_gpu(&ntype, file_ns::gpu_shader_vector_math); + node_type_update(&ntype, file_ns::node_shader_update_vector_math); + ntype.build_multi_function = file_ns::sh_node_vector_math_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc index 3b6c3cbe026..108d6d6bc4f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc @@ -23,7 +23,7 @@ #include "node_shader_util.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_vector_rotate_cc { static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b) { @@ -36,8 +36,6 @@ static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b) b.add_output<decl::Vector>(N_("Vector")); }; -} // namespace blender::nodes - static const char *gpu_shader_get_name(int mode) { switch (mode) { @@ -205,15 +203,19 @@ static void node_shader_update_vector_rotate(bNodeTree *ntree, bNode *node) ntree, sock_angle, !ELEM(node->custom1, NODE_VECTOR_ROTATE_TYPE_EULER_XYZ)); } +} // namespace blender::nodes::node_shader_vector_rotate_cc + void register_node_type_sh_vector_rotate() { + namespace file_ns = blender::nodes::node_shader_vector_rotate_cc; + static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR, 0); - ntype.declare = blender::nodes::sh_node_vector_rotate_declare; - node_type_gpu(&ntype, gpu_shader_vector_rotate); - node_type_update(&ntype, node_shader_update_vector_rotate); - ntype.build_multi_function = sh_node_vector_rotate_build_multi_function; + ntype.declare = file_ns::sh_node_vector_rotate_declare; + node_type_gpu(&ntype, file_ns::gpu_shader_vector_rotate); + node_type_update(&ntype, file_ns::node_shader_update_vector_rotate); + ntype.build_multi_function = file_ns::sh_node_vector_rotate_build_multi_function; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc index 72ba9ace7c3..739030d89c7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc @@ -19,6 +19,8 @@ #include "node_shader_util.hh" +namespace blender::nodes::node_shader_vertex_color_cc { + static bNodeSocketTemplate sh_node_vertex_color_out[] = { {SOCK_RGBA, N_("Color")}, {SOCK_FLOAT, N_("Alpha")}, @@ -47,16 +49,20 @@ static int node_shader_gpu_vertex_color(GPUMaterial *mat, return GPU_stack_link(mat, node, "node_vertex_color", in, out, vertexColorLink); } +} // namespace blender::nodes::node_shader_vertex_color_cc + void register_node_type_sh_vertex_color() { + namespace file_ns = blender::nodes::node_shader_vertex_color_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_vertex_color_out); - node_type_init(&ntype, node_shader_init_vertex_color); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_vertex_color_out); + node_type_init(&ntype, file_ns::node_shader_init_vertex_color); node_type_storage( &ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage); - node_type_gpu(&ntype, node_shader_gpu_vertex_color); + node_type_gpu(&ntype, file_ns::node_shader_gpu_vertex_color); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc index 8e348a69e67..f68121ad922 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_volume_absorption_cc { + static bNodeSocketTemplate sh_node_volume_absorption_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -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() { + 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_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, node_shader_gpu_volume_absorption); + node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_absorption); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc index 112aaf4f1b1..dc556809fe6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_info.cc @@ -19,6 +19,8 @@ #include "node_shader_util.hh" +namespace blender::nodes::node_shader_volume_info_cc { + static bNodeSocketTemplate sh_node_volume_info_out[] = { {SOCK_RGBA, N_("Color")}, {SOCK_FLOAT, N_("Density")}, @@ -49,13 +51,17 @@ static int node_shader_gpu_volume_info(GPUMaterial *mat, return true; } +} // namespace blender::nodes::node_shader_volume_info_cc + void register_node_type_sh_volume_info() { + namespace file_ns = blender::nodes::node_shader_volume_info_cc; + static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_INFO, "Volume Info", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, nullptr, sh_node_volume_info_out); - node_type_gpu(&ntype, node_shader_gpu_volume_info); + node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_volume_info_out); + node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_info); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc index 04fd8bfd58d..8bf21a3a711 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_volume_principled_cc { + static bNodeSocketTemplate sh_node_volume_principled_in[] = { {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f}, {SOCK_STRING, N_("Color Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -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() { + 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_init(&ntype, file_ns::node_shader_init_volume_principled); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_volume_principled); + 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.cc b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc index 14f6e6a9eb1..d9c84650abb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.cc @@ -21,6 +21,8 @@ /* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_volume_scatter_cc { + static bNodeSocketTemplate sh_node_volume_scatter_in[] = { {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, @@ -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() { + 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_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, node_shader_gpu_volume_scatter); + node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_scatter); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc index 8a6235c1e6f..8798b1c8e06 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wavelength.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wavelength.cc @@ -20,6 +20,9 @@ #include "node_shader_util.hh" /* **************** Wavelength ******************** */ + +namespace blender::nodes::node_shader_wavelength_cc { + static bNodeSocketTemplate sh_node_wavelength_in[] = { {SOCK_FLOAT, N_("Wavelength"), 500.0f, 0.0f, 0.0f, 0.0f, 380.0f, 780.0f}, {-1, ""}, @@ -57,17 +60,22 @@ static int node_shader_gpu_wavelength(GPUMaterial *mat, GPU_uniform(xyz_to_rgb.b)); } +} // namespace blender::nodes::node_shader_wavelength_cc + /* node type definition */ void register_node_type_sh_wavelength() { + namespace file_ns = blender::nodes::node_shader_wavelength_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_wavelength_in, file_ns::sh_node_wavelength_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_wavelength); + node_type_gpu(&ntype, file_ns::node_shader_gpu_wavelength); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc index 73ca17ab5dc..bd4d3adfde9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc @@ -20,6 +20,9 @@ #include "node_shader_util.hh" /* **************** Wireframe ******************** */ + +namespace blender::nodes::node_shader_wireframe_cc { + static bNodeSocketTemplate sh_node_wireframe_in[] = { {SOCK_FLOAT, N_("Size"), 0.01f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f}, {-1, ""}, @@ -52,16 +55,21 @@ static int node_shader_gpu_wireframe(GPUMaterial *mat, GPU_builtin(GPU_BARYCENTRIC_DIST)); } +} // namespace blender::nodes::node_shader_wireframe_cc + /* node type definition */ void register_node_type_sh_wireframe() { + namespace file_ns = blender::nodes::node_shader_wireframe_cc; + static bNodeType ntype; 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_socket_templates( + &ntype, file_ns::sh_node_wireframe_in, file_ns::sh_node_wireframe_out); node_type_init(&ntype, nullptr); node_type_storage(&ntype, "", nullptr, nullptr); - node_type_gpu(&ntype, node_shader_gpu_wireframe); + node_type_gpu(&ntype, file_ns::node_shader_gpu_wireframe); nodeRegisterType(&ntype); } |