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
예제 #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));
 }
예제 #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);
 }
예제 #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);
        }
예제 #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);
        }
예제 #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));
 }