public static void RunOnce(MixtureGraph graph) { using (var processor = new MixtureGraphProcessor(graph)) { processor.Run(); } }
void Initialize() { RegisterCallback <KeyDownEvent>(KeyCallback); processor = new MixtureGraphProcessor(graph); computeOrderUpdated += processor.UpdateComputeOrder; graph.onOutputTextureUpdated += () => processor.Run(); graph.onGraphChanges += _ => { this.schedule.Execute(() => ProcessGraph()).ExecuteLater(10); MarkDirtyRepaint(); }; // Run the processor when we open the graph ProcessGraph(); }
Texture2D ExecuteAndReadback(MixtureGraph graph) { // Process the graph andreadback the result var processor = new MixtureGraphProcessor(graph); processor.Run(); graph.outputNode.outputTextureSettings.First().enableCompression = false; var settings = graph.outputNode.rtSettings; Texture2D destination = new Texture2D( settings.GetWidth(graph), settings.GetHeight(graph), settings.GetGraphicsFormat(graph), TextureCreationFlags.None ); graph.ReadbackMainTexture(destination); // Output the image to a file return(destination); }