Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_blur_attribute.cc
| Show First 20 Lines • Show All 272 Lines • ▼ Show 20 Lines | static void blur_on_mesh(const Mesh &mesh, | ||||
| GMutableSpan tmp_buffer) | GMutableSpan tmp_buffer) | ||||
| { | { | ||||
| Array<Vector<int>> neighbors_map = create_mesh_map(mesh, domain, neighbor_weights.index_range()); | Array<Vector<int>> neighbors_map = create_mesh_map(mesh, domain, neighbor_weights.index_range()); | ||||
| if (neighbors_map.is_empty()) { | if (neighbors_map.is_empty()) { | ||||
| return; | return; | ||||
| } | } | ||||
| attribute_math::convert_to_static_type(main_buffer.type(), [&](auto dummy) { | attribute_math::convert_to_static_type(main_buffer.type(), [&](auto dummy) { | ||||
| using T = decltype(dummy); | using T = decltype(dummy); | ||||
| if constexpr (!std::is_same_v<T, bool>) { | |||||
| blur_on_mesh_exec<T>(neighbor_weights, | blur_on_mesh_exec<T>(neighbor_weights, | ||||
| neighbors_map, | neighbors_map, | ||||
| iterations, | iterations, | ||||
| main_buffer.typed<T>(), | main_buffer.typed<T>(), | ||||
| tmp_buffer.typed<T>()); | tmp_buffer.typed<T>()); | ||||
| } | |||||
| }); | }); | ||||
| } | } | ||||
| template<typename T> | template<typename T> | ||||
| static void blur_on_curve_exec(const bke::CurvesGeometry &curves, | static void blur_on_curve_exec(const bke::CurvesGeometry &curves, | ||||
| const Span<float> neighbor_weights, | const Span<float> neighbor_weights, | ||||
| const int iterations, | const int iterations, | ||||
| MutableSpan<T> main_buffer, | MutableSpan<T> main_buffer, | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
| static void blur_on_curves(const bke::CurvesGeometry &curves, | static void blur_on_curves(const bke::CurvesGeometry &curves, | ||||
| const int iterations, | const int iterations, | ||||
| const Span<float> neighbor_weights, | const Span<float> neighbor_weights, | ||||
| GMutableSpan main_buffer, | GMutableSpan main_buffer, | ||||
| GMutableSpan tmp_buffer) | GMutableSpan tmp_buffer) | ||||
| { | { | ||||
| attribute_math::convert_to_static_type(main_buffer.type(), [&](auto dummy) { | attribute_math::convert_to_static_type(main_buffer.type(), [&](auto dummy) { | ||||
| using T = decltype(dummy); | using T = decltype(dummy); | ||||
| if constexpr (!std::is_same_v<T, bool>) { | |||||
| blur_on_curve_exec<T>( | blur_on_curve_exec<T>( | ||||
| curves, neighbor_weights, iterations, main_buffer.typed<T>(), tmp_buffer.typed<T>()); | curves, neighbor_weights, iterations, main_buffer.typed<T>(), tmp_buffer.typed<T>()); | ||||
| } | |||||
| }); | }); | ||||
| } | } | ||||
| class BlurAttributeFieldInput final : public bke::GeometryFieldInput { | class BlurAttributeFieldInput final : public bke::GeometryFieldInput { | ||||
| private: | private: | ||||
| const Field<float> weight_field_; | const Field<float> weight_field_; | ||||
| const GField value_field_; | const GField value_field_; | ||||
| const int iterations_; | const int iterations_; | ||||
| ▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines | |||||