public Vector4 DecompressVector3(Vector3 v) { Vector4 r = new Vector4(v.X, v.Y, v.Z, 0); float l = r.LengthSq(); if (l == 0) r.W = -1; else if (l > 0 && l < 1.0f) r.W = (float)Math.Sqrt(1f - r.X * r.X - r.Y * r.Y - r.Z * r.Z) * -1f; return r; }