public CamNode GetPointInBetween(CamNode point1, CamNode point2, double percent, double wholeProgress, bool isFirstLoop, bool isLastLoop) { var point = point1.GetPointBetween(point2, percent); var iteration = isFirstLoop ? 0 : isLastLoop && _sizeOfIteration < 0.5 ? 2 : 1; var additionalProgress = iteration * _sizeOfIteration; wholeProgress = additionalProgress + wholeProgress * _sizeOfIteration; if (_xSpline != null) { point.X = _xSpline.ValueAt(wholeProgress); } if (_ySpline != null) { point.Y = _ySpline.ValueAt(wholeProgress); } if (_zSpline != null) { point.Z = _zSpline.ValueAt(wholeProgress); } if (_yawSpline != null) { point.Yaw = (float)_yawSpline.ValueAt(wholeProgress); } if (_pitchSpline != null) { point.Pitch = (float)_pitchSpline.ValueAt(wholeProgress); } if (_rollSpline != null) { point.Roll = (float)_rollSpline.ValueAt(wholeProgress); } if (_fovSpline != null) { point.FieldOfView = _fovSpline.ValueAt(wholeProgress); } if (_saturationSpline != null) { point.Saturation = _saturationSpline.ValueAt(wholeProgress); } if (_sepiaSpline != null) { point.Sepia = _sepiaSpline.ValueAt(wholeProgress); } return(point); }
/// <summary> /// Gets the point in between. /// </summary> /// <param name="point1">The point1.</param> /// <param name="point2">The point2.</param> /// <param name="percent">The percent.</param> /// <param name="wholeProgress">The whole progress.</param> /// <param name="isFirstLoop">if set to <c>true</c> [is first loop].</param> /// <param name="isLastLoop">if set to <c>true</c> [is last loop].</param> /// <returns>CamNode.</returns> internal new CamNode GetPointInBetween(CamNode point1, CamNode point2, double percent, double wholeProgress, bool isFirstLoop, bool isLastLoop) { var newCamPoint = base.GetPointInBetween(point1, point2, percent, wholeProgress, isFirstLoop, isLastLoop); var angle = wholeProgress * 360; var center = _target.GetPosition(); if (center == null) { return(newCamPoint); } var centerPoint = new Vec3d(center.X, center.Y, center.Z); var newPoint = new Vec3d(_sphereOrigin.X, _sphereOrigin.Y, _sphereOrigin.Z) { Y = 0 }; var matrix = new Matrix3d(); Matrix3d.RotY(angle * GameMath.DEG2RAD); matrix.Transform(newPoint); newPoint.Y = _yAxis.ValueAt(wholeProgress) - center.Y; newPoint.Normalize(); newPoint.Scale(_radius); newPoint.Add(centerPoint); newCamPoint.X = newPoint.X; newCamPoint.Y = newPoint.Y; newCamPoint.Z = newPoint.Z; return(newCamPoint); }