mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibGfx: Add component wise * and / operators to Vector3 and Vector4
This commit is contained in:
parent
b8fd52fad6
commit
077c340ea2
2 changed files with 20 additions and 0 deletions
|
@ -54,6 +54,16 @@ public:
|
|||
return Vector3(m_x - other.m_x, m_y - other.m_y, m_z - other.m_z);
|
||||
}
|
||||
|
||||
constexpr Vector3 operator*(const Vector3& other) const
|
||||
{
|
||||
return Vector3(m_x * other.m_x, m_y * other.m_y, m_z * other.m_z);
|
||||
}
|
||||
|
||||
constexpr Vector3 operator/(const Vector3& other) const
|
||||
{
|
||||
return Vector3(m_x / other.m_x, m_y / other.m_y, m_z / other.m_z);
|
||||
}
|
||||
|
||||
constexpr Vector3 operator*(T f) const
|
||||
{
|
||||
return Vector3(m_x * f, m_y * f, m_z * f);
|
||||
|
|
|
@ -59,6 +59,16 @@ public:
|
|||
return Vector4(m_x - other.m_x, m_y - other.m_y, m_z - other.m_z, m_w - other.m_w);
|
||||
}
|
||||
|
||||
constexpr Vector4 operator*(const Vector4& other) const
|
||||
{
|
||||
return Vector4(m_x * other.m_x, m_y * other.m_y, m_z * other.m_z, m_w * other.m_w);
|
||||
}
|
||||
|
||||
constexpr Vector4 operator/(const Vector4& other) const
|
||||
{
|
||||
return Vector4(m_x / other.m_x, m_y / other.m_y, m_z / other.m_z, m_w / other.m_w);
|
||||
}
|
||||
|
||||
constexpr Vector4 operator*(T f) const
|
||||
{
|
||||
return Vector4(m_x * f, m_y * f, m_z * f, m_w * f);
|
||||
|
|
Loading…
Add table
Reference in a new issue