diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-05-25 18:03:54 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-05-25 18:03:54 +0300 |
commit | 00955cd31eda95aca619842064d22663af4c812b (patch) | |
tree | 85a4650d260f2fdc250d433d51d7309b77f08510 /source/blender/blenkernel/BKE_attribute_math.hh | |
parent | fd94e033446c72fb92048a9864c1d539fccde59a (diff) |
Revert "Blenlib: Explicit Colors."
This reverts commit fd94e033446c72fb92048a9864c1d539fccde59a.
does not compile against latest master.
Diffstat (limited to 'source/blender/blenkernel/BKE_attribute_math.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute_math.hh | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh index ba683362e69..0afdc436415 100644 --- a/source/blender/blenkernel/BKE_attribute_math.hh +++ b/source/blender/blenkernel/BKE_attribute_math.hh @@ -52,7 +52,7 @@ inline void convert_to_static_type(const CustomDataType data_type, const Func &f func(bool()); break; case CD_PROP_COLOR: - func(ColorGeometry4f()); + func(Color4f()); break; default: BLI_assert_unreachable(); @@ -78,8 +78,8 @@ inline void convert_to_static_type(const fn::CPPType &cpp_type, const Func &func else if (cpp_type.is<bool>()) { func(bool()); } - else if (cpp_type.is<ColorGeometry4f>()) { - func(ColorGeometry4f()); + else if (cpp_type.is<Color4f>()) { + func(Color4f()); } else { BLI_assert_unreachable(); @@ -123,12 +123,9 @@ inline float3 mix3(const float3 &weights, const float3 &v0, const float3 &v1, co } template<> -inline ColorGeometry4f mix3(const float3 &weights, - const ColorGeometry4f &v0, - const ColorGeometry4f &v1, - const ColorGeometry4f &v2) +inline Color4f mix3(const float3 &weights, const Color4f &v0, const Color4f &v1, const Color4f &v2) { - ColorGeometry4f result; + Color4f result; interp_v4_v4v4v4(result, v0, v1, v2, weights); return result; } @@ -168,10 +165,9 @@ template<> inline float3 mix2(const float factor, const float3 &a, const float3 return float3::interpolate(a, b, factor); } -template<> -inline ColorGeometry4f mix2(const float factor, const ColorGeometry4f &a, const ColorGeometry4f &b) +template<> inline Color4f mix2(const float factor, const Color4f &a, const Color4f &b) { - ColorGeometry4f result; + Color4f result; interp_v4_v4v4(result, a, b, factor); return result; } @@ -278,16 +274,15 @@ class SimpleMixerWithAccumulationType { } }; -class ColorGeometryMixer { +class Color4fMixer { private: - MutableSpan<ColorGeometry4f> buffer_; - ColorGeometry4f default_color_; + MutableSpan<Color4f> buffer_; + Color4f default_color_; Array<float> total_weights_; public: - ColorGeometryMixer(MutableSpan<ColorGeometry4f> buffer, - ColorGeometry4f default_color = ColorGeometry4f(0.0f, 0.0f, 0.0f, 1.0f)); - void mix_in(const int64_t index, const ColorGeometry4f &color, const float weight = 1.0f); + Color4fMixer(MutableSpan<Color4f> buffer, Color4f default_color = {0, 0, 0, 1}); + void mix_in(const int64_t index, const Color4f &color, const float weight = 1.0f); void finalize(); }; @@ -304,10 +299,10 @@ template<> struct DefaultMixerStruct<float2> { template<> struct DefaultMixerStruct<float3> { using type = SimpleMixer<float3>; }; -template<> struct DefaultMixerStruct<ColorGeometry4f> { - /* Use a special mixer for colors. ColorGeometry4f can't be added/multiplied, because this is not +template<> struct DefaultMixerStruct<Color4f> { + /* Use a special mixer for colors. Color4f can't be added/multiplied, because this is not * something one should usually do with colors. */ - using type = ColorGeometryMixer; + using type = Color4fMixer; }; template<> struct DefaultMixerStruct<int> { static int double_to_int(const double &value) |