Exemplo n.º 1
0
 public SerializableKeyFrame(TripodCameraKeyFrame tk)
 {
     this.cameraMode = CameraMode.Tripod;
     this.position   = new SerializableVector3(tk.position);
     this.rotation   = new SerializableQuaternion(tk.rotation);
     this.yOffset    = tk.focusOffsetY;
     this.fov        = tk.fov;
     this.time       = tk.time;
 }
Exemplo n.º 2
0
        public CameraCurveResult Evaluate(float t)
        {
            float freeCamAmount   = freeCamCurve.Evaluate(t);
            float orbitCamAmount  = orbitCamCurve.Evaluate(t);
            float tripodCamAmount = tripodCamCurve.Evaluate(t);

            List <Tuple <float, CameraCurveResult> > results = new List <Tuple <float, CameraCurveResult> >();

            if (freeCamAmount > 0)
            {
                results.Add(new Tuple <float, CameraCurveResult>(freeCamAmount, FreeCameraKeyFrame.Evaluate(t, this)));
            }

            if (orbitCamAmount > 0)
            {
                results.Add(new Tuple <float, CameraCurveResult>(orbitCamAmount, OrbitCameraKeyFrame.Evaluate(t, this)));
            }

            if (tripodCamAmount > 0)
            {
                results.Add(new Tuple <float, CameraCurveResult>(tripodCamAmount, TripodCameraKeyFrame.Evaluate(t, this)));
            }
            switch (results.Count)
            {
            case 1:
                return(results[0].Item2);

            case 2:
                return(CameraCurveResult.Combine(
                           results[0].Item2, results[1].Item2,
                           results[0].Item1, results[1].Item1
                           ));

            case 3:
                results.Remove(results.OrderBy(v => v.Item1).First());      //Combine the two curves with the highest amount
                goto case 2;

            default:
                return(new CameraCurveResult());
            }
        }
        private void AddKeyFrame(float time)
        {
            int      index = this.FindKeyFrameInsertIndex(time);
            KeyFrame item;

            switch (this.mode)
            {
            case CameraMode.Free:
                item = new FreeCameraKeyFrame(this.cameraTransform, camera.fieldOfView, time, cameraCurve);
                break;

            case CameraMode.Orbit:
                item = new OrbitCameraKeyFrame(this.orbitRadialCoord, FocusOffsetY, camera.fieldOfView, time, cameraCurve);
                break;

            case CameraMode.Tripod:
                item = new TripodCameraKeyFrame(this.cameraTransform, FocusOffsetY, camera.fieldOfView, time, cameraCurve);
                break;

            default:
                return;
            }
            this.keyFrames.Insert(index, item);
        }