public void Rgba64_ToScaledVector4() { // arrange var short2 = new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue); // act Vector4 actual = short2.ToScaledVector4(); // assert Assert.Equal(1, actual.X); Assert.Equal(1, actual.Y); Assert.Equal(1, actual.Z); Assert.Equal(1, actual.W); }
public void Rgba64_FromScaledVector4(ushort r, ushort g, ushort b, ushort a) { // arrange var source = new Rgba64(r, g, b, a); // act Vector4 scaled = source.ToScaledVector4(); Rgba64 actual = default; actual.FromScaledVector4(scaled); // assert Assert.Equal(source, actual); }
public void Rgba64_FromScaledVector4() { // arrange var pixel = default(Rgba64); var short4 = new Rgba64(ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue); const ulong expected = 0xFFFFFFFFFFFFFFFF; // act Vector4 scaled = short4.ToScaledVector4(); pixel.FromScaledVector4(scaled); ulong actual = pixel.PackedValue; // assert Assert.Equal(expected, actual); }
public void Rgba64_ToScaledVector4(ushort r, ushort g, ushort b, ushort a) { // arrange var short2 = new Rgba64(r, g, b, a); float max = ushort.MaxValue; float rr = r / max; float gg = g / max; float bb = b / max; float aa = a / max; // act Vector4 actual = short2.ToScaledVector4(); // assert Assert.Equal(rr, actual.X); Assert.Equal(gg, actual.Y); Assert.Equal(bb, actual.Z); Assert.Equal(aa, actual.W); }
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4());
public void PackFromRgba64(Rgba64 source) { PackFromScaledVector4(source.ToScaledVector4()); }