Exemplo n.º 1
0
        private BoneWeight[] GetSmoothedBoneWeights(int lerpIndex)
        {
            Debug.Assert(lerpIndex >= 0);

            while (lerpIndex >= m_SmoothedBoneWeights.Count && lerpIndex <= maxSmoothIterations)
            {
                BoneWeight[] boneWeights;
                SmoothingUtility.SmoothWeights(m_SmoothedBoneWeights[m_SmoothedBoneWeights.Count - 1], spriteMeshData.indices, BoneCount, out boneWeights);
                m_SmoothedBoneWeights.Add(boneWeights);
            }

            return(m_SmoothedBoneWeights[Mathf.Min(lerpIndex, maxSmoothIterations)]);
        }
Exemplo n.º 2
0
        public void SmoothWeights(int iterations, ISelection <int> selection)
        {
            var boneWeights = new BoneWeight[spriteMeshData.vertexCount];

            for (var i = 0; i < spriteMeshData.vertexCount; i++)
            {
                boneWeights[i] = spriteMeshData.GetWeight(i).ToBoneWeight(false);
            }

            BoneWeight[] smoothedWeights;
            SmoothingUtility.SmoothWeights(boneWeights, spriteMeshData.indices, spriteMeshData.boneCount, iterations, out smoothedWeights);

            for (var i = 0; i < spriteMeshData.vertexCount; i++)
            {
                if (selection == null || (selection.Count == 0 || selection.Contains(i)))
                {
                    spriteMeshData.GetWeight(i).SetFromBoneWeight(smoothedWeights[i]);
                }
            }
        }