private void ConvertAlphaColors() { var colorAnimList = Color; for (int i = 0; i < colorAnimList.GetKeysCount(); i++) { MyAnimatedPropertyVector4 colorAnim; float time; colorAnimList.GetKey(i, out time, out colorAnim); IMyAnimatedProperty anim = colorAnim as IMyAnimatedProperty; for (int j = 0; j < colorAnim.GetKeysCount(); j++) { Vector4 color; colorAnim.GetKey(j, out time, out color); color = color.UnmultiplyColor(); color.W = ColorExtensions.ToLinearRGBComponent(color.W); color = color.PremultiplyColor(); color = Vector4.Clamp(color, new Vector4(0, 0, 0, 0), new Vector4(1, 1, 1, 1)); anim.SetKey(j, time, color); } } }
public void GetInterpolatedKeys(float overallTime, W variance, float multiplier, IMyAnimatedProperty interpolatedKeysOb) { T previousKeys, nextKeys; float previousTime, nextTime, difference; GetPreviousValue(overallTime, out previousKeys, out previousTime); GetNextValue(overallTime, out nextKeys, out nextTime, out difference); T interpolatedKeys = interpolatedKeysOb as T; interpolatedKeys.ClearKeys(); if (m_interpolator2 != null) { interpolatedKeys.Interpolator = m_interpolator2; } for (int i = 0; i < previousKeys.GetKeysCount(); i++) { float key; V value; previousKeys.GetKey(i, out key, out value); V prevValue, nextValue; previousKeys.GetInterpolatedValue <V>(key, out prevValue); nextKeys.GetInterpolatedValue <V>(key, out nextValue); V interpolatedValue = prevValue; if (nextTime != previousTime) { interpolatedKeys.Interpolator(ref prevValue, ref nextValue, (overallTime - previousTime) * difference, out interpolatedValue); } ApplyVariance(ref interpolatedValue, ref variance, multiplier, out interpolatedValue); interpolatedKeys.AddKey(key, interpolatedValue); } }
public void GetInterpolatedKeys(float overallTime, float multiplier, IMyAnimatedProperty interpolatedKeys) { GetInterpolatedKeys(overallTime, default(W), multiplier, interpolatedKeys); }
public override void SerializeValue(XmlWriter writer, object value) { IMyAnimatedProperty prop = value as IMyAnimatedProperty; prop.Serialize(writer); }