Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | for (const int i : range) { | ||||
| ramp_blend(blend_mode, a, factor, b); | ramp_blend(blend_mode, a, factor, b); | ||||
| results.set(i, a); | results.set(i, a); | ||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| static void do_mix_operation_color4f(const int blend_mode, | static void do_mix_operation_color4f(const int blend_mode, | ||||
| const VArray<float> &factors, | const VArray<float> &factors, | ||||
| const VArray<Color4f> &inputs_a, | const VArray<ColorGeometry4f> &inputs_a, | ||||
| const VArray<Color4f> &inputs_b, | const VArray<ColorGeometry4f> &inputs_b, | ||||
| VMutableArray<Color4f> &results) | VMutableArray<ColorGeometry4f> &results) | ||||
| { | { | ||||
| const int size = results.size(); | const int size = results.size(); | ||||
| parallel_for(IndexRange(size), 512, [&](IndexRange range) { | parallel_for(IndexRange(size), 512, [&](IndexRange range) { | ||||
| for (const int i : range) { | for (const int i : range) { | ||||
| const float factor = factors[i]; | const float factor = factors[i]; | ||||
| Color4f a = inputs_a[i]; | ColorGeometry4f a = inputs_a[i]; | ||||
| const Color4f b = inputs_b[i]; | const ColorGeometry4f b = inputs_b[i]; | ||||
| ramp_blend(blend_mode, a, factor, b); | ramp_blend(blend_mode, a, factor, b); | ||||
| results.set(i, a); | results.set(i, a); | ||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| static void do_mix_operation(const CustomDataType result_type, | static void do_mix_operation(const CustomDataType result_type, | ||||
| int blend_mode, | int blend_mode, | ||||
| Show All 14 Lines | do_mix_operation_float3(blend_mode, | ||||
| attribute_factor, | attribute_factor, | ||||
| attribute_a.typed<float3>(), | attribute_a.typed<float3>(), | ||||
| attribute_b.typed<float3>(), | attribute_b.typed<float3>(), | ||||
| attribute_result.typed<float3>()); | attribute_result.typed<float3>()); | ||||
| } | } | ||||
| else if (result_type == CD_PROP_COLOR) { | else if (result_type == CD_PROP_COLOR) { | ||||
| do_mix_operation_color4f(blend_mode, | do_mix_operation_color4f(blend_mode, | ||||
| attribute_factor, | attribute_factor, | ||||
| attribute_a.typed<Color4f>(), | attribute_a.typed<ColorGeometry4f>(), | ||||
| attribute_b.typed<Color4f>(), | attribute_b.typed<ColorGeometry4f>(), | ||||
| attribute_result.typed<Color4f>()); | attribute_result.typed<ColorGeometry4f>()); | ||||
| } | } | ||||
| } | } | ||||
| static AttributeDomain get_result_domain(const GeometryComponent &component, | static AttributeDomain get_result_domain(const GeometryComponent &component, | ||||
| const GeoNodeExecParams ¶ms, | const GeoNodeExecParams ¶ms, | ||||
| StringRef result_name) | StringRef result_name) | ||||
| { | { | ||||
| /* Use the domain of the result attribute if it already exists. */ | /* Use the domain of the result attribute if it already exists. */ | ||||
| ▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines | |||||