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;
}
}
Aggregations