/// <summary> /// Expands the HalfVector2 to a Vector2. /// </summary> public Vector2 ToVector2() { Vector2 vector2; vector2.X = HalfUtils.Unpack((ushort)this.packedValue); vector2.Y = HalfUtils.Unpack((ushort)(this.packedValue >> 16)); return(vector2); }
/// <summary> /// Expands the packed representation into a Vector4. /// </summary> public Vector4 ToVector4() { Vector4 vector4; vector4.X = HalfUtils.Unpack((ushort)this.packedValue); vector4.Y = HalfUtils.Unpack((ushort)(this.packedValue >> 16)); vector4.Z = HalfUtils.Unpack((ushort)(this.packedValue >> 32)); vector4.W = HalfUtils.Unpack((ushort)(this.packedValue >> 48)); return(vector4); }
private static uint PackHelper(float vectorX, float vectorY) { return((uint)HalfUtils.Pack(vectorX) | (uint)HalfUtils.Pack(vectorY) << 16); }
private static ulong PackHelper(float vectorX, float vectorY, float vectorZ, float vectorW) { return((ulong)HalfUtils.Pack(vectorX) | (ulong)HalfUtils.Pack(vectorY) << 16 | (ulong)HalfUtils.Pack(vectorZ) << 32 | (ulong)HalfUtils.Pack(vectorW) << 48); }