public void LoadTextureFile() { if (Transparent) { testPlane.GetComponent <Renderer>().material.ChangeRenderMode(BlendMode.Transparent); } else { testPlane.GetComponent <Renderer>().material.ChangeRenderMode(BlendMode.Opaque); } loadedPayload?.Unload(); BigFileFile curr = displayedFiles[sel]; TextureMetadataFileArchetype arch = curr.ArchetypeAs <TextureMetadataFileArchetype>(); loadedPayload = arch.Payload.File; List <BigFileFile> list = new List <BigFileFile> { loadedPayload }; m_bigFile.FileLoader.LoadFiles(list); texture = new Texture2D(arch.Width, arch.Height, ImportAs, false); texture.wrapMode = TextureWrapMode.Clamp; texture.LoadRawTextureData(arch.Payload.Data); texture.Apply(); testPlane.GetComponent <Renderer>().material.mainTexture = texture; testPlane.transform.localScale = new Vector3(arch.Width / arch.Height, 1, 1); Camera.main.orthographicSize = Mathf.Clamp(5 + (.37f * (testPlane.transform.localScale.x - 1)), 5, 100); }
static void TestTextures() { Console.Write("File path: "); string path = Console.ReadLine(); if (!File.Exists(path)) { Environment.Exit(69); } Console.Write("\nType: "); string type = Console.ReadLine(); YetiTextureFormat format; if (!Enum.TryParse(type, out format)) { Environment.Exit(420); } LogManager.GlobalLogFlags = LogFlags.Error | LogFlags.Info; PackedBigFile bigFile = new PackedBigFile(new FileInfo(path)); bigFile.LoadFromDisk(); List <BigFileFile> textureFiles = bigFile.RootFolder.GetAllFilesOfArchetype <TextureMetadataFileArchetype>(); bigFile.FileLoader.LoadFiles(textureFiles); foreach (BigFileFile file in textureFiles) { TextureMetadataFileArchetype archetype = file.ArchetypeAs <TextureMetadataFileArchetype>(); if (archetype.Format == format) { Console.WriteLine(file.FullFolderPath + file.Name + " " + string.Format("{0:X2} {1} {2}", archetype.Format, archetype.Width, archetype.Height)); } } Console.ReadLine(); }