Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_float4.hh
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | struct float4 { | ||||
| { | { | ||||
| x *= factor; | x *= factor; | ||||
| y *= factor; | y *= factor; | ||||
| z *= factor; | z *= factor; | ||||
| w *= factor; | w *= factor; | ||||
| return *this; | return *this; | ||||
| } | } | ||||
| friend float4 operator*(const float4 &a, const float4 &b) | |||||
| { | |||||
| return {a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w}; | |||||
| } | |||||
| friend float4 operator*(const float4 &a, float b) | friend float4 operator*(const float4 &a, float b) | ||||
| { | { | ||||
| return {a.x * b, a.y * b, a.z * b, a.w * b}; | return {a.x * b, a.y * b, a.z * b, a.w * b}; | ||||
| } | } | ||||
| friend float4 operator*(float a, const float4 &b) | friend float4 operator*(float a, const float4 &b) | ||||
| { | { | ||||
| return b * a; | return b * a; | ||||
| } | } | ||||
| static float4 clamp(const float4 &a, const float mn, const float mx) | |||||
| { | |||||
| return float4(std::min(std::max(a.x, mn), mx), | |||||
| std::min(std::max(a.y, mn), mx), | |||||
| std::min(std::max(a.z, mn), mx), | |||||
| std::min(std::max(a.w, mn), mx)); | |||||
| } | |||||
| }; | }; | ||||
| } // namespace blender | } // namespace blender | ||||