public void LoadMeshes(Renderer.Renderer renderer, string path, Matrix4 transform, Vector4 tintColor, Package currentPackage = null, string skin = null) { var data = model.GetData(); var refMeshes = data.GetArray <string>("m_refMeshes"); var materialGroups = data.GetArray("m_materialGroups"); for (var i = 0; i < refMeshes.Length; i++) { var refMesh = refMeshes[i]; var newResource = FileExtensions.LoadFileByAnyMeansNecessary(refMesh + "_c", path, currentPackage); if (newResource == null) { Console.WriteLine("unable to load mesh " + refMesh); continue; } if (!newResource.Blocks.ContainsKey(BlockType.VBIB)) { Console.WriteLine("Old style model, no VBIB!"); continue; } var skinMaterials = new List <string>(); if (!string.IsNullOrEmpty(skin)) { foreach (var materialGroup in materialGroups) { if (materialGroup.GetProperty <string>("m_name") == skin) { var materials = materialGroup.GetArray <string>("m_materials"); skinMaterials.AddRange(materials); break; } } } renderer.AddMeshObject(new MeshObject { Resource = newResource, Transform = transform, TintColor = tintColor, SkinMaterials = skinMaterials, }); // TODO: Only first, again. break; } }