Beispiel #1
0
 public ICamera(AnimatedTransform camToWorld, double sopen, double sclose, IFilm film)
 {
     Film = film;
     sopen = ShutterOpen;
     sclose = ShutterClose;
     CameraToWorld = new AnimatedTransform (camToWorld);
 }
Beispiel #2
0
 public static ICamera CreateCamera(ParameterSet parameters, AnimatedTransform cameraToWorld, IFilm film)
 {
     double shutteropen = parameters.FindOneDouble ("shutteropen", 0.0);
     double shutterclose = parameters.FindOneDouble ("shutterclose", 1.0);
     double lensradius = parameters.FindOneDouble ("lensradius", 0.0);
     double focaldistance = parameters.FindOneDouble ("focaldistance", 1E+30);
     double frame = parameters.FindOneDouble ("frameaspectratio", (double)(film.xResolution) / (double)(film.yResolution));
     double[] screen = new double[4];
     if (frame > 1.0)
     {
         screen[0] = -frame;
         screen[1] = frame;
         screen[2] = -1.0;
         screen[3] = 1.0;
     } else
     {
         screen[0] = -1.0;
         screen[1] = 1.0;
         screen[2] = -1.0 / frame;
         screen[3] = 1.0 / frame;
     }
     int swi = 0;
     double[] sw = parameters.FindDouble ("screenwindow", ref swi);
     if (sw != null && swi == 4)
         screen = sw;
     double fov = parameters.FindOneDouble ("fov", 90.0);
     return new Perspective (cameraToWorld, screen, shutteropen, shutterclose, lensradius, focaldistance, fov, film);
 }
Beispiel #3
0
 public static ICamera CreateCamera(string name, ParameterSet paramSet, TransformSet camToWorldSet, double transformStart, double transformEnd, IFilm film)
 {
     Transform[] camToWorld = new Transform[2];
     Transform temp;
     Api.TransformCache.Lookup (camToWorldSet[0], out camToWorld[0], out temp);
     Api.TransformCache.Lookup (camToWorldSet[1], out camToWorld[1], out temp);
     AnimatedTransform animatedCamToWorld = new AnimatedTransform (camToWorld[0], transformStart, camToWorld[1], transformEnd);
     CameraPlugin plugin = new CameraPlugin (name);
     return plugin.CreateCamera (paramSet, animatedCamToWorld, film);
 }
Beispiel #4
0
        public ProjectiveCamera(AnimatedTransform cameraToWorld, Transform projection, double[] screenWindow, double sopen, double sclose, double lensr, double focald, IFilm film)
            : base(cameraToWorld, sopen, sclose, film)
        {
            LensRadius = lensr;
            FocalDistance = focald;
            CameraToScreen = new Transform (projection);

            ScreenToRaster = Transform.Scale (film.xResolution, film.yResolution, 1.0) *
                Transform.Scale (1.0 / (screenWindow[1] - screenWindow[0]), 1.0 / (screenWindow[2] - screenWindow[3]), 1.0) *
                    Transform.Translate (-screenWindow[0], -screenWindow[3], 0.0);
            RasterToScreen = ScreenToRaster.Inverse;
            RasterToCamera = CameraToScreen.Inverse * RasterToScreen;
        }
Beispiel #5
0
        public Perspective(AnimatedTransform cameraToWorld, double[] screenWindow, double sopen, double sclose, double lensr, double focald, double fov, IFilm film)
            : base(cameraToWorld, Transform.Perspective (fov, 0.01, 1000.0), screenWindow, sopen, sclose, lensr, focald, film)
        {
            dxCamera = RasterToCamera.Apply (new Point (1.0, 0.0, 0.0)) - RasterToCamera.Apply (new Point (0.0, 0.0, 0.0));
            dyCamera = RasterToCamera.Apply (new Point (0.0, 1.0, 0.0)) - RasterToCamera.Apply (new Point (0.0, 0.0, 0.0));

            Console.WriteLine ("    - Creating Perspective Camera with settings:");
            Console.WriteLine ("       > ScreenWindow: [{0}, {1}, {2}, {3}]", screenWindow[0], screenWindow[1], screenWindow[2], screenWindow[3]);
            Console.WriteLine ("       > Shutter Open: {0}", sopen);
            Console.WriteLine ("       > Shutter Close: {0}", sclose);
            Console.WriteLine ("       > Lens Radius: {0}", lensr);
            Console.WriteLine ("       > Focal Distance: {0}", focald);
        }
Beispiel #6
0
 public AnimatedTransform(AnimatedTransform anim)
     : this(anim.StartTransform, anim.StartTime, anim.EndTransform, anim.EndTime)
 {
 }