public void LoadOpenGLTexture() { if (RenderableTex == null) { RenderableTex = new RenderableTex(); } RenderableTex.GLInitialized = false; RenderableTex.LoadOpenGLTexture(this); }
public void LoadOpenGLTexture() { if (!Runtime.UseOpenGL) { return; } if (RenderableTex == null) { RenderableTex = new RenderableTex(); } RenderableTex.GLInitialized = false; RenderableTex.LoadOpenGLTexture(this); }
public void Read(Texture tex) { ImageKey = "Texture"; SelectedImageKey = "Texture"; Text = tex.Name; texture = tex; Width = tex.Width; Height = tex.Height; Format = ConvertFormat(tex.Format); format = (int)tex.Format; int swizzle = (int)tex.Swizzle; int pitch = (int)tex.Pitch; uint bpp = GTX.surfaceGetBitsPerPixel((uint)format) >> 3; GTX.GX2Surface surf = new GTX.GX2Surface(); surf.bpp = bpp; surf.height = tex.Height; surf.width = tex.Width; surf.aa = (uint)tex.AAMode; surf.alignment = tex.Alignment; surf.depth = tex.Depth; surf.dim = (uint)tex.Dim; surf.format = (uint)tex.Format; surf.use = (uint)tex.Use; surf.pitch = tex.Pitch; surf.data = tex.Data; surf.numMips = tex.MipCount; surf.mipOffset = tex.MipOffsets; surf.mipData = tex.MipData; surf.tileMode = (uint)tex.TileMode; surf.swizzle = tex.Swizzle; //Determine tex2 botw files to get mip maps string Tex1 = GetFilePath(); if (Tex1.Contains(".Tex1")) { string Tex2 = Tex1.Replace(".Tex1", ".Tex2"); Console.WriteLine(Tex2); if (System.IO.File.Exists(Tex2)) { ResFile resFile2 = new ResFile(new System.IO.MemoryStream( EveryFileExplorer.YAZ0.Decompress(Tex2))); if (resFile2.Textures.ContainsKey(tex.Name)) { surf.mipData = resFile2.Textures[tex.Name].MipData; surf.mipOffset = resFile2.Textures[tex.Name].MipOffsets; } } } if (surf.mipData == null) { surf.numMips = 1; } List <byte[]> mips = GTX.Decode(surf); Surfaces.Add(new Surface() { mipmaps = mips }); RenderableTex.LoadOpenGLTexture(this); }