예제 #1
0
            public ModelTag(IndexEntry entry)
            {
                //Prepare
                using (BinaryReader reader = entry.TagData.CreateReader())
                {
                    //Goto
                    entry.TagData.Seek(entry.Offset, SeekOrigin.Begin);

                    //Read Tag Header
                    Header = reader.Read <ModelTagGroup>();

                    //Read Compression Information
                    if (Header.CompressionInfos.Count > 0)
                    {
                        CompressionInfo = new ComponentCompression();
                        entry.TagData.Seek(Header.CompressionInfos.Offset, SeekOrigin.Begin);
                        CompressionInfo = reader.Read <ComponentCompression>();
                    }

                    //Read Regions
                    Regions = new ModelTagGroup.Region[Header.Regions.Count];
                    entry.TagData.Seek(Header.Regions.Offset, SeekOrigin.Begin);
                    for (int i = 0; i < Header.Regions.Count; i++)
                    {
                        Regions[i] = reader.Read <ModelTagGroup.Region>();
                    }

                    //Read Perumtations
                    Permutations = new ModelTagGroup.Region.Permutation[Header.Regions.Count][];
                    for (int i = 0; i < Header.Regions.Count; i++)
                    {
                        Permutations[i] = new ModelTagGroup.Region.Permutation[Regions[i].Permutations.Count];
                        entry.TagData.Seek(Regions[i].Permutations.Offset, SeekOrigin.Begin);
                        for (int j = 0; j < Regions[i].Permutations.Count; j++)
                        {
                            Permutations[i][j] = reader.Read <ModelTagGroup.Region.Permutation>();
                        }
                    }

                    //Read Sections
                    Sections = new ModelTagGroup.Section[Header.Sections.Count];
                    entry.TagData.Seek(Header.Sections.Offset, SeekOrigin.Begin);
                    for (int i = 0; i < Header.Sections.Count; i++)
                    {
                        Sections[i] = reader.Read <ModelTagGroup.Section>();
                    }

                    //Read Resources
                    Resources = new ModelTagGroup.Section.Resource[Header.Sections.Count][];
                    for (int i = 0; i < Header.Sections.Count; i++)
                    {
                        Resources[i] = new ModelTagGroup.Section.Resource[Sections[i].Resources.Count];
                        entry.TagData.Seek(Sections[i].Resources.Offset, SeekOrigin.Begin);
                        for (int j = 0; j < Sections[i].Resources.Count; j++)
                        {
                            Resources[i][j] = reader.Read <ModelTagGroup.Section.Resource>();
                        }
                    }

                    //Read Materials
                    Materials = new ModelTagGroup.Material[Header.Materials.Count];
                    entry.TagData.Seek(Header.Materials.Offset, SeekOrigin.Begin);
                    for (int i = 0; i < Header.Materials.Count; i++)
                    {
                        Materials[i] = reader.Read <ModelTagGroup.Material>();
                    }
                }
            }
예제 #2
0
 /// <summary>
 /// Inflates the normalized vector to a standard vector using the supplied X and Y component compressions.
 /// </summary>
 /// <param name="compression">The compression used to scale the components.</param>
 /// <returns>A 2-component vector.</returns>
 public Vector2 InflateXY(ComponentCompression compression)
 {
     return(new Vector2(compression.Inflate(Component.X, x), compression.Inflate(Component.Y, y)));
 }
예제 #3
0
 /// <summary>
 /// Inflates the normalized vector to a standard vector using the supplied U and V component compressions.
 /// </summary>
 /// <param name="compression">The compression used to scale the components.</param>
 /// <returns>A 2-component vector.</returns>
 public Vector2 InflateUV(ComponentCompression compression)
 {
     return(new Vector2(compression.Inflate(Component.U, x), compression.Inflate(Component.V, y)));
 }
예제 #4
0
 /// <summary>
 /// Inflates the normalized vector to a standard vector using the supplied component compression.
 /// </summary>
 /// <param name="compression">The compression used to scale the components.</param>
 /// <returns>A 3-component vector.</returns>
 public Vector3 Inflate(ComponentCompression compression)
 {
     return(new Vector3(compression.Inflate(Component.X, x), compression.Inflate(Component.Y, y), compression.Inflate(Component.Z, z)));
 }