2021-07-11 22:59:29 -05:00
|
|
|
// Decompiled with JetBrains decompiler
|
|
|
|
|
// Type: Microsoft.Iris.Render.ConstantAnimationInput
|
|
|
|
|
// Assembly: UIX.RenderApi, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
|
|
|
|
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
|
|
|
|
|
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
|
|
|
|
|
|
|
|
|
|
using Microsoft.Iris.Render.Common;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Iris.Render
|
|
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
public sealed class ConstantAnimationInput : AnimationInput
|
2021-07-11 22:59:29 -05:00
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
private object m_inputValue;
|
2021-07-11 22:59:29 -05:00
|
|
|
|
2021-07-11 23:04:40 -05:00
|
|
|
public ConstantAnimationInput(float sourceValue)
|
2021-07-11 23:07:04 -05:00
|
|
|
: this(sourceValue, null)
|
2021-07-11 22:59:29 -05:00
|
|
|
{
|
|
|
|
|
}
|
2021-07-11 23:04:40 -05:00
|
|
|
|
|
|
|
|
public ConstantAnimationInput(float sourceValue, string sourceMaskSpec)
|
2021-07-11 22:59:29 -05:00
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec);
|
|
|
|
|
this.CommonCreate(AnimationInputType.Float, animationTypeMask);
|
2021-07-11 23:07:04 -05:00
|
|
|
this.m_inputValue = this.ApplyMask(animationTypeMask, sourceValue);
|
2021-07-11 23:04:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Vector2 sourceValue)
|
2021-07-11 23:07:04 -05:00
|
|
|
: this(sourceValue, null)
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Vector2 sourceValue, string sourceMaskSpec)
|
|
|
|
|
{
|
|
|
|
|
AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec);
|
|
|
|
|
this.CommonCreate(AnimationInputType.Vector2, animationTypeMask);
|
2021-07-11 23:07:04 -05:00
|
|
|
this.m_inputValue = this.ApplyMask(animationTypeMask, sourceValue);
|
2021-07-11 23:04:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Vector3 sourceValue)
|
2021-07-11 23:07:04 -05:00
|
|
|
: this(sourceValue, null)
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Vector3 sourceValue, string sourceMaskSpec)
|
|
|
|
|
{
|
|
|
|
|
AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec);
|
|
|
|
|
this.CommonCreate(AnimationInputType.Vector3, animationTypeMask);
|
2021-07-11 23:07:04 -05:00
|
|
|
this.m_inputValue = this.ApplyMask(animationTypeMask, sourceValue);
|
2021-07-11 23:04:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Vector4 sourceValue)
|
2021-07-11 23:07:04 -05:00
|
|
|
: this(sourceValue, null)
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Vector4 sourceValue, string sourceMaskSpec)
|
|
|
|
|
{
|
|
|
|
|
AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec);
|
|
|
|
|
this.CommonCreate(AnimationInputType.Vector4, animationTypeMask);
|
2021-07-11 23:07:04 -05:00
|
|
|
this.m_inputValue = this.ApplyMask(animationTypeMask, sourceValue);
|
2021-07-11 23:04:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Quaternion sourceValue)
|
2021-07-11 23:07:04 -05:00
|
|
|
: this(sourceValue, null)
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ConstantAnimationInput(Quaternion sourceValue, string sourceMaskSpec)
|
|
|
|
|
{
|
|
|
|
|
AnimationTypeMask animationTypeMask = AnimationTypeMask.FromString(sourceMaskSpec);
|
|
|
|
|
this.CommonCreate(AnimationInputType.Quaternion, animationTypeMask);
|
2021-07-11 23:07:04 -05:00
|
|
|
this.m_inputValue = this.ApplyMask(animationTypeMask, sourceValue);
|
2021-07-11 23:04:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal object RawValue => this.m_inputValue;
|
|
|
|
|
|
|
|
|
|
private object ApplyMask(AnimationTypeMask mask, object value)
|
|
|
|
|
{
|
2021-07-11 23:07:04 -05:00
|
|
|
object obj = null;
|
2021-07-11 23:04:40 -05:00
|
|
|
if (mask.ChannelCount == 0U)
|
2021-07-11 22:59:29 -05:00
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
obj = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
2021-07-11 22:59:29 -05:00
|
|
|
{
|
2021-07-11 23:04:40 -05:00
|
|
|
float[] numArray = new float[4];
|
|
|
|
|
switch (value)
|
|
|
|
|
{
|
|
|
|
|
case float num:
|
|
|
|
|
numArray[0] = num;
|
|
|
|
|
numArray[1] = 0.0f;
|
|
|
|
|
numArray[2] = 0.0f;
|
|
|
|
|
numArray[3] = 0.0f;
|
|
|
|
|
break;
|
|
|
|
|
case Vector2 vector2:
|
|
|
|
|
numArray[0] = vector2.X;
|
|
|
|
|
numArray[1] = vector2.Y;
|
|
|
|
|
numArray[2] = 0.0f;
|
|
|
|
|
numArray[3] = 0.0f;
|
|
|
|
|
break;
|
|
|
|
|
case Vector3 vector3:
|
|
|
|
|
numArray[0] = vector3.X;
|
|
|
|
|
numArray[1] = vector3.Y;
|
|
|
|
|
numArray[2] = vector3.Z;
|
|
|
|
|
numArray[3] = 0.0f;
|
|
|
|
|
break;
|
|
|
|
|
case Vector4 vector4:
|
|
|
|
|
numArray[0] = vector4.X;
|
|
|
|
|
numArray[1] = vector4.Y;
|
|
|
|
|
numArray[2] = vector4.Z;
|
|
|
|
|
numArray[3] = vector4.W;
|
|
|
|
|
break;
|
|
|
|
|
case Quaternion quaternion:
|
|
|
|
|
numArray[0] = quaternion.X;
|
|
|
|
|
numArray[1] = quaternion.Y;
|
|
|
|
|
numArray[2] = quaternion.Z;
|
|
|
|
|
numArray[3] = quaternion.W;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2021-07-11 23:07:04 -05:00
|
|
|
Debug2.Throw(false, "Unsupported type: {0}", value.GetType());
|
2021-07-11 23:04:40 -05:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (mask.ChannelCount)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
2021-07-11 23:07:04 -05:00
|
|
|
obj = (float)(mask[0] == AnimationTypeChannel.O ? 0.0 : numArray[(int)(mask[0] - 1)]);
|
2021-07-11 23:04:40 -05:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2021-07-11 23:07:04 -05:00
|
|
|
obj = new Vector2()
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[0] - 1)]),
|
|
|
|
|
Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[1] - 1)])
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2021-07-11 23:07:04 -05:00
|
|
|
obj = new Vector3()
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[0] - 1)]),
|
|
|
|
|
Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[1] - 1)]),
|
|
|
|
|
Z = (mask[2] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[2] - 1)])
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
2021-07-11 23:07:04 -05:00
|
|
|
obj = new Vector4()
|
2021-07-11 23:04:40 -05:00
|
|
|
{
|
|
|
|
|
X = (mask[0] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[0] - 1)]),
|
|
|
|
|
Y = (mask[1] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[1] - 1)]),
|
|
|
|
|
Z = (mask[2] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[2] - 1)]),
|
|
|
|
|
W = (mask[3] == AnimationTypeChannel.O ? 0.0f : numArray[(int)(mask[3] - 1)])
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
Debug2.Throw(false, "Only 4 channels are supported");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
2021-07-11 22:59:29 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|