Beispiel #1
0
 public void RenderScene()
 {
     if (Screen == null)
         Screen = new PixelScreen(ViewPlane);
     Screen.Pixels.Clear();
     Camera.ComputeUVW();
     Camera.RenderScene(this);
 }
Beispiel #2
0
 void render()
 {
     for (int i = 0; i < nframes; i++)
     {
         PixelScreen ps = new PixelScreen(world.ViewPlane);
         world.Screen = ps;
         world.RenderScene();
         frames.Add(ps);
         FrameCompletedEventArgs e = new FrameCompletedEventArgs();
         e.FinishedFrame = ps;
         e.FinishedFrameNumber = i + 1;
         fireNextFrame(e);
     }
     fireRenderCompleted(new FrameCompletedEventArgs());
 }
 public static string RenderImageFromScreen(PixelScreen screen, int height, int width, string folder, int framenumber)
 {
     System.Drawing.Bitmap bm = new System.Drawing.Bitmap(width, height);
     for (int i = 0; i < screen.Pixels.Count; i++)
     {
         Pixel p = screen.Pixels[i];
         Color r = Color.FromScRgb(1.0f, p.Color.R, p.Color.G, p.Color.B);
         bm.SetPixel((int)p.X, (int)p.Y, System.Drawing.Color.FromArgb(r.R, r.G, r.B));
     }
     if (!Directory.Exists(@"C:\Users\Belal\Pictures\Movies\" + folder))
     {
         Directory.CreateDirectory(@"C:\Users\Belal\Pictures\Movies\" + folder);
     }
     string file = @"C:\Users\Belal\Pictures\Movies\" + folder + @"\" + framenumber + ".png";
     bm.Save(file, System.Drawing.Imaging.ImageFormat.Png);
     return file;
 }
Beispiel #4
0
 public void Render(PixelScreen screen)
 {
     if (screen != null)
     {
         collection.Clear();
         DrawingVisual dv = new DrawingVisual();
         DrawingContext dc = dv.RenderOpen();
         for (int i = 0; i < screen.Pixels.Count; i++)
         {
             Pixel p = screen.Pixels[i];
             Color r = Color.FromScRgb(1.0f, p.Color.R, p.Color.G, p.Color.B);
             dc.DrawRectangle(new SolidColorBrush(r), null, new Rect(p.X, p.Y, 1, 1));
         }
         dc.Close();
         collection.Add(dv);
     }
 }