Ejemplo n.º 1
0
        public void ReadRawTris(byte[] memory)
        {
            UnknownList l = new UnknownList();

            l.size     = BitConverter.ToInt32(memory, readerpos);
            l.count    = BitConverter.ToInt32(memory, readerpos + 4);
            readerpos += 8;
            int len = l.size * l.count;

            l.data = new byte[len];
            for (int i = 0; i < len; i++)
            {
                l.data[i] = memory[readerpos + i];
            }
            RawTriangles = new List <RawTriangle>();
            for (int i = 0; i < l.count; i++)
            {
                RawTriangle r = new RawTriangle();
                r.v0  = BitConverter.ToInt16(memory, readerpos);
                r.v1  = BitConverter.ToInt16(memory, readerpos + 2);
                r.v2  = BitConverter.ToInt16(memory, readerpos + 4);
                r.mat = BitConverter.ToInt16(memory, readerpos + 6);
                RawTriangles.Add(r);
                string s = "";
                for (int j = 0; j < l.size; j++)
                {
                    s += memory[readerpos].ToString("X2") + " ";
                    readerpos++;
                }
            }
            RawTris rt = new RawTris();

            rt.RawTriangles = RawTriangles;
            Mesh.RawTris    = rt;
        }
Ejemplo n.º 2
0
 public void ReadRawTris(byte[] memory)
 {
     TreeNode res = new TreeNode("Raw triangles pos: 0x" + readerpos.ToString("X4"));
     UnknownList l = new UnknownList();
     l.size = BitConverter.ToInt32(memory, readerpos);
     l.count = BitConverter.ToInt32(memory, readerpos + 4);
     readerpos += 8;
     int len = l.size * l.count;
     l.data = new byte[len];
     for (int i = 0; i < len; i++)
         l.data[i] = memory[readerpos + i];
     res.Nodes.Add(new TreeNode("Size : " + l.size.ToString()));
     res.Nodes.Add(new TreeNode("Count : " + l.count.ToString()));
     TreeNode t = new TreeNode("Data");
     RawTriangles = new List<RawTriangle>();
     for (int i = 0; i < l.count; i++)
     {
         RawTriangle r = new RawTriangle();
         r.v0 = BitConverter.ToInt16(memory, readerpos);
         r.v1 = BitConverter.ToInt16(memory, readerpos + 2);
         r.v2 = BitConverter.ToInt16(memory, readerpos + 4);
         r.mat = BitConverter.ToInt16(memory, readerpos + 6);
         RawTriangles.Add(r);
         string s = "";
         for (int j = 0; j < l.size; j++)
         {
             s += memory[readerpos].ToString("X2") + " ";
             readerpos++;
         }
         t.Nodes.Add(new TreeNode("#" + i.ToString("D4") + " : " + s));
     }
     res.Nodes.Add(t);
     RawTris rt = new RawTris();
     rt.RawTriangles = RawTriangles;
     rt.t = res;
     Mesh.RawTris = rt;
 }
Ejemplo n.º 3
0
 public void ReadRawTris(byte[] memory)
 {
     UnknownList l = new UnknownList();
     l.size = BitConverter.ToInt32(memory, readerpos);
     l.count = BitConverter.ToInt32(memory, readerpos + 4);
     readerpos += 8;
     int len = l.size * l.count;
     l.data = new byte[len];
     for (int i = 0; i < len; i++)
         l.data[i] = memory[readerpos + i];
     RawTriangles = new List<RawTriangle>();
     for (int i = 0; i < l.count; i++)
     {
         RawTriangle r = new RawTriangle();
         r.v0 = BitConverter.ToInt16(memory, readerpos);
         r.v1 = BitConverter.ToInt16(memory, readerpos + 2);
         r.v2 = BitConverter.ToInt16(memory, readerpos + 4);
         r.mat = BitConverter.ToInt16(memory, readerpos + 6);
         RawTriangles.Add(r);
         string s = "";
         for (int j = 0; j < l.size; j++)
         {
             s += memory[readerpos].ToString("X2") + " ";
             readerpos++;
         }
     }
     RawTris rt = new RawTris();
     rt.RawTriangles = RawTriangles;
     Mesh.RawTris = rt;
 }