ModelBlockAnimation.java 文件源码

java
阅读 15 收藏 0 点赞 0 评论 0

项目:CustomWorldGen 作者:
public TRSRTransformation getPartTransform(IModelState state, BlockPart part, int i)
{
    ImmutableCollection<MBJointWeight> infos = getJoint(i);
    if(!infos.isEmpty())
    {
        Matrix4f m = new Matrix4f(), tmp;
        float weight = 0;
        for(MBJointWeight info : infos)
        {
            if(info.getWeights().containsKey(i))
            {
                ModelBlockAnimation.MBJoint joint = new ModelBlockAnimation.MBJoint(info.getName(), part);
                Optional<TRSRTransformation> trOp = state.apply(Optional.of(joint));
                if(trOp.isPresent() && trOp.get() != TRSRTransformation.identity())
                {
                    float w = info.getWeights().get(i)[0];
                    tmp = trOp.get().getMatrix();
                    tmp.mul(w);
                    m.add(tmp);
                    weight += w;
                }
            }
        }
        if(weight > 1e-5)
        {
            m.mul(1f / weight);
            return new TRSRTransformation(m);
        }
    }
    return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号