PDA

View Full Version : JAVA3d help


the other guy
Jul9-10, 05:18 PM
Ok, so I need a hand with using loaders. I want to know where to put a loader file if I want to use it in JAVA 3d. this will be my first program in Java3d. I am relatively new to in depth java, and have a lot of modeling experience. If I can load my models into the J3d enviornment, it will make it way easier for me to teach myself because I can manipulate my own models.

With that said, I only need the following answered-

Once I install JAVA3d, it installs in a seperate folder than the JDK I am currently working with. Are those libraries automatically reconized by my JDK, or do I have to do soem work and reference it's location somewhere in my tools (I'm using EDITPLUS 3).

Where do I put my Loader? I am using the milkshape "MS3DLoader-1.0.8.jar" loader.

Also, I have the code here, but the thing is, I'm not 100% sure where to put in the name of my model, "BOB". I think its at the bottom, where it says "raptor.ms3d". the model will currently be in the same folder as the class we are programming here.

Setup:

import com.sun.j3d.loaders.*;
import com.glyphein.j3d.loaders.milkshape.MS3DLoader;

Loader loader = new MS3DLoader(MS3DLoader.LOAD_ALL);

Loading a model from a URL:

com.sun.j3d.loaders.Scene scene = loader.load(url);
BranchGroup group = scene.getSceneGroup();

Loading a model from a file:

java.io.File file = new java.io.File("raptor.ms3d");
if (file.getParent().length() > 0) // figure out the base path
loader.setBasePath(file.getParent() + java.io.File.separator);
Scene scene = loader.load(file.getName());
BranchGroup group = scene.getSceneGroup();