using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HaloObjects;

namespace HaloPlugins.Xbox
{
    public class mode
    {
       public List<MetaNode> Fields = new List<MetaNode>();

       public mode()
       {
           Fields.AddRange(new MetaNode[] {
           new StringID("Model Name"),
           new Bitmask("Flags", new string[] { "Force_Third_Person", "Force_Carmack_Reverse", "Force_Node_Maps" }, 32),
           new Value("Unknown", typeof(int)),
           new Unused(8),
           new Reflexive("Compression Info", 56, new MetaNode[] { 
               new Value("X (min)", typeof(float)),
               new Value("X (max)", typeof(float)),
               new Value("Y (min)", typeof(float)),
               new Value("Y (max)", typeof(float)),
               new Value("Z (min)", typeof(float)),
               new Value("Z (max)", typeof(float)),
               new Value("U (min)", typeof(float)),
               new Value("U (max)", typeof(float)),
               new Value("V (min)", typeof(float)),
               new Value("V (max)", typeof(float)),
               new Value("Secondary U (Min)", typeof(float)),
               new Value("Secondary U (max)", typeof(float)),
               new Value("Secondary V (min)", typeof(float)),
               new Value("Secondary V (max)", typeof(float)),
           }),
           new Reflexive("Regions", 16, new MetaNode[] { 
               new StringID("Part Name"),
               new Value("Node Map Offset", typeof(short)),
               new Value("Node Map Size", typeof(short)),
               new Reflexive("Permutation", 16, new MetaNode[] { 
                   new StringID("Permutation Name"),
                   new Value("Lowest Piece (Index)", typeof(short)),
                   new Value("Low Piece (Index)", typeof(short)),
                   new Value("Medium-Low Piece (Index)", typeof(short)),
                   new Value("Medium-High Piece (Index)", typeof(short)),
                   new Value("High Piece (Index)", typeof(short)),
                   new Value("Highest Piece (Index)", typeof(short)),
               }),
           }),
           new Reflexive("Sections", 92, new MetaNode[] { 
               new HaloObjects.Enum("Global Geometry Classification", new string[] { "Rigid", "Rigid_Boned", "Skinned" }, 32),
               new Value("Vertex Count", typeof(short)),
               new Value("Triangle Count", typeof(short)),
               new Value("Part Count", typeof(short)),
               new Value("Shadow Casting Triangle Cour", typeof(short)),
               new Value("Shadow Casting Part Count", typeof(short)),
               new Value("Opaque Point Count", typeof(short)),
               new Value("Opaque Vertex Count", typeof(short)),
               new Value("Opaque Part Count", typeof(short)),
               new Value("Opaque Max Nodes/Verte", typeof(byte)),
               new Value("Transparent Max Nodes/Verte", typeof(byte)),
               new Value("Shadow Casting Rigid Triangle Count", typeof(short)),
               new HaloObjects.Enum("Geometry Classification", new string[] { "Rigid", "Rigid_Boned", "Skinned" }, 16),
               new Bitmask("Unknown", new string[] { "Compressed_Position", "Compressed_Texcoord", "Compressed_Secondary_Texcoord" }, 32),
               new Value("Hardware Node Count", typeof(byte)),
               new Value("Node Map Size", typeof(byte)),
               new Value("Software Plane Count", typeof(byte)),
               new Unused(3),
               new Value("Unknown", typeof(short)),
               new Unused(2),
               new Value("Total SubPart Count", typeof(int)),
               new Bitmask("Section Lighting FLags", new string[] { "Has_Im_Texcoords", "Has_Im_inc._rad.", "Has_Im_Colors", "Has_Im_prt" }, 8),
               new Value("Rigid Node Index", typeof(byte)),
               new Value("", typeof(byte)),
               new Bitmask("Flags", new string[] { "Geometry_Postprocessed" }, 8),
               new Reflexive("Section Data", 88, new MetaNode[] { 
                   new Unused(88),
               }),
               new Value("Raw Offset", typeof(int)),
               new Value("Raw Size", typeof(int)),
               new Value("Raw Header Size", typeof(int)),
               new Value("Raw Data Size", typeof(int)),
               new Reflexive("Resource", 16, new MetaNode[] { 
                   new Value("Unknown", typeof(int)),
                   new Value("Primary Locator", typeof(short)),
                   new Value("Secondary Locator", typeof(short)),
                   new Value("Size", typeof(int)),
                   new Value("Offset", typeof(int)),
               }),
               new Ident("Owner_Tag_Section_Offset"),
               new Value("Unknown", typeof(int)),
               new Value("Unused", typeof(int)),
           }),
           new Reflexive("Invalid Section Pair Bits", 4, new MetaNode[] { 
               new Value("Bits", typeof(int)),
           }),
           new Reflexive("Section Groups", 12, new MetaNode[] { 
               new Bitmask("Detail Levels", new string[] { "L1_(super_Low)", "L2_(low", "L3_(medium)", "L4_(high)", "L5_(super_high)", "L6_(hollywood)" }, 32),
               new Reflexive("Compount Nodes", 16, new MetaNode[] { 
                   new Value("Node Index", typeof(byte)),
                   new Value("Node Index", typeof(byte)),
                   new Value("Node Index", typeof(byte)),
                   new Value("Node Index", typeof(byte)),
                   new Value("Node Weight", typeof(float)),
                   new Value("Node Weight", typeof(float)),
                   new Value("Node Weight", typeof(float)),
               }),
           }),
           new Value("L1 Section Group Index", typeof(short)),
           new Value("L2 Section Group Index", typeof(short)),
           new Value("L3 Section Group Index", typeof(short)),
           new Value("L4 Section Group Index", typeof(short)),
           new Value("L5 Section Group Index", typeof(short)),
           new Value("L6 Section Group Index", typeof(short)),
           new Reflexive("Nodes", 96, new MetaNode[] { 
               new StringID("Name"),
               new Value("Parent Node Index", typeof(short)),
               new Value("First Child Node Index", typeof(short)),
               new Value("Next Sibling Node Index", typeof(short)),
               new Value("Import Node Index", typeof(short)),
               new Value("Default Translation X", typeof(float)),
               new Value("Default Translation Y", typeof(float)),
               new Value("Default Translation Z", typeof(float)),
               new Value("Default Rotation i", typeof(float)),
               new Value("Default Rotation j", typeof(float)),
               new Value("Default Rotation k", typeof(float)),
               new Value("Default Rotation w", typeof(float)),
               new Value("Inverse Foward i", typeof(float)),
               new Value("Inverse Foward j", typeof(float)),
               new Value("Inverse Foward k", typeof(float)),
               new Value("Inverse Left i", typeof(float)),
               new Value("Inverse Left j", typeof(float)),
               new Value("Inverse Left k", typeof(float)),
               new Value("Inverse Up i", typeof(float)),
               new Value("Inverse Up j", typeof(float)),
               new Value("Inverse Up k", typeof(float)),
               new Value("Inverse Position i", typeof(float)),
               new Value("Inverse Position j", typeof(float)),
               new Value("Inverse Position k", typeof(float)),
               new Value("Inverse Scale", typeof(float)),
               new Value("Distance from Parent", typeof(float)),
           }),
           new Unused(8),
           new Reflexive("Marker Groups", 12, new MetaNode[] { 
               new StringID("Name"),
               new Reflexive("Markers", 36, new MetaNode[] { 
                   new Value("Region index", typeof(byte)),
                   new Value("Permutation Index", typeof(byte)),
                   new Value("Node Index", typeof(short)),
                   new Value("Translation X", typeof(float)),
                   new Value("Translation Y", typeof(float)),
                   new Value("Tranlsation Z", typeof(float)),
                   new Value("Rotation i", typeof(float)),
                   new Value("Rotation j", typeof(float)),
                   new Value("Rotation k", typeof(float)),
                   new Value("Rotation w", typeof(float)),
                   new Value("Scale", typeof(float)),
               }),
           }),
           new Reflexive("Materials", 32, new MetaNode[] { 
               new TagReference("Old_Shader"),
               new TagReference("Shader"),
               new Reflexive("Propeties", 8, new MetaNode[] { 
                   new Value("Int Value", typeof(int)),
                   new Value("Real Value", typeof(float)),
               }),
               new Value("Brakable Surface Index", typeof(int)),
               new Unused(4),
           }),
           new Unused(8),
           new Value("Unknown", typeof(float)),
           new Reflexive("Prt Info", 88, new MetaNode[] { 
               new Value("SH Order", typeof(short)),
               new Value("Clustor Number", typeof(short)),
               new Value("PCA Vectors Per Clustor", typeof(short)),
               new Value("Number of Rays", typeof(short)),
               new Value("Number of Bounces", typeof(short)),
               new Value("Mat Index for sbsfc Scattering", typeof(short)),
               new Value("Length Scale", typeof(float)),
               new Value("Number of LODs", typeof(int)),
               new Reflexive("Lod Info", 12, new MetaNode[] { 
                   new Value("Clustor Offset", typeof(int)),
                   new Reflexive("Section Info", 8, new MetaNode[] { 
                       new Value("Section Index", typeof(int)),
                       new Value("PCA Data Offset", typeof(int)),
                   }),
               }),
               new Reflexive("Clustor Basis", 4, new MetaNode[] { 
                   new Value("Basis Data", typeof(int)),
               }),
               new Unused(16),
               new Value("Raw Offset", typeof(int)),
               new Value("Raw Size", typeof(int)),
               new Value("Raw Header Size", typeof(int)),
               new Value("Raw Data Size", typeof(int)),
               new Reflexive("Resource", 16, new MetaNode[] { 
                   new Value("Unknown", typeof(int)),
                   new Value("Unknown", typeof(float)),
                   new Value("Size", typeof(uint)),
                   new Value("Offset", typeof(uint)),
               }),
               new Ident("Owner_Section_Data_Offset"),
               new Value("Unknown", typeof(int)),
               new Value("Unused", typeof(int)),
           }),
           new Reflexive("Section Render Leaves", 8, new MetaNode[] { 
               new Reflexive("Node Render Leaves", 16, new MetaNode[] { 
                   new Reflexive("Collision Leaves", 8, new MetaNode[] { 
                       new Value("Clustor", typeof(short)),
                       new Value("Surface Reference Count", typeof(short)),
                       new Value("First Surface Reference Index", typeof(int)),
                   }),
                   new Reflexive("Serface References", 8, new MetaNode[] { 
                       new Value("Strip Index", typeof(short)),
                       new Value("Lightmap Triangle Index", typeof(short)),
                       new Value("BSP Node Index", typeof(int)),
                   }),
               }),
           }),
           });
       }
    }
}
