UniVRM/UniGLTF/Core/Scripts/IO/AnimationKeyframeData.cs
ousttrue 1d108052de Merge commit '2a19c831f8440eed1279b9930ef33115c61d7d82' as 'UniGLTF'
Co-authored-by: Akihiko Odaki <nekomanma@pixiv.co.jp>
Co-authored-by: Emiliana <vtemiliana@gmail.com>
Co-authored-by: junichi_hirose <junichi_hirose@dwango.co.jp>
Co-authored-by: Masataka SUMI <santarh@gmail.com>
Co-authored-by: ousttrue <oustrrue@gmail.com>
Co-authored-by: ousttrue <ousttrue@gmail.com>
Co-authored-by: TORISOUP <tori.birdstrike@gmail.com>
Co-authored-by: Yuki Shimada <emadurandal@gmail.com>
Co-authored-by: yutopp <yutopp@gmail.com>
2018-12-28 20:16:54 +09:00

54 lines
1.4 KiB
C#

namespace UniGLTF
{
class AnimationKeyframeData
{
#if UNITY_EDITOR
public float Time { get; set; }
public delegate float[] ConverterFunc(float[] values);
private ConverterFunc _converter;
private float[] _values;
public float[] Values
{
get { return _values; }
}
private bool[] _enterValues;
public bool[] EnterValues
{
get { return _enterValues; }
}
public AnimationKeyframeData(int elementCount, ConverterFunc converter)
{
_values = new float[elementCount];
_enterValues = new bool[elementCount];
for (int i = 0; i < _enterValues.Length; i++)
{
_enterValues[i] = false;
}
_converter = converter;
}
public void SetValue(float src, int offset)
{
if (_values.Length > offset)
{
_values[offset] = src;
_enterValues[offset] = true;
}
}
public virtual float[] GetRightHandCoordinate()
{
if (_converter != null)
{
return _converter(_values);
}
else
{
return _values;
}
}
#endif
}
}