public IBoneWeights CreateBoneWeights(PreprojectMode preprojectMode, params IBoneWeight[] weights) { var boneWeights = new BoneWeightsImpl { Index = boneWeights_.Count, PreprojectMode = preprojectMode, Weights = weights, }; this.boneWeights_.Add(boneWeights); return(boneWeights); }
public IBoneWeights GetOrCreateBoneWeights( PreprojectMode preprojectMode, IBone bone) { if (!this.boneWeightsByBone_.TryGetValue(bone, out var boneWeights)) { boneWeights = this.CreateBoneWeights( preprojectMode, new BoneWeight(bone, new FinMatrix4x4().SetIdentity(), 1)); this.boneWeightsByBone_[bone] = boneWeights; } return(boneWeights); }
public IBoneWeights GetOrCreateBoneWeights(PreprojectMode preprojectMode, params IBoneWeight[] weights) { foreach (var boneWeights in this.boneWeights_) { if (boneWeights.PreprojectMode != preprojectMode) { continue; } var existingWeights = boneWeights.Weights; if (weights.Length != existingWeights.Count) { continue; } for (var w = 0; w < weights.Length; ++w) { var weight = weights[w]; var existingWeight = existingWeights[w]; if (Math.Abs(weight.Weight - existingWeight.Weight) > .0001) { goto Skip; } if (weight.Bone != existingWeight.Bone) { goto Skip; } if (!(weight.SkinToBone?.Equals(existingWeight.SkinToBone) ?? false)) { goto Skip; } } return(boneWeights); Skip :; } return(CreateBoneWeights(preprojectMode, weights)); }