Beispiel #1
0
 public VPXY(BinaryReader br)
 {
     rcolVersion = br.ReadInt32();
     rcolCount   = br.ReadInt32();
     index3      = br.ReadInt32();
     extCount    = br.ReadInt32();
     intCount    = br.ReadInt32();
     if (intCount > 0)
     {
         intITG = new ITG[intCount];
     }
     for (int i = 0; i < intCount; i++)
     {
         intITG[i] = new ITG(br);
     }
     if (extCount > 0)
     {
         extITG = new ITG[extCount];
     }
     for (int i = 0; i < extCount; i++)
     {
         extITG[i] = new ITG(br);
     }
     chunkPos  = br.ReadInt32();
     chunkSize = br.ReadInt32();
     magic     = new char[4];
     magic     = br.ReadChars(4);
     version   = br.ReadInt32();
     tgiOffset = br.ReadInt32();
     tgiSize   = br.ReadInt32();
     count     = br.ReadByte();
     entries   = new Entry[count];
     for (int i = 0; i < count; i++)
     {
         entries[i] = new Entry(br);
     }
     boxType     = br.ReadByte();
     boundingBox = new float[6];
     for (int i = 0; i < 6; i++)
     {
         boundingBox[i] = br.ReadSingle();
     }
     unknown = br.ReadUInt32();
     flag    = br.ReadByte();
     if (flag == 1)
     {
         ftptIndex = br.ReadInt32();
     }
     if (tgiSize > 0)
     {
         tgiCount = br.ReadInt32();
         tgiList  = new TGI[tgiCount];
         for (int i = 0; i < tgiCount; i++)
         {
             tgiList[i] = new TGI(br);
         }
     }
     else
     {
         tgiCount = 0;
         tgiList  = new TGI[0];
     }
 }
Beispiel #2
0
 public VPXY(TGI tgi, TGI[] boneTGIs, TGI[][] geomTGIs)
 {
     if (geomTGIs.GetLength(0) != 4)
     {
         throw new ApplicationException("First dimension of LOD TGIs must be 4!");
     }
     rcolVersion = 3;
     rcolCount   = 1;
     index3      = 0;
     extCount    = 0;
     intCount    = 1;
     intITG      = new ITG[1];
     intITG[0]   = new ITG(tgi.Instance, tgi.Type, tgi.Group);
     chunkPos    = 44;
     chunkSize   = 141;
     magic       = new char[4] {
         'V', 'P', 'X', 'Y'
     };
     version  = 4;
     count    = 0;
     tgiCount = 0;
     for (int i = 0; i < boneTGIs.Length; i++)
     {
         count++;
         tgiCount++;
     }
     for (int i = 0; i < geomTGIs.GetLength(0); i++)
     {
         for (int j = 0; j < geomTGIs[i].Length; j++)
         {
             tgiCount++;
         }
         if (geomTGIs[i].Length > 0)
         {
             count++;
         }
     }
     boxType     = 2;
     boundingBox = new float[6] {
         0f, 0f, 0f, 0f, 0f, 0f
     };
     unknown = 0;
     flag    = 0;
     entries = new Entry[count];
     tgiList = new TGI[tgiCount];
     if (count > 0)
     {
         int counterTGI = 0;
         int counterEnt = 0;
         for (int i = 0; i < boneTGIs.Length; i++)
         {
             entries[counterEnt] = new Entry(counterTGI);
             tgiList[counterTGI] = new TGI(boneTGIs[i].Type, boneTGIs[i].Group, boneTGIs[i].Instance);
             counterEnt++;
             counterTGI++;
         }
         for (int i = 0; i < 4; i++)
         {
             List <int> tmp = new List <int>();
             for (int j = 0; j < geomTGIs[i].Length; j++)
             {
                 tmp.Add(counterTGI);
                 tgiList[counterTGI] = new TGI(geomTGIs[i][j].Type, geomTGIs[i][j].Group, geomTGIs[i][j].Instance);
                 counterTGI++;
             }
             if (tmp.Count > 0)
             {
                 entries[counterEnt] = new Entry(i, tmp.ToArray());
                 counterEnt++;
             }
         }
         // for (int i = 3; i >= 0; i--)
         // {
         //     for (int j = 0; j < geomTGIs[i].Length; j++)
         //     {
         //         entries[counter] = new Entry(i, counter);
         //         tgiList[counter] = new TGI(geomTGIs[i][j].Type, geomTGIs[i][j].Group, geomTGIs[i][j].Instance);
         //         counter++;
         //     }
         // }
     }
     tgiOffset = 35;
     foreach (Entry e in this.entries)
     {
         tgiOffset += e.Size;
     }
     tgiSize = (tgiCount * 16) + 4;
 }