+
+ ax = (1.0f / VectorLength(left));
+ ay = (1.0f / VectorLength(up));
+ // Using the placement below the distance of a sprite is
+ // real dist = sqrt(d*d + dfxa*dfxa + dgyb*dgyb)
+ // d is the distance we use
+ // f is frustum X
+ // x is x
+ // a is ax
+ // g is frustum Y
+ // y is y
+ // b is ay
+
+ // real dist (r) shall be d, so
+ // r*r = d*d + dfxa*dfxa + dgyb*dgyb
+ // r*r = d*d * (1 + fxa*fxa + gyb*gyb)
+ // d*d = r*r / (1 + fxa*fxa + gyb*gyb)
+ // d = sqrt(r*r / (1 + fxa*fxa + gyb*gyb))
+ // thus:
+ distance = sqrt((distance*distance) / (1.0 +
+ r_view.frustum_x*r_view.frustum_x * x*x * ax*ax +
+ r_view.frustum_y*r_view.frustum_y * y*y * ay*ay));
+ // ^ the one we want ^ the one we have ^ our factors