Example #1
0
 private static void ComputeWeightGroup(IReadOnlyList <MorphDesc> morphs, MorphDesc morph, float rate, float[] computedWeights)
 {
     for (int i = 0; i < morph.SubMorphs.Length; i++)
     {
         MorphSubMorphDesc subMorphStruct = morph.SubMorphs[i];
         MorphDesc         subMorph       = morphs[subMorphStruct.GroupIndex];
         if (subMorph.Type == MorphType.Group)
         {
             ComputeWeightGroup(morphs, subMorph, rate * subMorphStruct.Rate, computedWeights);
         }
         else
         {
             computedWeights[subMorphStruct.GroupIndex] += rate * subMorphStruct.Rate;
         }
     }
 }
Example #2
0
 private static void ComputeWeight1(IReadOnlyList <MorphDesc> morphs, float[] weightInit, float[] computedWeights, float[] prevComputedWeights)
 {
     for (int i = 0; i < morphs.Count; i++)
     {
         prevComputedWeights[i] = computedWeights[i];
         computedWeights[i]     = 0;
     }
     for (int i = 0; i < morphs.Count; i++)
     {
         MorphDesc morph = morphs[i];
         if (morph.Type == MorphType.Group)
         {
             ComputeWeightGroup(morphs, morph, weightInit[i], computedWeights);
         }
         else
         {
             computedWeights[i] += weightInit[i];
         }
     }
 }