mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Issue #659: Add line joins.
Added: love.graphics.setLineJoin(linejoin) linejoin = love.graphics.getLineJoin() where linjoin is one of: - none - miter - bevel Bevel and miter drawing is slightly faster than the 0.8 default (miter), while the `none` join mode will be slower when overdraw is enabled.
This commit is contained in:
+22
-8
@@ -66,17 +66,26 @@ public:
|
||||
|
||||
/**
|
||||
* Normalizes the Vector.
|
||||
* @param length Desired length of the vector.
|
||||
* @return The old length of the Vector.
|
||||
**/
|
||||
float normalize();
|
||||
float normalize(float length = 1.0);
|
||||
|
||||
/**
|
||||
* Gets a normal to the Vector.
|
||||
* Gets a vector perpendicular to the Vector.
|
||||
* To get the true (normalized) normal, use v.getNormal(1.0f / v.getLength())
|
||||
* @return A normal to the Vector.
|
||||
**/
|
||||
|
||||
Vector getNormal() const;
|
||||
|
||||
/**
|
||||
* Gets a vector perpendicular to the Vector.
|
||||
* To get the true (normalized) normal, use v.getNormal(1.0f / v.getLength())
|
||||
* @param Scale factor to apply.
|
||||
* @return A normal to the Vector.
|
||||
**/
|
||||
Vector getNormal(float scale) const;
|
||||
|
||||
/**
|
||||
* Adds a Vector to this Vector.
|
||||
* @param v The Vector we want to add to this Vector.
|
||||
@@ -186,15 +195,20 @@ inline Vector Vector::getNormal() const
|
||||
return Vector(-y, x);
|
||||
}
|
||||
|
||||
inline float Vector::normalize()
|
||||
inline Vector Vector::getNormal(float scale) const
|
||||
{
|
||||
return Vector(-y * scale, x * scale);
|
||||
}
|
||||
|
||||
inline float Vector::normalize(float length)
|
||||
{
|
||||
|
||||
float len = getLength();
|
||||
float length_current = getLength();
|
||||
|
||||
if (len > 0)
|
||||
(*this) /= len;
|
||||
if (length_current > 0)
|
||||
(*this) *= length / length_current;
|
||||
|
||||
return len;
|
||||
return length_current;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user