NCSA Portfolio Java3D Libraries

MASON's sim/portrayal3d/simple/BranchPortrayal3D class can load and use 3D scene and object files given the right loader software. Unfortunately Java3D only provides two such software: for Alias Wavefront OBJ files and Lightwave LWO and LWS files respectively. The NCSA Portfolio Java3D library extends this to a large number of file types.

We'd include this as part of the standard MASON library kit except that it's not open source: you can only use and distribute this code for "academic, research, and internal business purposes only without a fee". So we include it here separately.

NCSA Portfolio contains a lot of useful Java3D extensions. But for our purposes the crucial class is ncsa.j3d.loaders.ModelLoader file, which can be used with BranchPortrayal3D to load a variety of files like this:

ncsa.j3d.loaders.ModelLoader loader = new ncsa.j3d.loaders.ModelLoader();

    // then either ...
com.sun.j3d.loaders.Scene scene = loader.load(new java.net.URL("URL to your scene file"));
    // or...
com.sun.j3d.loaders.Scene scene = loader.load("File Name for your scene file");

BranchGroupPortrayal3D bgp = new BranchGroupPortrayal3D(scene.getSceneGroup());
    // or some other BranchGroupPortrayal3D constructor

The Files