예제 #1
0
 public void Serialize(SerializingContainer Container)
 {
     //Sections
     int count = 0;
     if (!Container.isLoading)
         count = Sections.Count();
     count = Container + count;
     if (Container.isLoading)
     {
         Sections = new List<SectionStruct>();
         for (int i = 0; i < count; i++)
             Sections.Add(new SectionStruct());
     }
     for (int i = 0; i < count; i++)
     {
         SectionStruct sec = Sections[i];
         sec.Serialize(Container);
         Sections[i] = sec;
     }
     //IndexBuffer
     if (Container.isLoading)
         IndexBuffer = new MultiSizeIndexContainerStruct();
     IndexBuffer.Serialize(Container);
     //Active Bones
     if (!Container.isLoading)
         count = ActiveBones.Count();
     count = Container + count;
     if (Container.isLoading)
     {
         ActiveBones = new List<ushort>();
         for (int i = 0; i < count; i++)
             ActiveBones.Add(0);
     }
     for (int i = 0; i < count; i++)
         ActiveBones[i] = Container + ActiveBones[i];
     //Chunks
     if (!Container.isLoading)
         count = Chunks.Count();
     count = Container + count;
     if (Container.isLoading)
     {
         Chunks = new List<SkelMeshChunkStruct>();
         for (int i = 0; i < count; i++)
             Chunks.Add(new SkelMeshChunkStruct());
     }
     for (int i = 0; i < count; i++)
     {
         SkelMeshChunkStruct c = Chunks[i];
         c.Serialize(Container);
         Chunks[i] = c;
     }
     //Size
     Size = Container + Size;
     //NumVertices
     NumVertices = Container + NumVertices;
     //RequiredBones
     if (!Container.isLoading)
         count = RequiredBones.Count();
     count = Container + count;
     if (Container.isLoading)
     {
         RequiredBones = new List<byte>();
         for (int i = 0; i < count; i++)
             RequiredBones.Add(0);
     }
     for (int i = 0; i < count; i++)
         RequiredBones[i] = Container + RequiredBones[i];
     //RawPointIndicesFlag
     RawPointIndicesFlag = Container + RawPointIndicesFlag;
     //RawPointIndicesCount
     RawPointIndicesCount = Container + RawPointIndicesCount;
     //RawPointIndicesSize
     RawPointIndicesSize = Container + RawPointIndicesSize;
     //RawPointIndicesOffset
     RawPointIndicesOffset = Container + RawPointIndicesOffset;
     //RawPointIndices
     if (Container.isLoading)
     {
         RawPointIndices = new List<int>();
         for (int i = 0; i < RawPointIndicesCount; i++)
             RawPointIndices.Add(0);
     }
     for (int i = 0; i < RawPointIndicesCount; i++)
         RawPointIndices[i] = Container + RawPointIndices[i];
     //NumTexCoords
     NumTexCoords = Container + NumTexCoords;
     //VertexBufferGPUSkin
     if (Container.isLoading)
         VertexBufferGPUSkin = new VertexBufferGPUSkinStruct();
     VertexBufferGPUSkin.Serialize(Container);
     //unknown stuff
     Unk1 = Container + Unk1;
     Unk2 = Container + Unk2;
     Unk3 = Container + Unk3;
     //GPU index buffer
     IndexSize = Container + IndexSize;
     if (!Container.isLoading)
         count = IndexBufferGPUSkin.Count();
     count = Container + count;
     if (Container.isLoading)
     {
         IndexBufferGPUSkin = new List<ushort>();
         for (int i = 0; i < count; i++)
             IndexBufferGPUSkin.Add(0);
     }
     for (int i = 0; i < count; i++)
         IndexBufferGPUSkin[i] = Container + IndexBufferGPUSkin[i];
 }
예제 #2
0
            public void Serialize(SerializingContainer Container)
            {
                //Sections
                int count = 0;

                if (!Container.isLoading)
                {
                    count = Sections.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    Sections = new List <SectionStruct>();
                    for (int i = 0; i < count; i++)
                    {
                        Sections.Add(new SectionStruct());
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    SectionStruct sec = Sections[i];
                    sec.Serialize(Container);
                    Sections[i] = sec;
                }
                //IndexBuffer
                if (Container.isLoading)
                {
                    IndexBuffer = new MultiSizeIndexContainerStruct();
                }
                IndexBuffer.Serialize(Container);
                //Active Bones
                if (!Container.isLoading)
                {
                    count = ActiveBones.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    ActiveBones = new List <ushort>();
                    for (int i = 0; i < count; i++)
                    {
                        ActiveBones.Add(0);
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    ActiveBones[i] = Container + ActiveBones[i];
                }
                //Chunks
                if (!Container.isLoading)
                {
                    count = Chunks.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    Chunks = new List <SkelMeshChunkStruct>();
                    for (int i = 0; i < count; i++)
                    {
                        Chunks.Add(new SkelMeshChunkStruct());
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    SkelMeshChunkStruct c = Chunks[i];
                    c.Serialize(Container);
                    Chunks[i] = c;
                }
                //Size
                Size = Container + Size;
                //NumVertices
                NumVertices = Container + NumVertices;
                //RequiredBones
                if (!Container.isLoading)
                {
                    count = RequiredBones.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    RequiredBones = new List <byte>();
                    for (int i = 0; i < count; i++)
                    {
                        RequiredBones.Add(0);
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    RequiredBones[i] = Container + RequiredBones[i];
                }
                //RawPointIndicesFlag
                RawPointIndicesFlag = Container + RawPointIndicesFlag;
                //RawPointIndicesCount
                RawPointIndicesCount = Container + RawPointIndicesCount;
                //RawPointIndicesSize
                RawPointIndicesSize = Container + RawPointIndicesSize;
                //RawPointIndicesOffset
                RawPointIndicesOffset = Container + RawPointIndicesOffset;
                //RawPointIndices
                if (Container.isLoading)
                {
                    RawPointIndices = new List <int>();
                    for (int i = 0; i < RawPointIndicesCount; i++)
                    {
                        RawPointIndices.Add(0);
                    }
                }
                for (int i = 0; i < RawPointIndicesCount; i++)
                {
                    RawPointIndices[i] = Container + RawPointIndices[i];
                }
                //NumTexCoords
                NumTexCoords = Container + NumTexCoords;
                //VertexBufferGPUSkin
                if (Container.isLoading)
                {
                    VertexBufferGPUSkin = new VertexBufferGPUSkinStruct();
                }
                VertexBufferGPUSkin.Serialize(Container);
                //unknown stuff
                Unk1 = Container + Unk1;
                Unk2 = Container + Unk2;
                Unk3 = Container + Unk3;
                //GPU index buffer
                IndexSize = Container + IndexSize;
                if (!Container.isLoading)
                {
                    count = IndexBufferGPUSkin.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    IndexBufferGPUSkin = new List <ushort>();
                    for (int i = 0; i < count; i++)
                    {
                        IndexBufferGPUSkin.Add(0);
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    IndexBufferGPUSkin[i] = Container + IndexBufferGPUSkin[i];
                }
            }
예제 #3
0
            public void Serialize(SerializingContainer Container, MEVersion version)
            {
                //Sections
                int count = 0;

                if (!Container.isLoading)
                {
                    count = Sections.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    Sections = new List <SectionStruct>();
                    for (int i = 0; i < count; i++)
                    {
                        Sections.Add(new SectionStruct());
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    SectionStruct sec = Sections[i];
                    sec.Serialize(Container, version);
                    Sections[i] = sec;
                }
                //IndexBuffer
                if (Container.isLoading)
                {
                    IndexBuffer = new MultiSizeIndexContainerStruct();
                }
                IndexBuffer.Serialize(Container);
                //unk1
                Unk1 = Container + Unk1;
                if (Unk1 > 0)
                {
                    ushort[] indices = new ushort[Unk1];
                    for (int i = 0; i < Unk1; i++)
                    {
                        indices[i] = Container + indices[i];
                    }
                }
                //Active Bones
                int activeBonesCount = 0;

                if (!Container.isLoading)
                {
                    activeBonesCount = (short)ActiveBones.Count();
                }
                activeBonesCount = Container + activeBonesCount;
                if (Container.isLoading)
                {
                    ActiveBones = new List <ushort>();
                    for (int i = 0; i < activeBonesCount; i++)
                    {
                        ActiveBones.Add(0);
                    }
                }
                for (int i = 0; i < activeBonesCount; i++)
                {
                    ActiveBones[i] = Container + ActiveBones[i];
                }
                //unk2
                Unk2 = Container + Unk2;
                if (Unk2 > 0)
                {
                    byte[] f74 = new byte[Unk2];
                    for (int i = 0; i < Unk2; i++)
                    {
                        f74[i] = Container + f74[i];
                    }
                }
                //Chunks
                if (!Container.isLoading)
                {
                    count = Chunks.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    Chunks = new List <SkelMeshChunkStruct>();
                    for (int i = 0; i < count; i++)
                    {
                        Chunks.Add(new SkelMeshChunkStruct());
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    SkelMeshChunkStruct c = Chunks[i];
                    c.Serialize(Container);
                    Chunks[i] = c;
                }
                //Size
                Size = Container + Size;
                //NumVertices
                NumVertices = Container + NumVertices;
                //unk3
                Unk3 = Container + Unk3;
                if (Unk3 > 0)
                {
                    for (int i = 0; i < Unk3; i++)
                    {
                        int[] fedge3 = new int[4];
                        fedge3[0] = Container + fedge3[0];
                        fedge3[1] = Container + fedge3[1];
                        fedge3[2] = Container + fedge3[2];
                        fedge3[3] = Container + fedge3[3];
                    }
                }
                //RequiredBones (f24)
                if (!Container.isLoading)
                {
                    count = RequiredBones.Count();
                }
                count = Container + count;
                if (Container.isLoading)
                {
                    RequiredBones = new List <byte>();
                    for (int i = 0; i < count; i++)
                    {
                        RequiredBones.Add(0);
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    RequiredBones[i] = Container + RequiredBones[i];
                }
                //RawPointIndicesFlag
                RawPointIndicesFlag = Container + RawPointIndicesFlag;
                //RawPointIndicesCount
                RawPointIndicesCount = Container + RawPointIndicesCount;
                RawPointIndices      = new List <ushort>();
                if (RawPointIndicesCount > 0)
                {
                    //RawPointIndices
                    if (Container.isLoading)
                    {
                        for (int i = 0; i < RawPointIndicesCount; i++)
                        {
                            RawPointIndices.Add(0);
                        }
                    }
                    for (int i = 0; i < RawPointIndicesCount; i++)
                    {
                        RawPointIndices[i] = Container + RawPointIndices[i];
                    }
                }
                //RawPointIndicesSize
                RawPointIndicesSize = Container + RawPointIndicesSize;
                //RawPointIndicesOffset
                RawPointIndicesOffset = Container + RawPointIndicesOffset;

                //VertexBufferGPUSkin
                if (Container.isLoading)
                {
                    VertexBufferGPUSkin = new VertexBufferGPUSkinStruct();
                }

                VertexBufferGPUSkin.Serialize(Container, version);

                //unk4
                Unk4 = Container + Unk4;
            }