Rewrite ThrowsParticle using world coordinates.

The old dynamics were crazy, so this implements
a simpler model using a cubic lerp.
This commit is contained in:
Paul Chote
2013-04-01 12:23:41 +13:00
parent 7b54bbf0b2
commit be250bca76
7 changed files with 57 additions and 81 deletions

View File

@@ -26,8 +26,11 @@ namespace OpenRA
public static readonly WVec Zero = new WVec(0, 0, 0);
public static WVec operator +(WVec a, WVec b) { return new WVec(a.X + b.X, a.Y + b.Y, a.Z + b.Z); }
public static WVec operator -(WVec a, WVec b) { return new WVec(a.X - b.X, a.Y - b.Y, a.Y - b.Y); }
public static WVec operator -(WVec a, WVec b) { return new WVec(a.X - b.X, a.Y - b.Y, a.Z - b.Z); }
public static WVec operator -(WVec a) { return new WVec(-a.X, -a.Y, -a.Z); }
public static WVec operator /(WVec a, int b) { return new WVec(a.X / b, a.Y / b, a.Z / b); }
public static WVec operator *(int a, WVec b) { return new WVec(a * b.X, a * b.Y, a * b.Z); }
public static WVec operator *(WVec a, int b) { return b*a; }
public static bool operator ==(WVec me, WVec other) { return (me.X == other.X && me.Y == other.Y && me.Z == other.Z); }
public static bool operator !=(WVec me, WVec other) { return !(me == other); }
@@ -48,6 +51,8 @@ namespace OpenRA
(int)((lx * mtx[2] + ly*mtx[6] + lz*mtx[10]) / mtx[15]));
}
public static WVec Lerp(WVec a, WVec b, int mul, int div) { return a + (b - a) * mul / div; }
public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); }
public override bool Equals(object obj)