/// <summary> /// Interpolates the XYZ position between the current and next nodes along the path. /// This step must be done before rotational interpolation can occur. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> public override void InterpolatePosition(InterpolationNodeArray nodeList, double step) { Point.Position = new Vec3d( Linear(nodeList.Current.X, nodeList.Next.X, step), Linear(nodeList.Current.Y, nodeList.Next.Y, step), Linear(nodeList.Current.Z, nodeList.Next.Z, step)); }
/// <summary> /// Interpolates the rotational angles between the current and next nodes along the path. /// This step must be done before additional angle interpolation can occur. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> public override void InterpolatePolarCoordinates(InterpolationNodeArray nodeList, double step) { Point.PolarCoordinates = new PolarCoordinates( Cubic( nodeList.Previous.Pitch, nodeList.Current.Pitch, nodeList.Next.Pitch, nodeList.Subsequent.Pitch, step), Cubic( nodeList.Previous.Yaw, nodeList.Current.Yaw, nodeList.Next.Yaw, nodeList.Subsequent.Yaw, step)); }
/// <summary> /// Interpolates the XYZ position between the current and next nodes along the path. /// This step must be done before rotational interpolation can occur. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> public override void InterpolatePosition(InterpolationNodeArray nodeList, double step) { Point.Position = new Vec3d( CubicCatmull( nodeList.Previous.X, nodeList.Current.X, nodeList.Next.X, nodeList.Subsequent.X, step), CubicCatmull( nodeList.Previous.Y, nodeList.Current.Y, nodeList.Next.Y, nodeList.Subsequent.Y, step), CubicCatmull( nodeList.Previous.Z, nodeList.Current.Z, nodeList.Next.Z, nodeList.Subsequent.Z, step)); }
/// <summary> /// Calculates the camera point at the current position along the path. /// </summary> /// <param name="pathPosition">The path position.</param> internal CameraPoint GetPoint(double pathPosition) { var section = pathPosition * _nodesToTravel; var section1 = (int)section; if (section1 == _nodesToTravel) { // pathPosition unavoidably reaches the last node at the very end -> // So decrement the previous node to stop the concertina effect. section--; } var section2 = section1 + 1; var step = section - section1; var section0 = section1 - 1; var section3 = section2 + 1; // Bounding the outer nodes inside the array if necessary // I could extrapolate these points, but this is a quick and acceptable // Solution: It even creates some kind of fade in and out if (section0 < 0) { section0 = 0; } if (section3 > _nodesToTravel) { section3 = _nodesToTravel; } var nodeList = new InterpolationNodeArray( _cameraPath[section0], _cameraPath[section1], _cameraPath[section2], _cameraPath[section3]); _interpolator.InterpolatePosition(nodeList, step); _interpolator.InterpolatePolarCoordinates(nodeList, step); _interpolator.InterpolateAdditionAngles(nodeList, step); return(_point); }
/// <summary> /// Interpolates additional angles between the current and next nodes along the path. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> /// <remarks> /// Currently, this only interpolates the rotation around the Z axis, however, it would /// be possible to include other features, such as dynamic FOV, and shader gradation. /// </remarks> public override void InterpolateAdditionAngles(InterpolationNodeArray nodeList, double step) { Interpolator.InterpolateAdditionAngles(nodeList, step); }
/// <summary> /// Interpolates the rotational angles between the current and next nodes along the path. /// This step must be done before additional angle interpolation can occur. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> public override void InterpolatePolarCoordinates(InterpolationNodeArray nodeList, double step) { Point.PolarCoordinates = Point.Position.InterpolateTargetCoordinates(TargetPos); }
/// <summary> /// Interpolates the XYZ position between the current and next nodes along the path. /// This step must be done before rotational interpolation can occur. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> public override void InterpolatePosition(InterpolationNodeArray nodeList, double step) { Interpolator.InterpolatePosition(nodeList, step); }
/// <summary> /// Interpolates additional angles between the current and next nodes along the path. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> /// <remarks> /// Currently, this only interpolates the rotation around the Z axis, however, it would /// be possible to include other features, such as dynamic FOV, and shader gradation. /// </remarks> public override void InterpolateAdditionAngles(InterpolationNodeArray nodeList, double step) { Point.Roll = Cubic( nodeList.Previous.Pitch, nodeList.Current.Pitch, nodeList.Next.Pitch, nodeList.Subsequent.Pitch, step); }
/// <summary> /// Interpolates additional angles between the current and next nodes along the path. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> /// <remarks> /// Currently, this only interpolates the rotation around the Z axis, however, it would /// be possible to include other features, such as dynamic FOV, and shader gradation. /// </remarks> public override void InterpolateAdditionAngles(InterpolationNodeArray nodeList, double step) { Point.Roll = Linear(nodeList.Current.Roll, nodeList.Next.Roll, step); }
/// <summary> /// Interpolates the rotational angles between the current and next nodes along the path. /// This step must be done before additional angle interpolation can occur. /// </summary> /// <param name="nodeList">A list of nodes needed for interpolation.</param> /// <param name="step"> /// The fraction of which the player has already reached the next node (0-» still at current node, 1 -» /// already at next node) /// </param> public override void InterpolatePolarCoordinates(InterpolationNodeArray nodeList, double step) { Point.PolarCoordinates = new PolarCoordinates( Linear(nodeList.Current.Pitch, nodeList.Next.Pitch, step), Linear(nodeList.Current.Yaw, nodeList.Next.Yaw, step)); }