private void ProcessDenses(Clip clip, AnimationClipBindingConstant bindings, IReadOnlyDictionary <uint, string> tos)
        {
            DenseClip dense       = clip.DenseClip;
            int       streamCount = clip.StreamedClip.CurveCount;

            float[] slopeValues = new float[4];             // no slopes - 0 values
            for (int frameIndex = 0; frameIndex < dense.FrameCount; frameIndex++)
            {
                float time        = frameIndex / dense.SampleRate;
                int   frameOffset = frameIndex * dense.CurveCount;
                for (int curveIndex = 0; curveIndex < dense.CurveCount;)
                {
                    int index = streamCount + curveIndex;
                    if (!GetGenericBinding(bindings, index, out GenericBinding binding))
                    {
                        curveIndex++;
                        continue;
                    }

                    string path = GetCurvePath(tos, binding.Path);
                    AddComplexCurve(time, binding.BindingType, dense.SampleArray, slopeValues, slopeValues, frameOffset + curveIndex, path);
                    curveIndex += binding.BindingType.GetDimension();
                }
            }
        }
        private void ProcessDenses(Clip clip, AnimationClipBindingConstant bindings, IReadOnlyDictionary <uint, string> tos)
        {
            DenseClip dense       = clip.DenseClip;
            int       streamCount = clip.StreamedClip.CurveCount;

            float[] slopeValues = new float[4];             // no slopes - 0 values
            for (int frameIndex = 0; frameIndex < dense.FrameCount; frameIndex++)
            {
                float time        = frameIndex / dense.SampleRate;
                int   frameOffset = frameIndex * dense.CurveCount;
                for (int curveIndex = 0; curveIndex < dense.CurveCount;)
                {
                    int            index         = streamCount + curveIndex;
                    GenericBinding binding       = bindings.FindBinding(index);
                    string         path          = GetCurvePath(tos, binding.Path);
                    int            framePosition = frameOffset + curveIndex;
                    if (binding.IsTransform)
                    {
                        AddTransformCurve(time, binding.TransformType, dense.SampleArray, slopeValues, slopeValues, framePosition, path);
                        curveIndex += binding.TransformType.GetDimension();
                    }
                    else if (binding.CustomType == BindingCustomType.None)
                    {
                        AddDefaultCurve(binding, path, time, dense.SampleArray[framePosition]);
                        curveIndex++;
                    }
                    else
                    {
                        AddCustomCurve(bindings, binding, path, time, dense.SampleArray[framePosition]);
                        curveIndex++;
                    }
                }
            }
        }
Пример #3
0
 public void Read(AssetReader reader)
 {
     StreamedClip.Read(reader);
     DenseClip.Read(reader);
     if (HasConstantClip(reader.Version))
     {
         ConstantClip.Read(reader);
     }
     if (HasBinding(reader.Version))
     {
         Binding.Read(reader);
     }
 }