本文整理汇总了C++中FBoneContainer::GetDepthBetweenBones方法的典型用法代码示例。如果您正苦于以下问题:C++ FBoneContainer::GetDepthBetweenBones方法的具体用法?C++ FBoneContainer::GetDepthBetweenBones怎么用?C++ FBoneContainer::GetDepthBetweenBones使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FBoneContainer
的用法示例。
在下文中一共展示了FBoneContainer::GetDepthBetweenBones方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMaskWeights
void FAnimationRuntime::CreateMaskWeights(TArray<FPerBoneBlendWeight> & BoneBlendWeights, const TArray<FInputBlendPose> &BlendFilters, const FBoneContainer& RequiredBones, const USkeleton* Skeleton)
{
if ( Skeleton )
{
const TArray<FBoneIndexType> & RequiredBoneIndices = RequiredBones.GetBoneIndicesArray();
BoneBlendWeights.Empty(RequiredBoneIndices.Num());
BoneBlendWeights.AddZeroed(RequiredBoneIndices.Num());
// base mask bone
for (int32 PoseIndex=0; PoseIndex<BlendFilters.Num(); ++PoseIndex)
{
const FInputBlendPose& BlendPose = BlendFilters[PoseIndex];
for (int32 BranchIndex=0; BranchIndex<BlendPose.BranchFilters.Num(); ++BranchIndex)
{
const FBranchFilter& BranchFilter = BlendPose.BranchFilters[BranchIndex];
int32 MaskBoneIndex = RequiredBones.GetPoseBoneIndexForBoneName(BranchFilter.BoneName);
// how much weight increase Per depth
float MaxWeight = (BranchFilter.BlendDepth > 0) ? 1.f : -1.f;
float IncreaseWeightPerDepth = (BranchFilter.BlendDepth != 0) ? (1.f/((float)BranchFilter.BlendDepth)) : 1.f;
// go through skeleton tree requiredboneindices
for (int32 BoneIndex = 0; BoneIndex<RequiredBoneIndices.Num(); ++BoneIndex)
{
int32 MeshBoneIndex = RequiredBoneIndices[BoneIndex];
int32 Depth = RequiredBones.GetDepthBetweenBones(MeshBoneIndex, MaskBoneIndex);
// if Depth == -1, it's not a child
if( Depth != -1 )
{
// when you write to buffer, you'll need to match with BasePoses BoneIndex
FPerBoneBlendWeight& BoneBlendWeight = BoneBlendWeights[BoneIndex];
BoneBlendWeight.SourceIndex = PoseIndex;
float BlendIncrease = IncreaseWeightPerDepth * (float)(Depth + 1);
BoneBlendWeight.BlendWeight = FMath::Clamp<float>(BoneBlendWeight.BlendWeight + BlendIncrease, 0.f, 1.f);
}
}
}
}
}
}