Java 类com.badlogic.gdx.graphics.g3d.model.NodeAnimation 实例源码

项目:libgdxcn    文件:Model.java   
private void loadAnimations (Iterable<ModelAnimation> modelAnimations) {
    for (final ModelAnimation anim : modelAnimations) {
        Animation animation = new Animation();
        animation.id = anim.id;
        for (ModelNodeAnimation nanim : anim.nodeAnimations) {
            final Node node = getNode(nanim.nodeId);
            if (node == null) continue;
            NodeAnimation nodeAnim = new NodeAnimation();
            nodeAnim.node = node;
            for (ModelNodeKeyframe kf : nanim.keyframes) {
                if (kf.keytime > animation.duration) animation.duration = kf.keytime;
                NodeKeyframe keyframe = new NodeKeyframe();
                keyframe.keytime = kf.keytime;
                keyframe.rotation.set(kf.rotation == null ? node.rotation : kf.rotation);
                keyframe.scale.set(kf.scale == null ? node.scale : kf.scale);
                keyframe.translation.set(kf.translation == null ? node.translation : kf.translation);
                nodeAnim.keyframes.add(keyframe);
            }
            if (nodeAnim.keyframes.size > 0) animation.nodeAnimations.add(nodeAnim);
        }
        if (animation.nodeAnimations.size > 0) animations.add(animation);
    }
}
项目:gdx-proto    文件:HeadlessModel.java   
private void loadAnimations (Iterable<ModelAnimation> modelAnimations) {
    for (final ModelAnimation anim : modelAnimations) {
        Animation animation = new Animation();
        animation.id = anim.id;
        for (ModelNodeAnimation nanim : anim.nodeAnimations) {
            final Node node = getNode(nanim.nodeId);
            if (node == null) continue;
            NodeAnimation nodeAnim = new NodeAnimation();
            nodeAnim.node = node;
            for (ModelNodeKeyframe kf : nanim.keyframes) {
                if (kf.keytime > animation.duration) animation.duration = kf.keytime;
                NodeKeyframe keyframe = new NodeKeyframe();
                keyframe.keytime = kf.keytime;
                keyframe.rotation.set(kf.rotation == null ? node.rotation : kf.rotation);
                keyframe.scale.set(kf.scale == null ? node.scale : kf.scale);
                keyframe.translation.set(kf.translation == null ? node.translation : kf.translation);
                nodeAnim.keyframes.add(keyframe);
            }
            if (nodeAnim.keyframes.size > 0) animation.nodeAnimations.add(nodeAnim);
        }
        if (animation.nodeAnimations.size > 0) animations.add(animation);
    }
}
项目:vtm    文件:SharedModel.java   
private void copyAnimations (final Iterable<Animation> source) {
    for (final Animation anim : source) {
        Animation animation = new Animation();
        animation.id = anim.id;
        animation.duration = anim.duration;
        for (final NodeAnimation nanim : anim.nodeAnimations) {
            final Node node = getNode(nanim.node.id);
            if (node == null)
                continue;
            NodeAnimation nodeAnim = new NodeAnimation();
            nodeAnim.node = node;
            for (final NodeKeyframe kf : nanim.keyframes) {
                NodeKeyframe keyframe = new NodeKeyframe();
                keyframe.keytime = kf.keytime;
                keyframe.rotation.set(kf.rotation);
                keyframe.scale.set(kf.scale);
                keyframe.translation.set(kf.translation);
                nodeAnim.keyframes.add(keyframe);
            }
            if (nodeAnim.keyframes.size > 0)
                animation.nodeAnimations.add(nodeAnim);
        }
        if (animation.nodeAnimations.size > 0)
            animations.add(animation);
    }
}
项目:libgdxcn    文件:ModelInstance.java   
private void copyAnimations (final Iterable<Animation> source, boolean shareKeyframes) {
    for (final Animation anim : source) {
        Animation animation = new Animation();
        animation.id = anim.id;
        animation.duration = anim.duration;
        for (final NodeAnimation nanim : anim.nodeAnimations) {
            final Node node = getNode(nanim.node.id);
            if (node == null) continue;
            NodeAnimation nodeAnim = new NodeAnimation();
            nodeAnim.node = node;
            if (shareKeyframes)
                nodeAnim.keyframes = nanim.keyframes;
            else {
                for (final NodeKeyframe kf : nanim.keyframes) {

                    NodeKeyframe keyframe = new NodeKeyframe();
                    keyframe.keytime = kf.keytime;
                    keyframe.rotation.set(kf.rotation);
                    keyframe.scale.set(kf.scale);
                    keyframe.translation.set(kf.translation);
                    nodeAnim.keyframes.add(keyframe);
                }
            }
            if (nodeAnim.keyframes.size > 0) animation.nodeAnimations.add(nodeAnim);
        }
        if (animation.nodeAnimations.size > 0) animations.add(animation);
    }
}
项目:libgdxcn    文件:BaseAnimationController.java   
/** Remove the specified animation, by marking the affected nodes as not animated. When switching animation, this should be call
 * prior to applyAnimation(s). */
protected void removeAnimation (final Animation animation) {
    for (final NodeAnimation nodeAnim : animation.nodeAnimations) {
        nodeAnim.node.isAnimated = false;
    }
}