예제 #1
0
        public static uint PackSNorm(uint bitmask, float value)
        {
            float max = (float)(bitmask >> 1);

            value *= max;
            return((uint)(int)PackUtils.ClampAndRound(value, -max, max) & bitmask);
        }
예제 #2
0
        public static uint PackSigned(uint bitmask, float value)
        {
            float max = (float)(bitmask >> 1);
            float min = (float)(-(double)max - 1.0);

            return((uint)(int)PackUtils.ClampAndRound(value, min, max) & bitmask);
        }
예제 #3
0
 public static uint PackUnsigned(float bitmask, float value)
 {
     return((uint)PackUtils.ClampAndRound(value, 0.0f, bitmask));
 }
예제 #4
0
 public static uint PackUNorm(float bitmask, float value)
 {
     value *= bitmask;
     return((uint)PackUtils.ClampAndRound(value, 0.0f, bitmask));
 }