diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-16 20:33:36 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-16 20:33:36 +0300 |
commit | 2564d152d6edf65afcb573598a1303483c62eb06 (patch) | |
tree | 378ffe6dc426d769eda0635971f06849cfef301c /source/blender/nodes | |
parent | 263c5b33d697f6202e3d9b07317e1dc05ffb9a25 (diff) |
Cleanup: Remove unnecessary namespace specification
Ever since d5b72fb06cd0405c46, shader nodes have been in the
`blender::nodes` namespace, so they don't need to use that to access
Blender's C++ types and functions.
Diffstat (limited to 'source/blender/nodes')
20 files changed, 270 insertions, 330 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc index 9b1d2ee1d63..c8785721dfb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc @@ -42,12 +42,12 @@ static int gpu_shader_clamp(GPUMaterial *mat, GPU_stack_link(mat, node, "clamp_range", in, out); } -static void sh_node_clamp_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_clamp_build_multi_function(NodeMultiFunctionBuilder &builder) { - static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, float> minmax_fn{ + static fn::CustomMF_SI_SI_SI_SO<float, float, float, float> minmax_fn{ "Clamp (Min Max)", [](float value, float min, float max) { return std::min(std::max(value, min), max); }}; - static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, float> range_fn{ + static fn::CustomMF_SI_SI_SI_SO<float, float, float, float> range_fn{ "Clamp (Range)", [](float value, float a, float b) { if (a < b) { return clamp_f(value, a, b); diff --git a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc index 0c8cc209d5a..3723480ffa3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc @@ -87,37 +87,35 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, return GPU_stack_link(mat, node, "valtorgb", in, out, tex, GPU_constant(&layer)); } -class ColorBandFunction : public blender::fn::MultiFunction { +class ColorBandFunction : public fn::MultiFunction { private: const ColorBand &color_band_; public: ColorBandFunction(const ColorBand &color_band) : color_band_(color_band) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Color Band"}; + fn::MFSignatureBuilder signature{"Color Band"}; signature.single_input<float>("Value"); - signature.single_output<blender::ColorGeometry4f>("Color"); + signature.single_output<ColorGeometry4f>("Color"); signature.single_output<float>("Alpha"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &values = params.readonly_single_input<float>(0, "Value"); - blender::MutableSpan<blender::ColorGeometry4f> colors = - params.uninitialized_single_output<blender::ColorGeometry4f>(1, "Color"); - blender::MutableSpan<float> alphas = params.uninitialized_single_output<float>(2, "Alpha"); + const VArray<float> &values = params.readonly_single_input<float>(0, "Value"); + MutableSpan<ColorGeometry4f> colors = params.uninitialized_single_output<ColorGeometry4f>( + 1, "Color"); + MutableSpan<float> alphas = params.uninitialized_single_output<float>(2, "Alpha"); for (int64_t i : mask) { - blender::ColorGeometry4f color; + ColorGeometry4f color; BKE_colorband_evaluate(&color_band_, values[i], color); colors[i] = color; alphas[i] = color.a; @@ -125,8 +123,7 @@ class ColorBandFunction : public blender::fn::MultiFunction { } }; -static void sh_node_valtorgb_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_valtorgb_build_multi_function(nodes::NodeMultiFunctionBuilder &builder) { bNode &bnode = builder.node(); const ColorBand *color_band = (const ColorBand *)bnode.storage; diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc index 64a5cd97250..b1db0248d9f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.cc +++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc @@ -72,35 +72,31 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, GPU_uniform(ext_xyz[2])); } -class CurveVecFunction : public blender::fn::MultiFunction { +class CurveVecFunction : public fn::MultiFunction { private: const CurveMapping &cumap_; public: CurveVecFunction(const CurveMapping &cumap) : cumap_(cumap) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Curve Vec"}; + fn::MFSignatureBuilder signature{"Curve Vec"}; signature.single_input<float>("Fac"); - signature.single_input<blender::float3>("Vector"); - signature.single_output<blender::float3>("Vector"); + signature.single_input<float3>("Vector"); + signature.single_output<float3>("Vector"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); - const blender::VArray<blender::float3> &vec_in = params.readonly_single_input<blender::float3>( - 1, "Vector"); - blender::MutableSpan<blender::float3> vec_out = - params.uninitialized_single_output<blender::float3>(2, "Vector"); + const VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); + const VArray<float3> &vec_in = params.readonly_single_input<float3>(1, "Vector"); + MutableSpan<float3> vec_out = params.uninitialized_single_output<float3>(2, "Vector"); for (int64_t i : mask) { BKE_curvemapping_evaluate3F(&cumap_, vec_out[i], vec_in[i]); @@ -111,8 +107,7 @@ class CurveVecFunction : public blender::fn::MultiFunction { } }; -static void sh_node_curve_vec_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_curve_vec_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &bnode = builder.node(); CurveMapping *cumap = (CurveMapping *)bnode.storage; @@ -230,35 +225,33 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, GPU_uniform(ext_rgba[3])); } -class CurveRGBFunction : public blender::fn::MultiFunction { +class CurveRGBFunction : public fn::MultiFunction { private: const CurveMapping &cumap_; public: CurveRGBFunction(const CurveMapping &cumap) : cumap_(cumap) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Curve RGB"}; + fn::MFSignatureBuilder signature{"Curve RGB"}; signature.single_input<float>("Fac"); - signature.single_input<blender::ColorGeometry4f>("Color"); - signature.single_output<blender::ColorGeometry4f>("Color"); + signature.single_input<ColorGeometry4f>("Color"); + signature.single_output<ColorGeometry4f>("Color"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); - const blender::VArray<blender::ColorGeometry4f> &col_in = - params.readonly_single_input<blender::ColorGeometry4f>(1, "Color"); - blender::MutableSpan<blender::ColorGeometry4f> col_out = - params.uninitialized_single_output<blender::ColorGeometry4f>(2, "Color"); + const VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); + const VArray<ColorGeometry4f> &col_in = params.readonly_single_input<ColorGeometry4f>(1, + "Color"); + MutableSpan<ColorGeometry4f> col_out = params.uninitialized_single_output<ColorGeometry4f>( + 2, "Color"); for (int64_t i : mask) { BKE_curvemapping_evaluateRGBF(&cumap_, col_out[i], col_in[i]); @@ -269,8 +262,7 @@ class CurveRGBFunction : public blender::fn::MultiFunction { } }; -static void sh_node_curve_rgb_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_curve_rgb_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &bnode = builder.node(); CurveMapping *cumap = (CurveMapping *)bnode.storage; @@ -360,33 +352,31 @@ static int gpu_shader_curve_float(GPUMaterial *mat, GPU_uniform(ext_xyz)); } -class CurveFloatFunction : public blender::fn::MultiFunction { +class CurveFloatFunction : public fn::MultiFunction { private: const CurveMapping &cumap_; public: CurveFloatFunction(const CurveMapping &cumap) : cumap_(cumap) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Curve Float"}; + fn::MFSignatureBuilder signature{"Curve Float"}; signature.single_input<float>("Factor"); signature.single_input<float>("Value"); signature.single_output<float>("Value"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Factor"); - const blender::VArray<float> &val_in = params.readonly_single_input<float>(1, "Value"); - blender::MutableSpan<float> val_out = params.uninitialized_single_output<float>(2, "Value"); + const VArray<float> &fac = params.readonly_single_input<float>(0, "Factor"); + const VArray<float> &val_in = params.readonly_single_input<float>(1, "Value"); + MutableSpan<float> val_out = params.uninitialized_single_output<float>(2, "Value"); for (int64_t i : mask) { val_out[i] = BKE_curvemapping_evaluateF(&cumap_, 0, val_in[i]); @@ -397,8 +387,7 @@ class CurveFloatFunction : public blender::fn::MultiFunction { } }; -static void sh_node_curve_float_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_curve_float_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &bnode = builder.node(); CurveMapping *cumap = (CurveMapping *)bnode.storage; 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 f922499b910..8e7934bf34e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -223,7 +223,7 @@ static float3 clamp_range(const float3 value, const float3 min, const float3 max clamp_range(value.z, min.z, max.z)); } -static void map_range_vector_signature(blender::fn::MFSignatureBuilder *signature, bool use_steps) +static void map_range_vector_signature(fn::MFSignatureBuilder *signature, bool use_steps) { signature->single_input<float3>("Vector"); signature->single_input<float3>("From Min"); @@ -236,34 +236,32 @@ static void map_range_vector_signature(blender::fn::MFSignatureBuilder *signatur signature->single_output<float3>("Vector"); } -class MapRangeVectorFunction : public blender::fn::MultiFunction { +class MapRangeVectorFunction : public fn::MultiFunction { private: bool clamp_; public: MapRangeVectorFunction(bool clamp) : clamp_(clamp) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Vector Map Range"}; + fn::MFSignatureBuilder signature{"Vector Map Range"}; map_range_vector_signature(&signature, false); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); - const blender::VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); - const blender::VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); - const blender::VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); - const blender::VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); - blender::MutableSpan<float3> results = params.uninitialized_single_output<float3>(5, "Vector"); + const VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); + const VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); + const VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); + const VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); + const VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); + MutableSpan<float3> results = params.uninitialized_single_output<float3>(5, "Vector"); for (int64_t i : mask) { float3 factor = math::safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -278,35 +276,33 @@ class MapRangeVectorFunction : public blender::fn::MultiFunction { } }; -class MapRangeSteppedVectorFunction : public blender::fn::MultiFunction { +class MapRangeSteppedVectorFunction : public fn::MultiFunction { private: bool clamp_; public: MapRangeSteppedVectorFunction(bool clamp) : clamp_(clamp) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Vector Map Range Stepped"}; + fn::MFSignatureBuilder signature{"Vector Map Range Stepped"}; map_range_vector_signature(&signature, true); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); - const blender::VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); - const blender::VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); - const blender::VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); - const blender::VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); - const blender::VArray<float3> &steps = params.readonly_single_input<float3>(5, "Steps"); - blender::MutableSpan<float3> results = params.uninitialized_single_output<float3>(6, "Vector"); + const VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); + const VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); + const VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); + const VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); + const VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); + const VArray<float3> &steps = params.readonly_single_input<float3>(5, "Steps"); + MutableSpan<float3> results = params.uninitialized_single_output<float3>(6, "Vector"); for (int64_t i : mask) { float3 factor = math::safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -322,31 +318,29 @@ class MapRangeSteppedVectorFunction : public blender::fn::MultiFunction { } }; -class MapRangeSmoothstepVectorFunction : public blender::fn::MultiFunction { +class MapRangeSmoothstepVectorFunction : public fn::MultiFunction { public: MapRangeSmoothstepVectorFunction() { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Vector Map Range Smoothstep"}; + fn::MFSignatureBuilder signature{"Vector Map Range Smoothstep"}; map_range_vector_signature(&signature, false); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); - const blender::VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); - const blender::VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); - const blender::VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); - const blender::VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); - blender::MutableSpan<float3> results = params.uninitialized_single_output<float3>(5, "Vector"); + const VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); + const VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); + const VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); + const VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); + const VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); + MutableSpan<float3> results = params.uninitialized_single_output<float3>(5, "Vector"); for (int64_t i : mask) { float3 factor = math::safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -357,31 +351,29 @@ class MapRangeSmoothstepVectorFunction : public blender::fn::MultiFunction { } }; -class MapRangeSmootherstepVectorFunction : public blender::fn::MultiFunction { +class MapRangeSmootherstepVectorFunction : public fn::MultiFunction { public: MapRangeSmootherstepVectorFunction() { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Vector Map Range Smoothstep"}; + fn::MFSignatureBuilder signature{"Vector Map Range Smoothstep"}; map_range_vector_signature(&signature, false); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); - const blender::VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); - const blender::VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); - const blender::VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); - const blender::VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); - blender::MutableSpan<float3> results = params.uninitialized_single_output<float3>(5, "Vector"); + const VArray<float3> &values = params.readonly_single_input<float3>(0, "Vector"); + const VArray<float3> &from_min = params.readonly_single_input<float3>(1, "From Min"); + const VArray<float3> &from_max = params.readonly_single_input<float3>(2, "From Max"); + const VArray<float3> &to_min = params.readonly_single_input<float3>(3, "To Min"); + const VArray<float3> &to_max = params.readonly_single_input<float3>(4, "To Max"); + MutableSpan<float3> results = params.uninitialized_single_output<float3>(5, "Vector"); for (int64_t i : mask) { float3 factor = math::safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -392,7 +384,7 @@ class MapRangeSmootherstepVectorFunction : public blender::fn::MultiFunction { } }; -static void map_range_signature(blender::fn::MFSignatureBuilder *signature, bool use_steps) +static void map_range_signature(fn::MFSignatureBuilder *signature, bool use_steps) { signature->single_input<float>("Value"); signature->single_input<float>("From Min"); @@ -405,34 +397,32 @@ static void map_range_signature(blender::fn::MFSignatureBuilder *signature, bool signature->single_output<float>("Result"); } -class MapRangeFunction : public blender::fn::MultiFunction { +class MapRangeFunction : public fn::MultiFunction { private: bool clamp_; public: MapRangeFunction(bool clamp) : clamp_(clamp) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Map Range"}; + fn::MFSignatureBuilder signature{"Map Range"}; map_range_signature(&signature, false); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &values = params.readonly_single_input<float>(0, "Value"); - const blender::VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); - const blender::VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); - const blender::VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); - const blender::VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); - blender::MutableSpan<float> results = params.uninitialized_single_output<float>(5, "Result"); + const VArray<float> &values = params.readonly_single_input<float>(0, "Value"); + const VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); + const VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); + const VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); + const VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); + MutableSpan<float> results = params.uninitialized_single_output<float>(5, "Result"); for (int64_t i : mask) { float factor = safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -447,35 +437,33 @@ class MapRangeFunction : public blender::fn::MultiFunction { } }; -class MapRangeSteppedFunction : public blender::fn::MultiFunction { +class MapRangeSteppedFunction : public fn::MultiFunction { private: bool clamp_; public: MapRangeSteppedFunction(bool clamp) : clamp_(clamp) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Map Range Stepped"}; + fn::MFSignatureBuilder signature{"Map Range Stepped"}; map_range_signature(&signature, true); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &values = params.readonly_single_input<float>(0, "Value"); - const blender::VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); - const blender::VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); - const blender::VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); - const blender::VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); - const blender::VArray<float> &steps = params.readonly_single_input<float>(5, "Steps"); - blender::MutableSpan<float> results = params.uninitialized_single_output<float>(6, "Result"); + const VArray<float> &values = params.readonly_single_input<float>(0, "Value"); + const VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); + const VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); + const VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); + const VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); + const VArray<float> &steps = params.readonly_single_input<float>(5, "Steps"); + MutableSpan<float> results = params.uninitialized_single_output<float>(6, "Result"); for (int64_t i : mask) { float factor = safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -491,31 +479,29 @@ class MapRangeSteppedFunction : public blender::fn::MultiFunction { } }; -class MapRangeSmoothstepFunction : public blender::fn::MultiFunction { +class MapRangeSmoothstepFunction : public fn::MultiFunction { public: MapRangeSmoothstepFunction() { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Map Range Smoothstep"}; + fn::MFSignatureBuilder signature{"Map Range Smoothstep"}; map_range_signature(&signature, false); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &values = params.readonly_single_input<float>(0, "Value"); - const blender::VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); - const blender::VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); - const blender::VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); - const blender::VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); - blender::MutableSpan<float> results = params.uninitialized_single_output<float>(5, "Result"); + const VArray<float> &values = params.readonly_single_input<float>(0, "Value"); + const VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); + const VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); + const VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); + const VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); + MutableSpan<float> results = params.uninitialized_single_output<float>(5, "Result"); for (int64_t i : mask) { float factor = safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -526,31 +512,29 @@ class MapRangeSmoothstepFunction : public blender::fn::MultiFunction { } }; -class MapRangeSmootherstepFunction : public blender::fn::MultiFunction { +class MapRangeSmootherstepFunction : public fn::MultiFunction { public: MapRangeSmootherstepFunction() { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Map Range Smoothstep"}; + fn::MFSignatureBuilder signature{"Map Range Smoothstep"}; map_range_signature(&signature, false); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &values = params.readonly_single_input<float>(0, "Value"); - const blender::VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); - const blender::VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); - const blender::VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); - const blender::VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); - blender::MutableSpan<float> results = params.uninitialized_single_output<float>(5, "Result"); + const VArray<float> &values = params.readonly_single_input<float>(0, "Value"); + const VArray<float> &from_min = params.readonly_single_input<float>(1, "From Min"); + const VArray<float> &from_max = params.readonly_single_input<float>(2, "From Max"); + const VArray<float> &to_min = params.readonly_single_input<float>(3, "To Min"); + const VArray<float> &to_max = params.readonly_single_input<float>(4, "To Max"); + MutableSpan<float> results = params.uninitialized_single_output<float>(5, "Result"); for (int64_t i : mask) { float factor = safe_divide(values[i] - from_min[i], from_max[i] - from_min[i]); @@ -561,8 +545,7 @@ class MapRangeSmootherstepFunction : public blender::fn::MultiFunction { } }; -static void sh_node_map_range_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_map_range_build_multi_function(NodeMultiFunctionBuilder &builder) { const NodeMapRange &storage = node_storage(builder.node()); bool clamp = storage.clamp != 0; diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc index 83d0ff8177b..a828011a3ab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_math.cc @@ -69,8 +69,7 @@ static void sh_node_math_gather_link_searches(GatherLinkSearchOpParams ¶ms) static const char *gpu_shader_get_name(int mode) { - const blender::nodes::FloatMathOperationInfo *info = - blender::nodes::get_float_math_operation_info(mode); + const FloatMathOperationInfo *info = get_float_math_operation_info(mode); if (!info) { return nullptr; } @@ -102,34 +101,32 @@ static int gpu_shader_math(GPUMaterial *mat, return 0; } -static const blender::fn::MultiFunction *get_base_multi_function(bNode &node) +static const fn::MultiFunction *get_base_multi_function(bNode &node) { const int mode = node.custom1; - const blender::fn::MultiFunction *base_fn = nullptr; + const fn::MultiFunction *base_fn = nullptr; - blender::nodes::try_dispatch_float_math_fl_to_fl( - mode, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SO<float, float> fn{info.title_case_name.c_str(), - function}; - base_fn = &fn; - }); + try_dispatch_float_math_fl_to_fl(mode, [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SO<float, float> fn{info.title_case_name.c_str(), function}; + base_fn = &fn; + }); if (base_fn != nullptr) { return base_fn; } - blender::nodes::try_dispatch_float_math_fl_fl_to_fl( - mode, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SO<float, float, float> fn{info.title_case_name.c_str(), - function}; - base_fn = &fn; - }); + try_dispatch_float_math_fl_fl_to_fl(mode, + [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SO<float, float, float> fn{ + info.title_case_name.c_str(), function}; + base_fn = &fn; + }); if (base_fn != nullptr) { return base_fn; } - blender::nodes::try_dispatch_float_math_fl_fl_fl_to_fl( - mode, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, float> fn{ + try_dispatch_float_math_fl_fl_fl_to_fl( + mode, [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SI_SO<float, float, float, float> fn{ info.title_case_name.c_str(), function}; base_fn = &fn; }); @@ -140,27 +137,24 @@ static const blender::fn::MultiFunction *get_base_multi_function(bNode &node) return nullptr; } -class ClampWrapperFunction : public blender::fn::MultiFunction { +class ClampWrapperFunction : public fn::MultiFunction { private: - const blender::fn::MultiFunction &fn_; + const fn::MultiFunction &fn_; public: - ClampWrapperFunction(const blender::fn::MultiFunction &fn) : fn_(fn) + ClampWrapperFunction(const fn::MultiFunction &fn) : fn_(fn) { this->set_signature(&fn.signature()); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext context) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext context) const override { fn_.call(mask, params, context); /* Assumes the output parameter is the last one. */ const int output_param_index = this->param_amount() - 1; /* This has actually been initialized in the call above. */ - blender::MutableSpan<float> results = params.uninitialized_single_output<float>( - output_param_index); + MutableSpan<float> results = params.uninitialized_single_output<float>(output_param_index); for (const int i : mask) { float &value = results[i]; @@ -169,9 +163,9 @@ class ClampWrapperFunction : public blender::fn::MultiFunction { } }; -static void sh_node_math_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_math_build_multi_function(NodeMultiFunctionBuilder &builder) { - const blender::fn::MultiFunction *base_function = get_base_multi_function(builder.node()); + const fn::MultiFunction *base_function = get_base_multi_function(builder.node()); const bool clamp_output = builder.node().custom2 != 0; if (clamp_output) { 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 fc6ce6a11f7..12707623049 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc @@ -84,7 +84,7 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat, return 0; } -class MixRGBFunction : public blender::fn::MultiFunction { +class MixRGBFunction : public fn::MultiFunction { private: bool clamp_; int type_; @@ -92,31 +92,29 @@ class MixRGBFunction : public blender::fn::MultiFunction { public: MixRGBFunction(bool clamp, int type) : clamp_(clamp), type_(type) { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"MixRGB"}; + fn::MFSignatureBuilder signature{"MixRGB"}; signature.single_input<float>("Fac"); - signature.single_input<blender::ColorGeometry4f>("Color1"); - signature.single_input<blender::ColorGeometry4f>("Color2"); - signature.single_output<blender::ColorGeometry4f>("Color"); + signature.single_input<ColorGeometry4f>("Color1"); + signature.single_input<ColorGeometry4f>("Color2"); + signature.single_output<ColorGeometry4f>("Color"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); - const blender::VArray<blender::ColorGeometry4f> &col1 = - params.readonly_single_input<blender::ColorGeometry4f>(1, "Color1"); - const blender::VArray<blender::ColorGeometry4f> &col2 = - params.readonly_single_input<blender::ColorGeometry4f>(2, "Color2"); - blender::MutableSpan<blender::ColorGeometry4f> results = - params.uninitialized_single_output<blender::ColorGeometry4f>(3, "Color"); + const VArray<float> &fac = params.readonly_single_input<float>(0, "Fac"); + const VArray<ColorGeometry4f> &col1 = params.readonly_single_input<ColorGeometry4f>(1, + "Color1"); + const VArray<ColorGeometry4f> &col2 = params.readonly_single_input<ColorGeometry4f>(2, + "Color2"); + MutableSpan<ColorGeometry4f> results = params.uninitialized_single_output<ColorGeometry4f>( + 3, "Color"); for (int64_t i : mask) { results[i] = col1[i]; @@ -131,7 +129,7 @@ class MixRGBFunction : public blender::fn::MultiFunction { } }; -static void sh_node_mix_rgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_mix_rgb_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); bool clamp = node.custom2 & SHD_MIXRGB_CLAMP; 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 2a88c10b61a..657f591a50c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc @@ -27,36 +27,34 @@ static int gpu_shader_seprgb(GPUMaterial *mat, return GPU_stack_link(mat, node, "separate_rgb", in, out); } -class SeparateRGBFunction : public blender::fn::MultiFunction { +class SeparateRGBFunction : public fn::MultiFunction { public: SeparateRGBFunction() { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Separate RGB"}; - signature.single_input<blender::ColorGeometry4f>("Color"); + fn::MFSignatureBuilder signature{"Separate RGB"}; + signature.single_input<ColorGeometry4f>("Color"); signature.single_output<float>("R"); signature.single_output<float>("G"); signature.single_output<float>("B"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<blender::ColorGeometry4f> &colors = - params.readonly_single_input<blender::ColorGeometry4f>(0, "Color"); - blender::MutableSpan<float> rs = params.uninitialized_single_output<float>(1, "R"); - blender::MutableSpan<float> gs = params.uninitialized_single_output<float>(2, "G"); - blender::MutableSpan<float> bs = params.uninitialized_single_output<float>(3, "B"); + const VArray<ColorGeometry4f> &colors = params.readonly_single_input<ColorGeometry4f>(0, + "Color"); + MutableSpan<float> rs = params.uninitialized_single_output<float>(1, "R"); + MutableSpan<float> gs = params.uninitialized_single_output<float>(2, "G"); + MutableSpan<float> bs = params.uninitialized_single_output<float>(3, "B"); for (int64_t i : mask) { - blender::ColorGeometry4f color = colors[i]; + ColorGeometry4f color = colors[i]; rs[i] = color.r; gs[i] = color.g; bs[i] = color.b; @@ -64,7 +62,7 @@ class SeparateRGBFunction : public blender::fn::MultiFunction { } }; -static void sh_node_seprgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_seprgb_build_multi_function(NodeMultiFunctionBuilder &builder) { static SeparateRGBFunction fn; builder.set_matching_fn(fn); @@ -106,11 +104,10 @@ static int gpu_shader_combrgb(GPUMaterial *mat, return GPU_stack_link(mat, node, "combine_rgb", in, out); } -static void sh_node_combrgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_combrgb_build_multi_function(NodeMultiFunctionBuilder &builder) { - static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, blender::ColorGeometry4f> fn{ - "Combine RGB", - [](float r, float g, float b) { return blender::ColorGeometry4f(r, g, b, 1.0f); }}; + static fn::CustomMF_SI_SI_SI_SO<float, float, float, ColorGeometry4f> fn{ + "Combine RGB", [](float r, float g, float b) { return ColorGeometry4f(r, g, b, 1.0f); }}; builder.set_matching_fn(fn); } 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 94eb961c25d..0d751157817 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc @@ -27,36 +27,33 @@ static int gpu_shader_sepxyz(GPUMaterial *mat, return GPU_stack_link(mat, node, "separate_xyz", in, out); } -class MF_SeparateXYZ : public blender::fn::MultiFunction { +class MF_SeparateXYZ : public fn::MultiFunction { public: MF_SeparateXYZ() { - static blender::fn::MFSignature signature = create_signature(); + static fn::MFSignature signature = create_signature(); this->set_signature(&signature); } - static blender::fn::MFSignature create_signature() + static fn::MFSignature create_signature() { - blender::fn::MFSignatureBuilder signature{"Separate XYZ"}; - signature.single_input<blender::float3>("XYZ"); + fn::MFSignatureBuilder signature{"Separate XYZ"}; + signature.single_input<float3>("XYZ"); signature.single_output<float>("X"); signature.single_output<float>("Y"); signature.single_output<float>("Z"); return signature.build(); } - void call(blender::IndexMask mask, - blender::fn::MFParams params, - blender::fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { - const blender::VArray<blender::float3> &vectors = - params.readonly_single_input<blender::float3>(0, "XYZ"); - blender::MutableSpan<float> xs = params.uninitialized_single_output<float>(1, "X"); - blender::MutableSpan<float> ys = params.uninitialized_single_output<float>(2, "Y"); - blender::MutableSpan<float> zs = params.uninitialized_single_output<float>(3, "Z"); + const VArray<float3> &vectors = params.readonly_single_input<float3>(0, "XYZ"); + MutableSpan<float> xs = params.uninitialized_single_output<float>(1, "X"); + MutableSpan<float> ys = params.uninitialized_single_output<float>(2, "Y"); + MutableSpan<float> zs = params.uninitialized_single_output<float>(3, "Z"); for (int64_t i : mask) { - blender::float3 xyz = vectors[i]; + float3 xyz = vectors[i]; xs[i] = xyz.x; ys[i] = xyz.y; zs[i] = xyz.z; @@ -64,7 +61,7 @@ class MF_SeparateXYZ : public blender::fn::MultiFunction { } }; -static void sh_node_sepxyz_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_sepxyz_build_multi_function(NodeMultiFunctionBuilder &builder) { static MF_SeparateXYZ separate_fn; builder.set_matching_fn(separate_fn); @@ -106,10 +103,10 @@ static int gpu_shader_combxyz(GPUMaterial *mat, return GPU_stack_link(mat, node, "combine_xyz", in, out); } -static void sh_node_combxyz_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_combxyz_build_multi_function(NodeMultiFunctionBuilder &builder) { - static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, blender::float3> fn{ - "Combine Vector", [](float x, float y, float z) { return blender::float3(x, y, z); }}; + static fn::CustomMF_SI_SI_SI_SO<float, float, float, float3> fn{ + "Combine Vector", [](float x, float y, float z) { return float3(x, y, z); }}; builder.set_matching_fn(fn); } 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 66d1ace2222..cad9e1b33f2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -259,7 +259,7 @@ class BrickFunction : public fn::MultiFunction { } }; -static void sh_node_brick_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_brick_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); NodeTexBrick *tex = (NodeTexBrick *)node.storage; 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 047ae303260..b0e5639c893 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -61,9 +61,7 @@ class NodeTexChecker : public fn::MultiFunction { return signature.build(); } - void call(blender::IndexMask mask, - fn::MFParams params, - fn::MFContext UNUSED(context)) const override + void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override { const VArray<float3> &vector = params.readonly_single_input<float3>(0, "Vector"); const VArray<ColorGeometry4f> &color1 = params.readonly_single_input<ColorGeometry4f>( @@ -94,8 +92,7 @@ class NodeTexChecker : public fn::MultiFunction { } }; -static void sh_node_tex_checker_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_tex_checker_build_multi_function(NodeMultiFunctionBuilder &builder) { static NodeTexChecker fn; builder.set_matching_fn(fn); 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 f92ad4d9fd0..8478cbd406b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -137,8 +137,7 @@ class GradientFunction : public fn::MultiFunction { } }; -static void sh_node_gradient_tex_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_gradient_tex_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); NodeTexGradient *tex = (NodeTexGradient *)node.storage; 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 982d80811fb..95c4a8b8e46 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -159,8 +159,7 @@ class MagicFunction : public fn::MultiFunction { } }; -static void sh_node_magic_tex_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_magic_tex_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); NodeTexMagic *tex = (NodeTexMagic *)node.storage; 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 8a672063943..c13ce3c3df3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -514,8 +514,7 @@ class MusgraveFunction : public fn::MultiFunction { } }; -static void sh_node_musgrave_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_musgrave_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); NodeTexMusgrave *tex = (NodeTexMusgrave *)node.storage; 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 9b27c805a64..87fb1aeac29 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -232,7 +232,7 @@ class NoiseFunction : public fn::MultiFunction { } }; -static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_noise_build_multi_function(NodeMultiFunctionBuilder &builder) { const NodeTexNoise &storage = node_storage(builder.node()); builder.construct_and_set_matching_fn<NoiseFunction>(storage.dimensions); 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 1d6d16fa5e1..fc6a5ef72b6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -1312,7 +1312,7 @@ class VoronoiEdgeFunction : public fn::MultiFunction { } }; -static void sh_node_voronoi_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_voronoi_build_multi_function(NodeMultiFunctionBuilder &builder) { const NodeTexVoronoi &storage = node_storage(builder.node()); bool minowski = 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 68668fbe5be..ad24224dc7f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -204,8 +204,7 @@ class WaveFunction : public fn::MultiFunction { } }; -static void sh_node_wave_tex_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_wave_tex_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); NodeTexWave *tex = (NodeTexWave *)node.storage; 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 0e2321b9cf9..6d4c491046b 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 @@ -174,7 +174,7 @@ class WhiteNoiseFunction : public fn::MultiFunction { } }; -static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_noise_build_multi_function(NodeMultiFunctionBuilder &builder) { bNode &node = builder.node(); builder.construct_and_set_matching_fn<WhiteNoiseFunction>((int)node.custom1); diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index a1e2565aec1..362cdf58052 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.cc +++ b/source/blender/nodes/shader/nodes/node_shader_value.cc @@ -24,11 +24,11 @@ static int gpu_shader_value(GPUMaterial *mat, return GPU_stack_link(mat, node, "set_value", in, out, link); } -static void sh_node_value_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_value_build_multi_function(NodeMultiFunctionBuilder &builder) { const bNodeSocket *bsocket = (bNodeSocket *)builder.node().outputs.first; const bNodeSocketValueFloat *value = (const bNodeSocketValueFloat *)bsocket->default_value; - builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<float>>(value->value); + builder.construct_and_set_matching_fn<fn::CustomMF_Constant<float>>(value->value); } } // namespace blender::nodes::node_shader_value_cc 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 49765f797c5..02a3552704e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc @@ -225,27 +225,25 @@ static void node_shader_update_vector_math(bNodeTree *ntree, bNode *node) } } -static const blender::fn::MultiFunction *get_multi_function(bNode &node) +static const fn::MultiFunction *get_multi_function(bNode &node) { - using blender::float3; - NodeVectorMathOperation operation = NodeVectorMathOperation(node.custom1); - const blender::fn::MultiFunction *multi_fn = nullptr; + const fn::MultiFunction *multi_fn = nullptr; - blender::nodes::try_dispatch_float_math_fl3_fl3_to_fl3( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SO<float3, float3, float3> fn{ - info.title_case_name.c_str(), function}; - multi_fn = &fn; - }); + try_dispatch_float_math_fl3_fl3_to_fl3(operation, + [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SO<float3, float3, float3> fn{ + info.title_case_name.c_str(), function}; + multi_fn = &fn; + }); if (multi_fn != nullptr) { return multi_fn; } - blender::nodes::try_dispatch_float_math_fl3_fl3_fl3_to_fl3( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float3, float3> fn{ + try_dispatch_float_math_fl3_fl3_fl3_to_fl3( + operation, [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float3, float3> fn{ info.title_case_name.c_str(), function}; multi_fn = &fn; }); @@ -253,9 +251,9 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) return multi_fn; } - blender::nodes::try_dispatch_float_math_fl3_fl3_fl_to_fl3( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + try_dispatch_float_math_fl3_fl3_fl_to_fl3( + operation, [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ info.title_case_name.c_str(), function}; multi_fn = &fn; }); @@ -263,40 +261,38 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) return multi_fn; } - blender::nodes::try_dispatch_float_math_fl3_fl3_to_fl( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SO<float3, float3, float> fn{ - info.title_case_name.c_str(), function}; - multi_fn = &fn; - }); + try_dispatch_float_math_fl3_fl3_to_fl(operation, + [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SO<float3, float3, float> fn{ + info.title_case_name.c_str(), function}; + multi_fn = &fn; + }); if (multi_fn != nullptr) { return multi_fn; } - blender::nodes::try_dispatch_float_math_fl3_fl_to_fl3( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SI_SO<float3, float, float3> fn{ - info.title_case_name.c_str(), function}; - multi_fn = &fn; - }); + try_dispatch_float_math_fl3_fl_to_fl3(operation, + [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SI_SO<float3, float, float3> fn{ + info.title_case_name.c_str(), function}; + multi_fn = &fn; + }); if (multi_fn != nullptr) { return multi_fn; } - blender::nodes::try_dispatch_float_math_fl3_to_fl3( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SO<float3, float3> fn{info.title_case_name.c_str(), - function}; + try_dispatch_float_math_fl3_to_fl3( + operation, [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SO<float3, float3> fn{info.title_case_name.c_str(), function}; multi_fn = &fn; }); if (multi_fn != nullptr) { return multi_fn; } - blender::nodes::try_dispatch_float_math_fl3_to_fl( - operation, [&](auto function, const blender::nodes::FloatMathOperationInfo &info) { - static blender::fn::CustomMF_SI_SO<float3, float> fn{info.title_case_name.c_str(), - function}; + try_dispatch_float_math_fl3_to_fl( + operation, [&](auto function, const FloatMathOperationInfo &info) { + static fn::CustomMF_SI_SO<float3, float> fn{info.title_case_name.c_str(), function}; multi_fn = &fn; }); if (multi_fn != nullptr) { @@ -306,10 +302,9 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) return nullptr; } -static void sh_node_vector_math_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_vector_math_build_multi_function(NodeMultiFunctionBuilder &builder) { - const blender::fn::MultiFunction *fn = get_multi_function(builder.node()); + const fn::MultiFunction *fn = get_multi_function(builder.node()); builder.set_matching_fn(fn); } 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 b8c44b527b5..3f1a9d758ae 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc @@ -63,8 +63,6 @@ static int gpu_shader_vector_rotate(GPUMaterial *mat, return 0; } -using blender::float3; - static float3 sh_node_vector_rotate_around_axis(const float3 vector, const float3 center, const float3 axis, @@ -92,7 +90,7 @@ static float3 sh_node_vector_rotate_euler(const float3 vector, return result + center; } -static const blender::fn::MultiFunction *get_multi_function(bNode &node) +static const fn::MultiFunction *get_multi_function(bNode &node) { bool invert = node.custom2; const int mode = node.custom1; @@ -100,13 +98,13 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) switch (mode) { case NODE_VECTOR_ROTATE_TYPE_AXIS: { if (invert) { - static blender::fn::CustomMF_SI_SI_SI_SI_SO<float3, float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SI_SO<float3, float3, float3, float, float3> fn{ "Rotate Axis", [](float3 in, float3 center, float3 axis, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, -angle); }}; return &fn; } - static blender::fn::CustomMF_SI_SI_SI_SI_SO<float3, float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SI_SO<float3, float3, float3, float, float3> fn{ "Rotate Axis", [](float3 in, float3 center, float3 axis, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, angle); }}; @@ -115,13 +113,13 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) case NODE_VECTOR_ROTATE_TYPE_AXIS_X: { float3 axis = float3(1.0f, 0.0f, 0.0f); if (invert) { - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ "Rotate X-Axis", [=](float3 in, float3 center, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, -angle); }}; return &fn; } - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ "Rotate X-Axis", [=](float3 in, float3 center, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, angle); }}; @@ -130,13 +128,13 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) case NODE_VECTOR_ROTATE_TYPE_AXIS_Y: { float3 axis = float3(0.0f, 1.0f, 0.0f); if (invert) { - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ "Rotate Y-Axis", [=](float3 in, float3 center, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, -angle); }}; return &fn; } - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ "Rotate Y-Axis", [=](float3 in, float3 center, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, angle); }}; @@ -145,13 +143,13 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) case NODE_VECTOR_ROTATE_TYPE_AXIS_Z: { float3 axis = float3(0.0f, 0.0f, 1.0f); if (invert) { - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ "Rotate Z-Axis", [=](float3 in, float3 center, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, -angle); }}; return &fn; } - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, float3> fn{ "Rotate Z-Axis", [=](float3 in, float3 center, float angle) { return sh_node_vector_rotate_around_axis(in, center, axis, angle); }}; @@ -159,13 +157,13 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) } case NODE_VECTOR_ROTATE_TYPE_EULER_XYZ: { if (invert) { - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float3, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float3, float3> fn{ "Rotate Euler", [](float3 in, float3 center, float3 rotation) { return sh_node_vector_rotate_euler(in, center, rotation, true); }}; return &fn; } - static blender::fn::CustomMF_SI_SI_SI_SO<float3, float3, float3, float3> fn{ + static fn::CustomMF_SI_SI_SI_SO<float3, float3, float3, float3> fn{ "Rotate Euler", [](float3 in, float3 center, float3 rotation) { return sh_node_vector_rotate_euler(in, center, rotation, false); }}; @@ -177,10 +175,9 @@ static const blender::fn::MultiFunction *get_multi_function(bNode &node) } } -static void sh_node_vector_rotate_build_multi_function( - blender::nodes::NodeMultiFunctionBuilder &builder) +static void sh_node_vector_rotate_build_multi_function(NodeMultiFunctionBuilder &builder) { - const blender::fn::MultiFunction *fn = get_multi_function(builder.node()); + const fn::MultiFunction *fn = get_multi_function(builder.node()); builder.set_matching_fn(fn); } |