Exemple #1
0
 public static TransformSet Invert(TransformSet transformSet)
 {
     var result = new TransformSet();
     for (var i = 0; i < MaxTransforms; i++)
         result._transforms[i] = Transform.Invert(transformSet._transforms[i]);
     return result;
 }
Exemple #2
0
        public static Camera MakeCamera(string name, ParamSet parameters,
            TransformSet cameraToWorldSet, float transformStart, float transformEnd,
            Film film)
        {
            var animatedCameraToWorld = new AnimatedTransform(
                cameraToWorldSet[0], transformStart,
                cameraToWorldSet[1], transformEnd);

            switch (name)
            {
                case "perspective" :
                {
                    var shutterOpen = parameters.FindSingle("shutteropen", 0.0f);
                    var shutterClose = parameters.FindSingle("shutterclose", 1.0f);
                    if (shutterOpen < shutterClose)
                        MathUtility.Swap(ref shutterOpen, ref shutterClose);
                    var lensRadius = parameters.FindSingle("lensradius", 0.0f);
                    var focalDistance = parameters.FindSingle("focaldistance", 1e30f);
                    var frame = parameters.FindSingle("frameaspectratio", film.XResolution / (float) film.YResolution);
                    var screenWindow = parameters.FindSingleList("screenwindow");
                    if (screenWindow.Length != 4)
                        screenWindow = (frame > 1.0f)
                            ? new[] { -frame, frame, -1, 1 }
                            : new[] { -1, 1, -1 / frame, 1 / frame };
                    var fieldOfView = parameters.FindSingle("fov", 90.0f);

                    return new PerspectiveCamera(animatedCameraToWorld, screenWindow, shutterOpen, shutterClose,
                        lensRadius, focalDistance, fieldOfView, film);
                }
                default :
                    throw new ArgumentException("Unknown camera: " + name);
            }
        }
Exemple #3
0
 public TransformSet Clone()
 {
     var result = new TransformSet();
     for (var i = 0; i < MaxTransforms; i++)
         result._transforms[i] = _transforms[i];
     return result;
 }