private void replaceSurfaceLevelToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Supported Formats|*.dds|" + "Microsoft DDS |*.dds|" + "All files(*.*)|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { DDS dds = new DDS(ofd.FileName); if (textureData.renderedTex.height != (uint)dds.header.height) { throw new Exception("Invalid height! Must be same as original!"); } if (textureData.renderedTex.width != (uint)dds.header.width) { throw new Exception("Invalid Width! Must be same as original!"); } List <byte[]> Mipmaps = TextureImporterSettings.SwizzleSurfaceMipMaps(textureData, dds.bdata); textureData.renderedTex.mipmaps[CurArrayDisplayLevel] = Mipmaps; UpdateMipDisplay(); textureData.LoadOpenGLTexture(); } }
private static bool BindFTEX(BFRESGroupNode ftexContainer, MatTexture tex, SF.Shader shader, string activeTex) { FTEX ftex = (FTEX)ftexContainer.ResourceNodes[activeTex]; if (ftex.RenderableTex == null || !ftex.RenderableTex.GLInitialized) { ftex.LoadOpenGLTexture(); } BindGLTexture(tex, shader, ftex); return(ftex.RenderableTex.GLInitialized); }
public static int BindTexture(MatTexture tex, bool IsWiiU) { GL.ActiveTexture(TextureUnit.Texture0 + tex.textureUnit + 1); // GL.BindTexture(TextureTarget.Texture2D, RenderTools.defaultTex.Id); string activeTex = tex.Name; if (tex.animatedTexName != "") { activeTex = tex.animatedTexName; } if (IsWiiU) { foreach (var ftexContainer in PluginRuntime.ftexContainers) { if (ftexContainer.ResourceNodes.ContainsKey(activeTex)) { FTEX ftex = (FTEX)ftexContainer.ResourceNodes[activeTex]; if (ftex.RenderableTex == null || !ftex.RenderableTex.GLInitialized) { ftex.LoadOpenGLTexture(); } BindGLTexture(tex, ftex.RenderableTex.TexID); } } } else { foreach (var bntx in PluginRuntime.bntxContainers) { if (bntx.Textures.ContainsKey(activeTex)) { if (bntx.Textures[activeTex].RenderableTex == null || !bntx.Textures[activeTex].RenderableTex.GLInitialized) { bntx.Textures[activeTex].LoadOpenGLTexture(); } BindGLTexture(tex, bntx.Textures[activeTex].RenderableTex.TexID); } } } return(tex.textureUnit + 1); }