public void MeshLoads()
        {
            Settings.initializeSettings();
            String meshERFPath = "E:\\Program Files (x86)\\Steam\\steamapps\\common\\dragon age origins\\packages\\core\\data\\modelmeshdata.erf";

            ERF meshes = new ERF(meshERFPath);
            meshes.readKeyData();
            Assert.Greater(meshes.resourceCount, 0);
            int failures = 0;
            for (int i = 0; i < meshes.resourceCount; i++)
            {
                GFF temp = IO.findFile<GFF>(meshes.resourceNames[i]);
                Assert.NotNull(temp, "Not found: |" + meshes.resourceNames[i] + "|" + i);
                if (Path.GetExtension(meshes.resourceNames[i]) == ".msh")
                {
                    try
                    {
                        ModelMesh tempH = new ModelMesh(temp);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine(meshes.resourceNames[i]);
                        failures++;
                    }
                }
            }
            Assert.AreEqual(0, failures);
        }             
Example #2
0
        public Level(String filePath)
        {
            // Initialize the erf (lvl) file in memory
            diskFile = new ERF(filePath);

            //find the index of the header file in the erf
            int headerIndex = diskFile.indexOf("header.gff");

            if (headerIndex < 0)
            {
                throw new Exception("Could not find the header file in " + filePath + "! Please make sure it is a level file.");
            }

            //Initialize the header file
            headerFile     = new GFF(filePath, diskFile.resourceOffsets[headerIndex]);
            baseModels     = new Dictionary <String, Model>();
            lightmapModels = new List <ModelInstance>();
            layoutName     = "WHAT";
            //Set up the struct definitions (for sanity!)
            setStructDefinitions();
            readObjects();
        }
        public Level(String filePath)
        {
            // Initialize the erf (lvl) file in memory
            diskFile = new ERF(filePath);

            //find the index of the header file in the erf
            int headerIndex = diskFile.indexOf("header.gff");

            if (headerIndex < 0)
            {
                throw new Exception("Could not find the header file in "+filePath+"! Please make sure it is a level file.");
            }

            //Initialize the header file
            headerFile = new GFF(filePath, diskFile.resourceOffsets[headerIndex]);
            baseModels = new Dictionary<String, Model>();
            lightmapModels = new List<ModelInstance>();
            layoutName = "WHAT";
            //Set up the struct definitions (for sanity!)
            setStructDefinitions();
            readObjects();
        }