Ejemplo n.º 1
0
        public static IO.EndianStream StreamMatrix(IO.EndianStream s, ref BMatrix matrix)
        {
            if (s.StreamCond(matrix, m => !m.IsIdentity))
            {
                BVector
                    forward     = matrix.GetRow1(),
                    right       = matrix.GetRow2(),
                    up          = matrix.GetRow3(),
                    translation = matrix.GetRow4();

                s.StreamV(ref forward);
                s.StreamV(ref right);
                s.StreamV(ref up);
                s.StreamV(ref translation);

                if (s.IsReading)
                {
                    matrix.SetRow1(forward);
                    matrix.SetRow2(right);
                    matrix.SetRow3(up);
                    matrix.SetRow4(translation);
                }
            }

            return(s);
        }