diff options
author | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-28 00:21:31 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-28 00:21:31 +0300 |
commit | d5b72fb06cd0405c4627d22711ab02804093400c (patch) | |
tree | 154c5c402f51baa8591d5f803b849dc0c714302b /source/blender/nodes | |
parent | 336f6f4bbd8eb75c0cc1258e7d9cd367e0983d4d (diff) |
Nodes: Declare shader nodes in individual file namespace
To be used in the future to support unity builds
Diffstat (limited to 'source/blender/nodes')
21 files changed, 231 insertions, 221 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc index 6c3457151e5..172bd333259 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.h" -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 09bbf3d851c..45c1fbdfc8a 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.h" -namespace blender::nodes { +namespace blender::nodes::node_shader_curves_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_curves_cc + void register_node_type_sh_curve_vec() { + namespace file_ns = blender::nodes::node_shader_curves_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_curves_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_curves_cc + void register_node_type_sh_curve_rgb() { + namespace file_ns = blender::nodes::node_shader_curves_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_curves_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_curves_cc + void register_node_type_sh_curve_float() { + namespace file_ns = blender::nodes::node_shader_curves_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_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc index d0eab8d9727..cfad7b6b887 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -31,7 +31,7 @@ NODE_STORAGE_FUNCS(NodeMapRange) -namespace blender::nodes { +namespace blender::nodes::node_shader_map_range_cc { static void sh_node_map_range_declare(NodeDeclarationBuilder &b) { @@ -149,8 +149,6 @@ static void node_map_range_gather_link_searches(GatherLinkSearchOpParams ¶ms } } -} // namespace blender::nodes - static const char *gpu_shader_get_name(int mode, bool use_vector) { if (use_vector) { @@ -205,8 +203,6 @@ static int gpu_shader_map_range(GPUMaterial *mat, return ret; } -namespace blender::nodes { - static inline float clamp_range(const float value, const float min, const float max) { return (min > max) ? std::clamp(value, max, min) : std::clamp(value, min, max); @@ -644,20 +640,22 @@ static void sh_node_map_range_build_multi_function( } } -} // namespace blender::nodes +} // 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, blender::nodes::node_shader_init_map_range); + ntype.declare = file_ns::sh_node_map_range_declare; + node_type_init(&ntype, file_ns::node_shader_init_map_range); node_type_storage( &ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage); - node_type_update(&ntype, blender::nodes::node_shader_update_map_range); - node_type_gpu(&ntype, gpu_shader_map_range); - ntype.build_multi_function = blender::nodes::sh_node_map_range_build_multi_function; - ntype.gather_link_search_ops = blender::nodes::node_map_range_gather_link_searches; + 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; + ntype.gather_link_search_ops = file_ns::node_map_range_gather_link_searches; 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 da237be273f..e683d55edc8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_math.cc @@ -28,7 +28,7 @@ /* **************** SCALAR MATH ******************** */ -namespace blender::nodes { +namespace blender::nodes::node_shader_math_cc { static void sh_node_math_declare(NodeDeclarationBuilder &b) { @@ -57,8 +57,6 @@ static void sh_node_math_gather_link_searches(GatherLinkSearchOpParams ¶ms) } } -} // namespace blender::nodes - static const char *gpu_shader_get_name(int mode) { const blender::nodes::FloatMathOperationInfo *info = @@ -174,17 +172,21 @@ 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; ntype.labelfunc = 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.gather_link_search_ops = blender::nodes::sh_node_math_gather_link_searches; + ntype.build_multi_function = file_ns::sh_node_math_build_multi_function; + ntype.gather_link_search_ops = file_ns::sh_node_math_gather_link_searches; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc index b89e0527eed..abcd5e6412b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc @@ -23,7 +23,7 @@ #include "node_shader_util.h" -namespace blender::nodes { +namespace blender::nodes::node_shader_mix_rgb_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_mix_rgb_cc + void register_node_type_sh_mix_rgb() { + namespace file_ns = blender::nodes::node_shader_mix_rgb_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; ntype.labelfunc = 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_rgb_to_bw.cc b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc index e3808985c0e..91691954b49 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc +++ b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc @@ -29,7 +29,7 @@ #include "node_shader_util.h" -namespace blender::nodes { +namespace blender::nodes::node_shader_rgb_to_bw_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,23 +170,27 @@ static void sh_node_valtorgb_build_multi_function( builder.construct_and_set_matching_fn<ColorBandFunction>(*color_band); } +} // namespace blender::nodes::node_shader_rgb_to_bw_cc + void register_node_type_sh_valtorgb() { + namespace file_ns = blender::nodes::node_shader_rgb_to_bw_cc; + 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); + 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, node_shader_exec_valtorgb); - node_type_gpu(&ntype, gpu_shader_valtorgb); - ntype.build_multi_function = sh_node_valtorgb_build_multi_function; + 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); } -namespace blender::nodes { +namespace blender::nodes::node_shader_rgb_to_bw_cc { static void sh_node_rgbtobw_declare(NodeDeclarationBuilder &b) { @@ -196,8 +198,6 @@ static void sh_node_rgbtobw_declare(NodeDeclarationBuilder &b) 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 +222,18 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat, return GPU_stack_link(mat, node, "rgbtobw", in, out); } +} // namespace blender::nodes::node_shader_rgb_to_bw_cc + void register_node_type_sh_rgbtobw() { + namespace file_ns = blender::nodes::node_shader_rgb_to_bw_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_sepcomb_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc index 4984a530d8b..4ecc4d163f2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc @@ -23,7 +23,7 @@ #include "node_shader_util.h" -namespace blender::nodes { +namespace blender::nodes::node_shader_sepcomb_rgb_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,20 +101,24 @@ static void sh_node_seprgb_build_multi_function(blender::nodes::NodeMultiFunctio builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_shader_sepcomb_rgb_cc + void register_node_type_sh_seprgb() { + namespace file_ns = blender::nodes::node_shader_sepcomb_rgb_cc; + 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; + 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); } -namespace blender::nodes { +namespace blender::nodes::node_shader_sepcomb_rgb_cc { static void sh_node_combrgb_declare(NodeDeclarationBuilder &b) { @@ -127,8 +129,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 +163,19 @@ static void sh_node_combrgb_build_multi_function(blender::nodes::NodeMultiFuncti builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_shader_sepcomb_rgb_cc + void register_node_type_sh_combrgb() { + namespace file_ns = blender::nodes::node_shader_sepcomb_rgb_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_sepcomb_xyz.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc index a414630829e..1010b46eb3b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc @@ -23,7 +23,7 @@ #include "node_shader_util.h" -namespace blender::nodes { +namespace blender::nodes::node_shader_sepcomb_xyz_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,19 +86,23 @@ static void sh_node_sepxyz_build_multi_function(blender::nodes::NodeMultiFunctio builder.set_matching_fn(separate_fn); } +} // namespace blender::nodes::node_shader_sepcomb_xyz_cc + void register_node_type_sh_sepxyz() { + namespace file_ns = blender::nodes::node_shader_sepcomb_xyz_cc; + 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; + 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); } -namespace blender::nodes { +namespace blender::nodes::node_shader_sepcomb_xyz_cc { static void sh_node_combxyz_declare(NodeDeclarationBuilder &b) { @@ -111,8 +113,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 +129,18 @@ static void sh_node_combxyz_build_multi_function(blender::nodes::NodeMultiFuncti builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_shader_sepcomb_xyz_cc + void register_node_type_sh_combxyz() { + namespace file_ns = blender::nodes::node_shader_sepcomb_xyz_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_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc index 0f859af1b93..b98ea9ce6fc 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 = MEM_cnew<NodeTexBrick>(__func__); @@ -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 a4249efcff0..7c1e1a5bb26 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.h" -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 = MEM_cnew<NodeTexChecker>(__func__); @@ -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_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc index df4dffac5d5..3c8f0494b25 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.h" -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 = MEM_cnew<NodeTexGradient>(__func__); @@ -55,8 +53,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_; @@ -157,19 +153,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 281cf020270..96b36ab201b 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.h" -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 = MEM_cnew<NodeTexImage>(__func__); @@ -173,17 +171,20 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, return true; } -/* node type definition */ +} // namespace blender::nodes::node_shader_tex_image_cc + 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); ntype.labelfunc = 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 b89a07425c4..0b745277d80 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.h" -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 = MEM_cnew<NodeTexMagic>(__func__); @@ -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 314428a139b..65d07eac741 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -23,7 +23,7 @@ NODE_STORAGE_FUNCS(NodeTexMusgrave) -namespace blender::nodes { +namespace blender::nodes::node_shader_musgrave_cc { static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) { @@ -42,8 +42,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 = MEM_cnew<NodeTexMusgrave>(__func__); @@ -132,8 +130,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_; @@ -523,7 +519,7 @@ class MusgraveFunction : public fn::MultiFunction { } } } -}; // namespace blender::nodes +}; static void sh_node_musgrave_build_multi_function( blender::nodes::NodeMultiFunctionBuilder &builder) @@ -533,21 +529,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_musgrave_cc void register_node_type_sh_tex_musgrave() { + namespace file_ns = blender::nodes::node_shader_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 d2572e09d3c..4b98689be54 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -23,7 +23,7 @@ NODE_STORAGE_FUNCS(NodeTexNoise) -namespace blender::nodes { +namespace blender::nodes::node_shader_noise_cc { static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) { @@ -45,8 +45,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 = MEM_cnew<NodeTexNoise>(__func__); @@ -91,8 +89,6 @@ static void node_shader_update_tex_noise(bNodeTree *ntree, bNode *node) nodeSetSocketAvailability(ntree, sockW, storage.dimensions == 1 || storage.dimensions == 4); } -namespace blender::nodes { - class NoiseFunction : public fn::MultiFunction { private: int dimensions_; @@ -250,21 +246,22 @@ static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunction builder.construct_and_set_matching_fn<NoiseFunction>(storage.dimensions); } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_noise_cc -/* node type definition */ void register_node_type_sh_tex_noise() { + namespace file_ns = blender::nodes::node_shader_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_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc index a4d60628726..c2667deb847 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -23,7 +23,7 @@ NODE_STORAGE_FUNCS(NodeTexVoronoi) -namespace blender::nodes { +namespace blender::nodes::node_shader_voronoi_cc { static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) { @@ -62,8 +62,6 @@ static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) }); }; -} // namespace blender::nodes - static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) { NodeTexVoronoi *tex = MEM_cnew<NodeTexVoronoi>(__func__); @@ -181,8 +179,6 @@ static void node_shader_update_tex_voronoi(bNodeTree *ntree, bNode *node) nodeSetSocketAvailability(ntree, outRadiusSock, storage.feature == SHD_VORONOI_N_SPHERE_RADIUS); } -namespace blender::nodes { - static MultiFunction::ExecutionHints voronoi_execution_hints{50, false}; class VoronoiMinowskiFunction : public fn::MultiFunction { @@ -1340,20 +1336,22 @@ static void sh_node_voronoi_build_multi_function(blender::nodes::NodeMultiFuncti } } -} // namespace blender::nodes +} // namespace blender::nodes::node_shader_voronoi_cc void register_node_type_sh_tex_voronoi() { + namespace file_ns = blender::nodes::node_shader_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 bd5264d4916..4160367646c 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_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 = MEM_cnew<NodeTexWave>(__func__); @@ -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_wave_cc void register_node_type_sh_tex_wave() { + namespace file_ns = blender::nodes::node_shader_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 0e72cee38e7..696086f803a 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_white_noise_cc { static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b) { @@ -35,8 +35,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; @@ -70,8 +68,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_; @@ -192,19 +188,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_white_noise_cc void register_node_type_sh_tex_white_noise() { + namespace file_ns = blender::nodes::node_shader_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_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index f0eb3ea9bee..44076ff80ce 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.h" -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_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc index 5f5969de78c..56465f57e96 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc @@ -26,7 +26,7 @@ #include "NOD_math_functions.hh" #include "NOD_socket_search_link.hh" -namespace blender::nodes { +namespace blender::nodes::node_shader_vector_math_cc { static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) { @@ -51,8 +51,6 @@ static void sh_node_vector_math_gather_link_searches(GatherLinkSearchOpParams &p } } -} // namespace blender::nodes - static const char *gpu_shader_get_name(int mode) { switch (mode) { @@ -292,17 +290,21 @@ static void sh_node_vector_math_build_multi_function( builder.set_matching_fn(fn); } +} // namespace blender::nodes::node_shader_vector_math_cc + void register_node_type_sh_vect_math() { + namespace file_ns = blender::nodes::node_shader_vector_math_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; ntype.labelfunc = 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; - ntype.gather_link_search_ops = blender::nodes::sh_node_vector_math_gather_link_searches; + 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; + ntype.gather_link_search_ops = file_ns::sh_node_vector_math_gather_link_searches; 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 a3cb82f3245..9a320473115 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.h" -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); } |