Helper class for Half conversions and some low level operations. This class is internally used in the Half class.
References: - Fast Half Float Conversions, Jeroen van der Zijp, link: http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf
Esempio n. 1
0
 protected void WriteHalfVector4(WritableSection section, Vector4 v)
 {
     section.Writer.Write(HalfHelpers.SingleToHalf(v.X));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.Y));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.Z));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.W));
 }
Esempio n. 2
0
 protected void WriteHalfVector3As4(WritableSection section, Vector3 v)
 {
     section.Writer.Write(HalfHelpers.SingleToHalf(v.X));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.Y));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.Z));
     section.Writer.Write((ushort)0);
 }
Esempio n. 3
0
        protected Vector2 ReadHalfVector2(GR2Reader reader)
        {
            Vector2 v;

            v.X = HalfHelpers.HalfToSingle(reader.Reader.ReadUInt16());
            v.Y = HalfHelpers.HalfToSingle(reader.Reader.ReadUInt16());
            return(v);
        }
Esempio n. 4
0
        public static Vector3 ReadHalfVector3(GR2Reader reader)
        {
            Vector3 v;

            v.X = HalfHelpers.HalfToSingle(reader.Reader.ReadUInt16());
            v.Y = HalfHelpers.HalfToSingle(reader.Reader.ReadUInt16());
            v.Z = HalfHelpers.HalfToSingle(reader.Reader.ReadUInt16());
            return(v);
        }
Esempio n. 5
0
 public static void WriteHalfVector3(WritableSection section, Vector3 v)
 {
     section.Writer.Write(HalfHelpers.SingleToHalf(v.X));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.Y));
     section.Writer.Write(HalfHelpers.SingleToHalf(v.Z));
 }