コード例 #1
0
        /// <summary>
        /// Encode a block of signed values.
        /// </summary>
        /// <returns></returns>
        public BC4SBlock EncodeSigned()
        {
            //load the input and scan for the boundary condition

            ClampAndFindRange(-1F, 1F);

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

            //find a span across the space

            float r0, r1;

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

            //roundtrip it through integer format

            var ret = new BC4SBlock();

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

            ret.GetPalette(interpValues);

            ret.PackedValue |= FindClosest();

            return(ret);
        }
コード例 #2
0
ファイル: BC4BlockEncoder.cs プロジェクト: pdjonov/BCn
        /// <summary>
        /// Encode a block of signed values.
        /// </summary>
        /// <returns></returns>
        public BC4SBlock EncodeSigned()
        {
            //load the input and scan for the boundary condition

            ClampAndFindRange( -1F, 1F );

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

            //find a span across the space

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

            //roundtrip it through integer format

            var ret = new BC4SBlock();

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

            ret.GetPalette( interpValues );

            ret.PackedValue |= FindClosest();

            return ret;
        }