这确实是这样做的常见方式,例如, (这是HLSL,但基本相同 - 请注意全球统一的'boneArray')
float4x3 CalcBoneTransform(float4 blendWeights, float4 boneIndices)
{
// Calculate normalized fourth bone weight2
float4 weights = float4(blendWeights.x, blendWeights.y, blendWeights.z , 1.0f - blendWeights.x - blendWeights.y - blendWeights.z);
// Calculate bone transform
float4x3 boneTransform;
int4 indices = boneIndices;
boneTransform = weights.x * boneArray[indices.x];
boneTransform += weights.y * boneArray[indices.y];
boneTransform += weights.z * boneArray[indices.z];
boneTransform += weights.w * boneArray[indices.w];
return boneTransform;
}
感谢您的回应!事实证明,事实上,可以为我的平台(Playstation Mobile)做到这一点,但是有一个未记录的怪癖,这意味着一个单一的统一阵列最多只能有256个字节(这样一个由4个4×4矩阵组成的阵列) 。一旦我发现了这一点,这是一个简单的问题,我的骨头阵列拆分成256个字节的单个块。 – DAVco