/// <summary> /// Initializes a new instance of CurveKey. /// </summary> /// <param name="position">Position in the curve.</param><param name="value">Value of the control point.</param><param name="tangentIn">Tangent approaching point from the previous point in the curve.</param><param name="tangentOut">Tangent leaving point toward next point in the curve.</param><param name="continuity">Enum indicating whether the curve is discrete or continuous.</param> public CurveKey(float position, float value, float tangentIn, float tangentOut, CurveContinuity continuity) { this.position = position; this.internalValue = value; this.tangentIn = tangentIn; this.tangentOut = tangentOut; this.continuity = continuity; }
public CurveKey(float position, float value, float tangentIn, float tangentOut, CurveContinuity continuity) { this.Position = position; this.Value = value; this.TangentIn = tangentIn; this.TangentOut = tangentOut; this.Continuity = continuity; }
/// <summary> /// Creates a new instance of <see cref="CurveKey"/> class. /// </summary> /// <param name="position">Position on the curve.</param> /// <param name="value">Value of the control point.</param> /// <param name="tangentIn">Tangent approaching point from the previous point on the curve.</param> /// <param name="tangentOut">Tangent leaving point toward next point on the curve.</param> /// <param name="continuity">Indicates whether the curve is discrete or continuous.</param> public CurveKey(float position, float value, float tangentIn, float tangentOut, CurveContinuity continuity) { this._position = position; this._value = value; this._tangentIn = tangentIn; this._tangentOut = tangentOut; this._continuity = continuity; }
public CurveKey(FP position, FP value, FP tangentIn, FP tangentOut, CurveContinuity continuity) { this.position = position; this.value = value; this.tangentIn = tangentIn; this.tangentOut = tangentOut; this.continuity = continuity; }
/// <summary>Creates a new instance of <see cref="CurveKey" /> class.</summary> /// <param name="position">Position on the curve.</param> /// <param name="value">Value of the control point.</param> /// <param name="tangentIn">Tangent approaching point from the previous point on the curve.</param> /// <param name="tangentOut">Tangent leaving point toward next point on the curve.</param> /// <param name="continuity">Indicates whether the curve is discrete or continuous.</param> public CurveKey(float position, float value, float tangentIn, float tangentOut, CurveContinuity continuity) { Position = position; Value = value; TangentIn = tangentIn; TangentOut = tangentOut; Continuity = continuity; }
/// <summary> /// Creates a new command to select the given keys. You can pass null to deselect all. /// </summary> public ChangeContinuityCommand(CurveEditorControl2 control, CurveContinuity newKeyContinuity) : base(control) { // Store the parameters. this.newKeyContinuity = newKeyContinuity; // Store the current selection, if any. affectedKeys = new long[control.Selection.Count]; var i = 0; foreach (var key in control.Selection) { affectedKeys[i++] = key.Id; } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="continuity"></param> private void SetKeyContinuity(EditCurveKey key, CurveContinuity continuity) { if (key.Continuity != continuity) { MarkModify(key); key.Continuity = continuity; if (continuity == CurveContinuity.Step) { key.TangentIn = key.TangentOut = 0; key.TangentInType = key.TangentInType = EditCurveTangent.Flat; } } }
protected internal override CurveKey Deserialize(XmlListReader input) { if (input == null) { throw new ArgumentNullException("input"); } float position = MathTypeSerializer <CurveKey> .ReadSingle(input); float value = MathTypeSerializer <CurveKey> .ReadSingle(input); float tangentIn = MathTypeSerializer <CurveKey> .ReadSingle(input); float tangentOut = MathTypeSerializer <CurveKey> .ReadSingle(input); CurveContinuity continuity = (CurveContinuity)Enum.Parse(typeof(CurveContinuity), input.ReadString()); return(new CurveKey(position, value, tangentIn, tangentOut, continuity)); }
protected internal override Curve Read(ContentReader input, Curve existingInstance) { Curve curve = existingInstance ?? new Curve(); curve.PreLoop = (CurveLoopType)input.ReadInt32(); curve.PostLoop = (CurveLoopType)input.ReadInt32(); int num1 = input.ReadInt32(); for (int index = 0; index < num1; ++index) { float position = input.ReadSingle(); float num2 = input.ReadSingle(); float tangentIn = input.ReadSingle(); float tangentOut = input.ReadSingle(); CurveContinuity continuity = (CurveContinuity)input.ReadInt32(); curve.Keys.Add(new CurveKey(position, num2, tangentIn, tangentOut, continuity)); } return(curve); }
/// <summary>Loads a curve from its serialized representation</summary> /// <param name="reader">Reader to use for reading the curve</param> /// <param name="curve">Curve to be deserialized</param> /// <remarks> /// This method loads right into the curve and is not transactional. /// If an error occurs during loading, the curve is left in /// an intermediate state and no assumptions should be made as to its /// contents. If you need transactional safety, create a temporary curve, /// load into the temporary curve and then replace your actual /// curve with it. /// </remarks> public static void Load(BinaryReader reader, Curve curve) { curve.Keys.Clear(); // Load the curve's loop settings curve.PreLoop = (CurveLoopType)reader.ReadByte(); curve.PostLoop = (CurveLoopType)reader.ReadByte(); // Load the key frames defined for the curve int keyCount = reader.ReadInt32(); for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) { float position = reader.ReadSingle(); float value = reader.ReadSingle(); float tangentIn = reader.ReadSingle(); float tangentOut = reader.ReadSingle(); CurveContinuity continuity = (CurveContinuity)reader.ReadByte(); curve.Keys.Add(new CurveKey(position, value, tangentIn, tangentOut, continuity)); } // for }
protected internal override Curve Read(ContentReader input, Curve existingInstance) { Curve curve = existingInstance; if (curve == null) { curve = new Curve(); } curve.PreLoop = (CurveLoopType)input.ReadInt32(); curve.PostLoop = (CurveLoopType)input.ReadInt32(); int num6 = input.ReadInt32(); for (int i = 0; i < num6; i++) { float position = input.ReadSingle(); float num4 = input.ReadSingle(); float tangentIn = input.ReadSingle(); float tangentOut = input.ReadSingle(); CurveContinuity continuity = (CurveContinuity)input.ReadInt32(); curve.Keys.Add(new CurveKey(position, num4, tangentIn, tangentOut, continuity)); } return(curve); }
/// <summary> /// Initializes a new instance of the <see cref="Curve"/> class. /// </summary> /// <param name="position">The key's position on the curve.</param> /// <param name="value">The key's value.</param> /// <param name="tangentIn">The value of the tangent when approaching this key from the previous key.</param> /// <param name="tangentOut">The value of the tangent when approaching this key from the next key.</param> /// <param name="continuity">A value describing the continuity between this key and the next.</param> public CurveKey(Single position, Single value, Single tangentIn, Single tangentOut, CurveContinuity continuity) { this.position = position; this.value = value; this.tangentIn = tangentIn; this.tangentOut = tangentOut; this.continuity = continuity; }
/// <summary> /// Converts a <see cref="CurveContinuity"/> value to a sampler. /// </summary> private static ICurveSampler <Single, CubicSplineCurveKey <Single> > GetSamplerFromCurveContinuity(CurveContinuity curveContinuity) { switch (curveContinuity) { case CurveContinuity.CubicSpline: return(SingleCurveCubicSplineSampler.Instance); case CurveContinuity.Step: return(SingleCurveStepSampler.Instance); case CurveContinuity.Linear: return(SingleCurveLinearSampler.Instance); default: throw new ArgumentOutOfRangeException(nameof(curveContinuity)); } }
public CurveKey(GGame.Math.Fix64 position, GGame.Math.Fix64 value, GGame.Math.Fix64 tangentIn, GGame.Math.Fix64 tangentOut, CurveContinuity continuity) { this.position = position; this.value = value; this.tangentIn = tangentIn; this.tangentOut = tangentOut; this.continuity = continuity; }
/// <summary> /// Creates a new instance of <see cref="Curve3DKey"/> class. /// </summary> /// <param name="position">Position on the curve.</param> /// <param name="value">Value of the control point.</param> /// <param name="tangentIn">Tangent approaching point from the previous point on the curve.</param> /// <param name="tangentOut">Tangent leaving point toward next point on the curve.</param> /// <param name="continuity">Indicates whether the curve is discrete or continuous.</param> public Curve3DKey(float position, Vector3 value, Vector3 tangentIn, Vector3 tangentOut, CurveContinuity continuity) { this.Position = position; this.Value = value; this.TangentIn = tangentIn; this.TangentOut = tangentOut; this.Continuity = continuity; }