/// <summary> /// Unpacks Vector3 from Vector3UByte, scales vector from (0, 255) to (-range, range) /// </summary> public static Vector3 Denormalize(Vector3UByte vec, float range) { float epsilon = 0.5f / 255.0f; return((new Vector3(vec.X, vec.Y, vec.Z) / 255.0f - new Vector3(0.5f - epsilon)) * 2 * range); }
/// <summary> /// Returns true when all components are 127 /// </summary> public static bool IsMiddle(Vector3UByte vec) { return(vec.X == 127 && vec.Y == 127 && vec.Z == 127); }
public static Vector3 Denormalize(Vector3UByte vec, float range) { float num = 0.001960784f; return((Vector3)((((new Vector3((float)vec.X, (float)vec.Y, (float)vec.Z) / 255f) - new Vector3(0.5f - num)) * 2f) * range)); }
static Vector3UByte() { Comparer = new EqualityComparer(); Zero = new Vector3UByte(0, 0, 0); m_clampBoundary = new Vector3(255f); }
public static bool IsMiddle(Vector3UByte vec) => (((vec.X == 0x7f) && (vec.Y == 0x7f)) && (vec.Z == 0x7f));