Search in sources :

Example 1 with VrmlLoader

use of org.jdesktop.j3d.loaders.vrml97.VrmlLoader in project ffx by mjschnie.

the class MolecularAssembly method loadVRML.

/**
 * <p>
 * loadVRML</p>
 *
 * @return a {@link javax.media.j3d.BranchGroup} object.
 */
public BranchGroup loadVRML() {
    try {
        VrmlLoader loader = new VrmlLoader();
        VrmlScene scene = null;
        if (vrmlFile != null && vrmlFile.exists()) {
            scene = (VrmlScene) loader.load(vrmlFile.getAbsolutePath());
        } else if (vrmlURL != null) {
            scene = (VrmlScene) loader.load(vrmlURL);
        } else {
            return null;
        }
        BranchGroup bg = scene.getSceneGroup();
        recurseVRML(bg);
        bg.setCapability(BranchGroup.ALLOW_DETACH);
        bg.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
        bg.compile();
        return bg;
    } catch (Exception e) {
        String message = "Fatal exception loading VRML.\n";
        logger.log(Level.SEVERE, message, e);
        System.exit(-1);
        return null;
    }
}
Also used : BranchGroup(javax.media.j3d.BranchGroup) VrmlScene(org.jdesktop.j3d.loaders.vrml97.VrmlScene) VrmlLoader(org.jdesktop.j3d.loaders.vrml97.VrmlLoader)

Aggregations

BranchGroup (javax.media.j3d.BranchGroup)1 VrmlLoader (org.jdesktop.j3d.loaders.vrml97.VrmlLoader)1 VrmlScene (org.jdesktop.j3d.loaders.vrml97.VrmlScene)1