/// <summary>
        /// Reads a half precision Single written using WriteHalfPrecision(float)
        /// </summary>
        public static float ReadHalfPrecisionSingle(this NetBuffer message)
        {
            HalfSingle h = new HalfSingle();

            h.PackedValue = message.ReadUInt16();
            return(h.ToSingle());
        }
예제 #2
0
        /// <summary>
        /// Writes a Vector3 at half precision
        /// </summary>
        public static Vector3 ReadHalfPrecisionVector3(this NetBuffer message)
        {
            HalfSingle hx = new HalfSingle();
            hx.PackedValue = message.ReadUInt16();

            HalfSingle hy = new HalfSingle();
            hy.PackedValue = message.ReadUInt16();

            HalfSingle hz = new HalfSingle();
            hz.PackedValue = message.ReadUInt16();

            Vector3 retval;
            retval.X = hx.ToSingle();
            retval.Y = hy.ToSingle();
            retval.Z = hz.ToSingle();
            return retval;
        }
        /// <summary>
        /// Writes a Vector3 at half precision
        /// </summary>
        public static Vector3 ReadHalfPrecisionVector3(this NetBuffer message)
        {
            HalfSingle hx = new HalfSingle();

            hx.PackedValue = message.ReadUInt16();

            HalfSingle hy = new HalfSingle();

            hy.PackedValue = message.ReadUInt16();

            HalfSingle hz = new HalfSingle();

            hz.PackedValue = message.ReadUInt16();

            Vector3 retval;

            retval.x = hx.ToSingle();
            retval.y = hy.ToSingle();
            retval.z = hz.ToSingle();
            return(retval);
        }
 /// <summary>
 /// Reads a half precision Single written using WriteHalfPrecision(float)
 /// </summary>
 public static float ReadHalfPrecisionSingle(this NetIncomingMessage message)
 {
     HalfSingle h = new HalfSingle();
     h.PackedValue = message.ReadUInt16();
     return h.ToSingle();
 }