Example #1
0
 public void Load(BinaryReader reader)
 {
     name     = MBUtil.LoadString(reader);
     flags    = MBUtil.LoadUInt32(reader);
     shader   = MBUtil.LoadString(reader);
     diffuseA = MBUtil.LoadString(reader);
     diffuseB = MBUtil.LoadString(reader);
     bump     = MBUtil.LoadString(reader);
     enviro   = MBUtil.LoadString(reader);
     spec     = MBUtil.LoadStringMaybe(reader, "none");
     specular = MBUtil.LoadFloat(reader);
     r        = MBUtil.LoadFloat(reader);
     g        = MBUtil.LoadFloat(reader);
     b        = MBUtil.LoadFloat(reader);
 }
Example #2
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));
                }
            }
        }
Example #3
0
 public void Load(BinaryReader reader)
 {
     vindex = MBUtil.LoadInt32(reader);
     weight = MBUtil.LoadFloat(reader);
 }