public override void BuildLayout(SingleContainer editorContainer, IAssetManager assetManager) { this.m_FileSelect = new FileSelect(); this.m_FileSelect.Changed += (sender, e) => { using (var stream = new FileStream(this.m_FileSelect.Path, FileMode.Open)) { using (var reader = new BinaryReader(stream)) { this.m_Asset.RawData = reader.ReadBytes((int)stream.Length); } } assetManager.Recompile(this.m_Asset); assetManager.Save(this.m_Asset); }; var form = new Form(); form.AddControl("Source File:", this.m_FileSelect); var textureViewer = new TextureViewer(); textureViewer.Texture = this.m_Asset; var vertContainer = new VerticalContainer(); vertContainer.AddChild(form, "*"); vertContainer.AddChild(textureViewer, "400"); editorContainer.SetChild(vertContainer); }
void OnRenderImage(RenderTexture s, RenderTexture d) { if (Helper.CheckRtSize(s, output)) { output = Helper.CreateRenderTexture(s, output, downSample); rts = Helper.CreateRts(output, rts, downSample); output.name = name + ".onRenderImage"; onCreate.Invoke(output); TextureViewer.AddTexture(output); } Graphics.Blit(s, rts[0]); foreach (var m in effects) { Graphics.Blit(rts[0], rts[1], m); rts.Swap(); } Graphics.Blit(rts[0], output); onUpdate.Invoke(output); if (show) { Graphics.Blit(output, d); } else { Graphics.Blit(s, d); } }
private void btnRotate90Right_Click(object sender, EventArgs e) { TextureViewer form = Application.OpenForms.OfType <TextureViewer>().FirstOrDefault(); if (form != null) { form.rotateImage90Right(sender, e); } }
public TextureViewer GetTextureViewer() { if (m_TextureViewer == null || m_TextureViewer.IsDisposed) { m_TextureViewer = new TextureViewer(this); AddLogViewer(m_TextureViewer); } return(m_TextureViewer); }
private void Window_Loaded(object sender, RoutedEventArgs e) { editorApp = new TextureViewer(enginePanel.Handle, enginePanel.Width, enginePanel.Height); while (editorApp.IsContextActive()) { editorApp.Frame(); System.Windows.Forms.Application.DoEvents(); } }
public static void Destroy() { if (m_instance == null) { Console.Out.WriteLine("The TextureViewer is not instanciated, create it before destroying"); return; } Destroy(m_instance.gameObject); m_instance = null; }
public static void Instanciate() { if (m_instance != null) { Console.Out.WriteLine("TextureViewer is already instanciated"); return; } var obj = new GameObject("ShaderTool"); var tool = obj.AddComponent <TextureViewer>(); m_instance = tool; DontDestroyOnLoad(obj); }
void OnTextureView(Material m, string name) { var texture = m.GetTexture(name); var viewer = TextureViewer.instance; if (viewer == null) { TextureViewer.Instanciate(); } viewer = TextureViewer.instance; if (viewer == null) { return; } viewer.SetTexture(texture); }
void CheckOutput(RenderTexture s) { if (!createNewRt) { if (output != s) { Helper.ReleaseRenderTexture(output); output = s; } return; } output = output == s ? null : output; if (Helper.CheckRtSize(s, output)) { output = Helper.CreateRenderTexture(s, output); output.name = name + ".gaussianToRenderTexture"; onCreate.Invoke(output); TextureViewer.AddTexture(output); } }
// Use this for initialization void Start() { var c = GetComponent <Camera>(); if (useCameraSize && c != null) { width = c.pixelWidth; height = c.pixelHeight; } output = new RenderTexture(width, height, depth, format, readWrite); output.wrapMode = wrapMode; output.filterMode = filterMode; Graphics.SetRenderTarget(output); GL.Clear(true, true, clearColor); foreach (var mat in initializeMats) { Graphics.Blit(null, output, mat); } output.name = name + ".createRenderTexture"; onCreate.Invoke(output); TextureViewer.AddTexture(output); }