Ejemplo n.º 1
0
 public void Load(BinaryReader reader)
 {
     if (globalVersion == 0)
     {
         index  = MBUtil.LoadInt32(reader);
         col    = MBUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBUtil.LoadPoint3F(reader);
         ta     = MBUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = MBUtil.LoadPoint2F(reader);
         tb.Y   = 1 - tb.Y;
     }
     else if (globalVersion == 1)
     {
         index  = MBUtil.LoadInt32(reader);
         col    = MBUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBUtil.LoadPoint3F(reader);
         tang   = MBUtil.LoadPoint3F(reader);
         tangi  = MBUtil.LoadByte(reader);
         ta     = MBUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = ta;
     }
     else if (globalVersion == 2)
     {
         index  = MBUtil.LoadInt32(reader);
         col    = MBUtil.LoadUInt32(reader);              // color x vert! as 4 bytes AABBGGRR
         __norm = MBUtil.LoadPoint3F(reader);
         ta     = MBUtil.LoadPoint2F(reader);
         ta.Y   = 1 - ta.Y;
         tb     = ta;
     }
 }
Ejemplo n.º 2
0
 //private List<int> next;
 public void Load(BinaryReader reader)
 {
     attach = MBUtil.LoadInt32(reader);
     if (!string.IsNullOrEmpty(MBUtil.LoadStringMaybe(reader, "bone")))
     {
         b = MBUtil.LoadInt32(reader);
     }
     x = MBUtil.LoadPoint3F(reader);
     y = MBUtil.LoadPoint3F(reader);
     z = MBUtil.LoadPoint3F(reader);
     t = MBUtil.LoadPoint3F(reader);
 }
Ejemplo n.º 3
0
 public void Load(BinaryReader reader)
 {
     findex = MBUtil.LoadInt32(reader);
     rot    = MBUtil.LoadPoint3F(reader);
 }
Ejemplo n.º 4
0
        public void Load(BinaryReader reader, string str = null)
        {
            string firstWord = null;

            if (string.IsNullOrEmpty(str))
            {
                firstWord = MBUtil.LoadString(reader);
            }
            else
            {
                faces     = new List <List <int> >();
                firstWord = str;
                if (firstWord == "manifold")
                {
                    type = Type.MANIFOLD;

                    MBUtil.LoadVector(reader, ref pos);

                    int k = MBUtil.LoadInt32(reader);
                    for (int i = 0; i < k; i++)
                    {
                        ori = MBUtil.LoadInt32(reader);
                        int        h = MBUtil.LoadInt32(reader);
                        List <int> v = new List <int>();
                        for (int j = 0; j < h; j++)
                        {
                            int pp = MBUtil.LoadInt32(reader);
                            v.Add(pp);
                        }
                        faces.Add(v);
                    }
                }
                else if (firstWord == "capsule")
                {
                    type   = Type.CAPSULE;
                    radius = MBUtil.LoadFloat(reader);
                    center = MBUtil.LoadPoint3F(reader);
                    dir    = MBUtil.LoadPoint3F(reader);
                    flags  = MBUtil.LoadUInt32(reader);
                }
                else if (firstWord == "sphere")
                {
                    type   = Type.SPHERE;
                    radius = MBUtil.LoadFloat(reader);
                    center = MBUtil.LoadPoint3F(reader);
                    flags  = MBUtil.LoadUInt32(reader);
                }
                else if (firstWord == "face")
                {
                    type = Type.FACE;
                    MBUtil.LoadVector(reader, ref pos);

                    int        k     = pos.Count;
                    List <int> aface = new List <int>();
                    for (int i = 0; i < k; i++)
                    {
                        aface.Add(i);
                    }
                    faces.Add(aface);

                    flags = MBUtil.LoadUInt32(reader);
                }
                else
                {
                    Console.WriteLine(string.Format("Unknown body (collision mesh) type `{0}`\n", firstWord));
                }
            }
        }