Search in sources :

Example 1 with FbxSkin

use of com.jme3.scene.plugins.fbx.objects.FbxSkin in project jmonkeyengine by jMonkeyEngine.

the class SceneLoader method loadDeformer.

private FbxObject loadDeformer(FbxElement element) {
    String type = (String) element.properties.get(2);
    switch(type) {
        case "Skin":
            FbxSkin skinData = new FbxSkin(this, element);
            skinMap.put(skinData.id, skinData);
            return skinData;
        case "Cluster":
            FbxCluster clusterData = new FbxCluster(this, element);
            return clusterData;
    }
    return null;
}
Also used : FbxCluster(com.jme3.scene.plugins.fbx.objects.FbxCluster) FbxSkin(com.jme3.scene.plugins.fbx.objects.FbxSkin)

Example 2 with FbxSkin

use of com.jme3.scene.plugins.fbx.objects.FbxSkin in project jmonkeyengine by jMonkeyEngine.

the class SceneLoader method applySkinning.

private void applySkinning() {
    for (FbxBindPose pose : bindMap.values()) pose.fillBindTransforms();
    if (limbMap == null)
        return;
    List<Bone> bones = new ArrayList<>();
    for (FbxNode limb : limbMap.values()) {
        if (limb.bone != null) {
            bones.add(limb.bone);
            limb.buildBindPoseBoneTransform();
        }
    }
    skeleton = new Skeleton(bones.toArray(new Bone[bones.size()]));
    skeleton.setBindingPose();
    for (FbxNode limb : limbMap.values()) limb.setSkeleton(skeleton);
    for (FbxSkin skin : skinMap.values()) skin.generateSkinning();
    // Attach controls
    animControl = new AnimControl(skeleton);
    sceneNode.addControl(animControl);
    SkeletonControl control = new SkeletonControl(skeleton);
    sceneNode.addControl(control);
}
Also used : FbxNode(com.jme3.scene.plugins.fbx.objects.FbxNode) FbxBindPose(com.jme3.scene.plugins.fbx.objects.FbxBindPose) ArrayList(java.util.ArrayList) FbxSkin(com.jme3.scene.plugins.fbx.objects.FbxSkin) SkeletonControl(com.jme3.animation.SkeletonControl) Skeleton(com.jme3.animation.Skeleton) Bone(com.jme3.animation.Bone) AnimControl(com.jme3.animation.AnimControl)

Aggregations

FbxSkin (com.jme3.scene.plugins.fbx.objects.FbxSkin)2 AnimControl (com.jme3.animation.AnimControl)1 Bone (com.jme3.animation.Bone)1 Skeleton (com.jme3.animation.Skeleton)1 SkeletonControl (com.jme3.animation.SkeletonControl)1 FbxBindPose (com.jme3.scene.plugins.fbx.objects.FbxBindPose)1 FbxCluster (com.jme3.scene.plugins.fbx.objects.FbxCluster)1 FbxNode (com.jme3.scene.plugins.fbx.objects.FbxNode)1 ArrayList (java.util.ArrayList)1