public bool TryGetValue(string Usage, int UsageIndex, out VertexValue val)
        {
            foreach (var value in Values)
                if (value.Usage == Usage && value.UsageIndex == UsageIndex)
                {
                    val = value;
                    return true;
                }

            val = new VertexValue(new Vector(), 0, Usage, UsageIndex);
            return false;
        }
        public override void LoadRaw()
        {
            if (RawLoaded) return;

            var mode = this;
            var data = cache.GetRawFromID(mode.RawID);
            var ms = new MemoryStream(data);
            var reader = new EndianReader(ms, Endian.EndianFormat.BigEndian);

            var validParts = new Dictionary<int, mode.ModelSection>();

            LoadFixups();

            if (mode.IndexInfoList.Count == 0) throw new Exception("Geometry contains no faces");

            #region Read Vertices
            for (int i = 0; i < mode.ModelSections.Count; i++)
            {
                var section = mode.ModelSections[i];
                if (section.Submeshes.Count == 0) continue;

                if (section.VertsIndex >= 0 && section.VertsIndex < mode.VertInfoList.Count) reader.SeekTo(mode.VertInfoList[section.VertsIndex].Offset);

                if (cache.vertexNode == null) throw new NotSupportedException("No vertex definitions found for " + cache.Version.ToString());

                #region Get Vertex Definition
                XmlNode formatNode = null;
                foreach (XmlNode node in cache.vertexNode.ChildNodes)
                {
                    if (Convert.ToInt32(node.Attributes["type"].Value, 16) == section.VertexFormat)
                    {
                        formatNode = node;
                        break;
                    }
                }

                if (formatNode == null) throw new NotSupportedException("Format " + section.VertexFormat.ToString() + " not found in definition for " + cache.Version.ToString());
                #endregion

                mode.ModelSection validPart;
                if (validParts.TryGetValue(section.VertsIndex, out validPart))
                {
                    section.Vertices = validPart.Vertices;
                    continue;
                }
                else
                    validParts.Add(section.VertsIndex, section);

                section.Vertices = new Vertex[mode.VertInfoList[section.VertsIndex].VertexCount];

                #region Get Vertices
                for (int j = 0; j < mode.VertInfoList[section.VertsIndex].VertexCount; j++)
                {
                    section.Vertices[j] = new Vertex(reader, formatNode);
                    ModelFunctions.DecompressVertex(ref section.Vertices[j], mode.BoundingBoxes[0]);

                    #region fixups
                    var vert = section.Vertices[j];
                    VertexValue v;

                    #region rigid fix
                    if (section.NodeIndex != 255 && !mode.Flags.Values[18])
                    {
                        vert.Values.Add(new VertexValue(new Vector(section.NodeIndex, 0, 0, 0), VertexValue.ValueType.Int8_N4, "blendindices", 0));
                        vert.Values.Add(new VertexValue(new Vector(1, 0, 0, 0), VertexValue.ValueType.Int8_N4, "blendweight", 0));
                    }
                    #endregion

                    #region flag 18 fix
                    if (mode.Flags.Values[18])
                    {
                        VertexValue w;
                        var hasWeights = vert.TryGetValue("blendweight", 0, out w);

                        if (!hasWeights) w = new VertexValue(new Vector(1, 0, 0, 0), VertexValue.ValueType.Int8_N4, "blendweight", 0);

                        if (vert.TryGetValue("blendindices", 0, out v))
                        {
                            v.Data.A = w.Data.A == 0 ? 0 : mode.NodeIndexGroups[i].NodeIndices[(int)v.Data.A].Index;
                            v.Data.B = w.Data.B == 0 ? 0 : mode.NodeIndexGroups[i].NodeIndices[(int)v.Data.B].Index;
                            v.Data.C = w.Data.C == 0 ? 0 : mode.NodeIndexGroups[i].NodeIndices[(int)v.Data.C].Index;
                            v.Data.D = w.Data.D == 0 ? 0 : mode.NodeIndexGroups[i].NodeIndices[(int)v.Data.D].Index;
                        }
                        else
                        {
                            v = new VertexValue(new Vector(0, 0, 0, 0), VertexValue.ValueType.Int8_N4, "blendindices", 0);
                            v.Data.A = mode.NodeIndexGroups[i].NodeIndices[0].Index;
                            vert.Values.Add(v);
                            vert.Values.Add(w);
                        }
                    }
                    #endregion

                    #region rigid_boned fix
                    if (!vert.TryGetValue("blendweight", 0, out v) && vert.TryGetValue("blendindices", 0, out v))
                    {
                        var q = new Vector(
                            v.Data.A == 0 ? 0 : 1,
                            v.Data.B == 0 ? 0 : 1,
                            v.Data.C == 0 ? 0 : 1,
                            v.Data.D == 0 ? 0 : 1);
                        vert.Values.Add(new VertexValue(q, VertexValue.ValueType.Int8_N4, "blendweight", 0));
                    }
                    #endregion

                    #endregion
                }
                #endregion
            }
            #endregion

            validParts.Clear();

            #region Read Indices
            for (int i = 0; i < mode.ModelSections.Count; i++)
            {
                var section = mode.ModelSections[i];
                if (section.Submeshes.Count == 0) continue;

                if (section.FacesIndex >= 0 && section.FacesIndex < mode.IndexInfoList.Count) reader.SeekTo(mode.IndexInfoList[section.FacesIndex].Offset);

                mode.ModelSection validPart;
                if (validParts.TryGetValue(section.FacesIndex, out validPart))
                {
                    section.Indices = validPart.Indices;
                    continue;
                }
                else
                    validParts.Add(section.FacesIndex, section);

                section.Indices = new int[section.TotalFaceCount];
                for (int j = 0; j < section.TotalFaceCount; j++)
                    section.Indices[j] = (mode.VertInfoList[section.VertsIndex].VertexCount > 0xFFFF) ? reader.ReadInt32() : reader.ReadUInt16();
            }
            #endregion

            LoadModelExtras();

            mode.RawLoaded = true;
        }