示例#1
0
        /// <summary>
        /// Encode a block of unsigned values.
        /// </summary>
        /// <returns></returns>
        public BC4UBlock EncodeUnsigned()
        {
            //load the input and scan for the boundary condition

            ClampAndFindRange(0F, 1F);

            bool hasEndPoint = minValue == 0F || maxValue == 1F;

            //find a span across the space

            float r0, r1;

            SpanValues(out r0, out r1, hasEndPoint, false);

            //roundtrip it through integer format

            var ret = new BC4UBlock();

            ret.R0 = Helpers.FloatToUNorm(r0);
            ret.R1 = Helpers.FloatToUNorm(r1);

            ret.GetPalette(interpValues);

            ret.PackedValue |= FindClosest();

            return(ret);
        }
示例#2
0
        /// <summary>
        /// Encode a block of unsigned values.
        /// </summary>
        /// <returns></returns>
        public BC4UBlock EncodeUnsigned()
        {
            //load the input and scan for the boundary condition

            ClampAndFindRange( 0F, 1F );

            bool hasEndPoint = minValue == 0F || maxValue == 1F;

            //find a span across the space

            float r0, r1;
            SpanValues( out r0, out r1, hasEndPoint, false );

            //roundtrip it through integer format

            var ret = new BC4UBlock();

            ret.R0 = Helpers.FloatToUNorm( r0 );
            ret.R1 = Helpers.FloatToUNorm( r1 );

            ret.GetPalette( interpValues );

            ret.PackedValue |= FindClosest();

            return ret;
        }