Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_color.hh
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | friend bool operator==(const Color4f &a, const Color4f &b) | ||||
| return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a; | return a.r == b.r && a.g == b.g && a.b == b.b && a.a == b.a; | ||||
| } | } | ||||
| friend bool operator!=(const Color4f &a, const Color4f &b) | friend bool operator!=(const Color4f &a, const Color4f &b) | ||||
| { | { | ||||
| return !(a == b); | return !(a == b); | ||||
| } | } | ||||
| friend Color4f operator-(const Color4f &a, const Color4f &b) | |||||
JacquesLucke: I'm not too fond of adding these methods to colors. Not sure..
Generally these are not… | |||||
HooglyBooglyAuthorUnsubmitted Done Inline ActionsAlright, I removed them for now. Maybe the mixer in attribute_math is a step in the right direction, because this problem will come up again. HooglyBoogly: Alright, I removed them for now. Maybe the mixer in `attribute_math` is a step in the right… | |||||
| { | |||||
| return {a.r - b.r, a.g - b.g, a.b - b.b, a.a - b.a}; | |||||
| } | |||||
| friend Color4f operator+(const Color4f &a, const Color4f &b) | |||||
| { | |||||
| return {a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a}; | |||||
| } | |||||
| friend Color4f operator*(const Color4f &a, const Color4f &b) | |||||
| { | |||||
| return {a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a}; | |||||
| } | |||||
| friend Color4f operator*(const Color4f &a, const float &b) | |||||
| { | |||||
| return {a.r * b, a.g * b, a.b * b, a.a * b}; | |||||
| } | |||||
| friend Color4f operator/(const Color4f &a, const Color4f &b) | |||||
| { | |||||
| return {a.r / b.r, a.g / b.g, a.b / b.b, a.a / b.a}; | |||||
| } | |||||
| friend Color4f operator/(const Color4f &a, const float &b) | |||||
| { | |||||
| return {a.r / b, a.g / b, a.b / b, a.a / b}; | |||||
| } | |||||
| uint64_t hash() const | uint64_t hash() const | ||||
| { | { | ||||
| uint64_t x1 = *reinterpret_cast<const uint32_t *>(&r); | uint64_t x1 = *reinterpret_cast<const uint32_t *>(&r); | ||||
| uint64_t x2 = *reinterpret_cast<const uint32_t *>(&g); | uint64_t x2 = *reinterpret_cast<const uint32_t *>(&g); | ||||
| uint64_t x3 = *reinterpret_cast<const uint32_t *>(&b); | uint64_t x3 = *reinterpret_cast<const uint32_t *>(&b); | ||||
| uint64_t x4 = *reinterpret_cast<const uint32_t *>(&a); | uint64_t x4 = *reinterpret_cast<const uint32_t *>(&a); | ||||
| return (x1 * 1283591) ^ (x2 * 850177) ^ (x3 * 735391) ^ (x4 * 442319); | return (x1 * 1283591) ^ (x2 * 850177) ^ (x3 * 735391) ^ (x4 * 442319); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||
I'm not too fond of adding these methods to colors. Not sure..
Generally these are not operations one should do with colors.
It might be best to just not support colors in this node yet.