示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4());
示例#6
0
 public void PackFromRgba64(Rgba64 source)
 {
     PackFromScaledVector4(source.ToScaledVector4());
 }