private void printStdFiles(RenderThread thread) { try { logger.Info("Output : " + thread.Stdout); logger.Info("Error : " + thread.Stderr); } catch (Exception ex) { logger.Error("Error getting stdfiles from thread", ex); } }
private void unpackThread(GThread thread) { RenderThread rth = (RenderThread)thread; if (rth != null) { Bitmap bit = rth.RenderedImageSegment; if (bit != null) { logger.Debug("Loading from bitmap"); displayImage(bit, rth.Col, rth.Row); } else { logger.Debug("bit is null! " + thread.Id); } } }
private void render_Click(object sender, EventArgs e) { stop.Enabled = true; render.Enabled = !stop.Enabled; drawnFirstSegment = false; showSplash(); // model path modelPath = paths[modelCombo.SelectedIndex]; // get width and height from combo box imageWidth = Int32.Parse(widthCombo.SelectedItem.ToString()); imageHeight = Int32.Parse(heightCombo.SelectedItem.ToString()); // get cols and rows from up downs columns = Decimal.ToInt32(columnsUpDown.Value); rows = Decimal.ToInt32(rowsUpDown.Value); segmentWidth = imageWidth/columns; segmentHeight = imageHeight/rows; int x = 0; int y = 0; logger.Debug("WIDTH:"+imageWidth); logger.Debug("HEIGHT:"+imageHeight); logger.Debug("COLUMNS:"+columns); logger.Debug("ROWS:"+rows); logger.Debug(""+modelPath); // reset the display clearImage(); if (!initted) { GConnectionDialog gcd = new GConnectionDialog(); gcd.ShowDialog(); ga = new GApplication(true); ga.ApplicationName = "Alchemi POV-Ray Renderer - Alchemi sample"; ga.Connection = gcd.Connection; ga.ThreadFinish += new GThreadFinish(ga_ThreadFinish); ga.ThreadFailed += new GThreadFailed(ga_ThreadFailed); ga.ApplicationFinish += new GApplicationFinish(ga_ApplicationFinish); ga.Manifest.Add(new ModuleDependency(typeof(RenderThread).Module)); initted = true; } if (ga!=null && ga.Running) { ga.Stop(); } pbar.Maximum = columns*rows; pbar.Minimum = 0; pbar.Value = 0; lbProgress.Text = "Starting to render image ... "; for (int col=0; col<columns; col++) { for (int row=0; row<rows; row++) { x = col*segmentWidth; y = row*segmentHeight; int startRowPixel = y + 1; int endRowPixel = y + segmentHeight; int startColPixel = x + 1; int endColPixel = x + segmentWidth; RenderThread rth = new RenderThread(modelPath, imageWidth, imageHeight, segmentWidth, segmentHeight, startRowPixel, endRowPixel, startColPixel, endColPixel, ""); rth.BasePath = this.basepath; rth.Col = col+1; rth.Row = row+1; ga.Threads.Add(rth); } } try { ga.Start(); } catch (Exception ex) { Console.WriteLine(""+ex.StackTrace); MessageBox.Show("Alchemi Rendering Failed!"+ex.ToString()); } lbProgress.Text = "Rendering image ... "; ShowBusyGif(); }
private void render_Click(object sender, EventArgs e) { stop.Enabled = true; render.Enabled = !stop.Enabled; drawnFirstSegment = false; showSplash(); // model path modelPath = paths[modelCombo.SelectedIndex]; // get width and height from combo box imageWidth = Int32.Parse(widthCombo.SelectedItem.ToString()); imageHeight = Int32.Parse(heightCombo.SelectedItem.ToString()); // get cols and rows from up downs columns = Decimal.ToInt32(columnsUpDown.Value); rows = Decimal.ToInt32(rowsUpDown.Value); segmentWidth = imageWidth / columns; segmentHeight = imageHeight / rows; int x = 0; int y = 0; logger.Debug("WIDTH:" + imageWidth); logger.Debug("HEIGHT:" + imageHeight); logger.Debug("COLUMNS:" + columns); logger.Debug("ROWS:" + rows); logger.Debug("" + modelPath); // reset the display clearImage(); if (!initted) { GConnectionDialog gcd = new GConnectionDialog(); gcd.ShowDialog(); ga = new GApplication(true); ga.ApplicationName = "Alchemi POV-Ray Renderer - Alchemi sample"; ga.Connection = gcd.Connection; ga.ThreadFinish += new GThreadFinish(ga_ThreadFinish); ga.ThreadFailed += new GThreadFailed(ga_ThreadFailed); ga.ApplicationFinish += new GApplicationFinish(ga_ApplicationFinish); ga.Manifest.Add(new ModuleDependency(typeof(RenderThread).Module)); initted = true; } if (ga != null && ga.Running) { ga.Stop(); } pbar.Maximum = columns * rows; pbar.Minimum = 0; pbar.Value = 0; lbProgress.Text = "Starting to render image ... "; for (int col = 0; col < columns; col++) { for (int row = 0; row < rows; row++) { x = col * segmentWidth; y = row * segmentHeight; int startRowPixel = y + 1; int endRowPixel = y + segmentHeight; int startColPixel = x + 1; int endColPixel = x + segmentWidth; RenderThread rth = new RenderThread(modelPath, imageWidth, imageHeight, segmentWidth, segmentHeight, startRowPixel, endRowPixel, startColPixel, endColPixel, ""); rth.BasePath = this.basepath; rth.Col = col + 1; rth.Row = row + 1; ga.Threads.Add(rth); } } try { ga.Start(); } catch (Exception ex) { Console.WriteLine("" + ex.StackTrace); MessageBox.Show("Alchemi Rendering Failed!" + ex.ToString()); } lbProgress.Text = "Rendering image ... "; ShowBusyGif(); }