Luigi, I sent as an attach the lines of code you'll need to load DEF-ed
VRML Nodes. Sorry, that could be include in the mail, but my pine lost all
the indentation as I pasted it.

                                Fabio



On Sun, 12 Mar 2000, luigi wrote:

> I need to load an VRLM file in my Java3D program but i have nerver done
> that, so i don't know how to do it. In the tutorial says that is there
> one loader implemented (in the util class, i think) but i don't know
> where, and also i don't know how to use it. Can anybody tell me what
> class i have to use and how i have to do it. (any simple piece of code
> will be apreciated...)
> Also i need the documentation of the java3d.util class... where can i
> find it??
>
> thanx in advance...
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

import com.sun.j3d.loaders.Scene;
import com.sun.j3d.loaders.vrml97.VrmlLoader;
import com.sun.j3d.loaders.vrml97.VrmlScene;
import java.util.Hashtable;
import java.io.*;


    Scene scene;
    VrmlLoader vrmlLoader;
    Hashtable hashtable;

        vrmlLoader = new VrmlLoader();
        System.out.println("Opening VRML");
        /* Read the file */
        try {
             System.out.println("Parsing VRML file");
             scene = vrmlLoader.load("meshes/sandBox.WRL");
             System.out.println("VRML file parsed");
        } catch (IOException e){
            System.out.println("VRML file not found.");
        }
        /* Get a hashtable with all the named objects */
        hashtable = scene.getNamedObjects();

        /* Reading transforms from just loaded VRML scene
         */
        box01PosTG = (TransformGroup)hashtable.get("Box01");
        box02PosTG = (TransformGroup)hashtable.get("Box02");
        box03PosTG = (TransformGroup)hashtable.get("Box03");

        powerUp01AnimTG = (TransformGroup)hashtable.get("powerUp01");
        powerUp02AnimTG = (TransformGroup)hashtable.get("powerUp02"); ;
        powerUp03AnimTG = (TransformGroup)hashtable.get("powerUp03");;

        woxbotRotTG = (TransformGroup)hashtable.get("Track");

Reply via email to