Exemple #1
0
        private void showGEO(PackedFile geoFile)
        {
            if (geoFile.GetFileType() != TRFileType.GEO)
            {
                return;
            }

            using (MemoryStream memory = new MemoryStream(geoFile.GetContents()))
            {
                try
                {
                    ChunkFile chunkie = new ChunkFile();
                    if (chunkie.Load(memory))
                    {
                        GBODChunk gbod   = chunkie.Chunks[0] as GBODChunk;
                        var       meshes = Viewer.ModelCreator.Generate(gbod, viewer3D.DX);
                        viewer3D.DisplayMeshes(meshes);
                        return;
                    }
                } catch (Exception)
                {
                }
                MessageBox.Show("Failed to load geometry file");
            }
        }
Exemple #2
0
        private void btnTestPARM_Click(object sender, EventArgs e)
        {
            List <string> files = new List <string>();

            DateTime start = DateTime.Now;

            foreach (PackedFile file in trData.Filesystem.Values)
            {
                if (file.GetFileType() == TRFileType.GEO)
                {
                    using (MemoryStream memory = new MemoryStream(file.GetContents()))
                    {
                        ChunkFile chunkie = new ChunkFile();
                        if (chunkie.Load(memory) && chunkie.Chunks.Count > 0)
                        {
                            GBODChunk gbod = chunkie.Chunks[0] as GBODChunk;
                            foreach (var child in gbod.Children)
                            {
                                GPCEChunk piece = null;

                                if (child is GSKNChunk)
                                {
                                    piece = (child as GSKNChunk).Geometry;
                                }

                                if (child is GPCEChunk)
                                {
                                    piece = child as GPCEChunk;
                                }

                                if (piece != null)
                                {
                                    if (piece.Effect.parms.Where(p => p.Key == "DiffuseTexture").Count() == 0)
                                    {
                                        files.Add(file.Filename);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            DateTime end = DateTime.Now;

            Console.WriteLine("Operation took {0}", (end - start).ToString());
            files.ForEach(v => Console.WriteLine("ndf: {0}", v));
            MessageBox.Show("FINISHED");
        }