Are you sure loadScene isn't throwing an exception? Are you sure you are passing the correct path to the object file? Assuming the loader uses Class.getResource(String path) to get the file url then depending on whether you start the path with a slash or not will change where the loader looks for the file. As it is coded it probably looks in a directory ./java3d/java3d/3dobjects/... where as you pobably have the files stored in ./java3d/3dobjects/...
so try it with a slash in front of the pathname. ----- Original Message ----- From: "Fredrik Andersson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, December 11, 2003 1:27 PM Subject: [JAVA3D] SV: [JAVA3D] Problems with 3DS objects (test code valid) > Hello! > > I changed my code to this but still nothing to see. > I guess that it is smarter to just extract the model instead of the scene (I > guess that is what this now is doing). > > package java3d; > > import java.applet.*; > import java.awt.*; > import java.awt.Frame; > import java.awt.event.*; > import com.sun.j3d.utils.applet.MainFrame; > import com.sun.j3d.utils.universe.*; > import com.sun.j3d.utils.geometry.*; > import com.sun.j3d.utils.behaviors.keyboard.*; > import javax.media.j3d.*; > import javax.vecmath.*; > import javax.swing.*; > import com.sun.j3d.loaders.*; > > import java.util.*; > > import com.mnstarfire.loaders3d.*; > > public class TestLoad extends Applet > { > BranchGroup branchGroup; > > > public void init() > { > setLayout(new BorderLayout()); > GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); > Canvas3D canvas3D = new Canvas3D(config); > add("Center", canvas3D); > SimpleUniverse simpleUniverse = new SimpleUniverse(canvas3D); > branchGroup = new BranchGroup(); > > //Scene scene = loadScene(); > //branchGroup = scene.getSceneGroup(); > > Inspector3DS loader = new Inspector3DS("java3d/3dobjects/girl.3DS"); > loader.parseIt(); > loader.setDetail(9); > loader.setTextureLightingOn(); > TransformGroup theModel = loader.getModel(); > Transform3D transform3D1 = new Transform3D(); > transform3D1.set(new Vector3f(0.0f, 0.0f, -5.0f)); > theModel.setTransform(transform3D1); > theModel.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); > branchGroup.addChild(theModel); > > addDirectionalLight(new Vector3f(0.0f, 0.0f, -5.0f), new Color3f(0.9f, > 0.9f, 0.9f)); > addDirectionalLight(new Vector3f(0.0f, 0.0f, -5.0f), new Color3f(0.9f, > 0.9f, 0.9f)); > addAmbientLight( new Color3f(0.9f, 0.9f, 0.9f) ); > > branchGroup.compile(); > simpleUniverse.addBranchGraph(branchGroup); > } > > public void addDirectionalLight(Vector3f direction, Color3f color) > { > BoundingSphere bounds = new BoundingSphere(); > bounds.setRadius(1000d); > > DirectionalLight lightD = new DirectionalLight(color, direction); > lightD.setInfluencingBounds(bounds); > > branchGroup.addChild(lightD); > } > > public void addAmbientLight(Color3f color) > { > BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), > 100.0); > AmbientLight ambientLightNode = new AmbientLight(color); > ambientLightNode.setInfluencingBounds(bounds); > > branchGroup.addChild(ambientLightNode); > } > > public Scene loadScene() > { > Scene scene = null; > > Loader3DS loader = new Loader3DS(); > try > { > scene = loader.load("java3d/3dobjects/girl.3DS"); > } > catch(Exception exception) > { > } > return scene; > } > > public static void main(String[] args) > { > Frame frame = new MainFrame(new TestLoad(), 600, 400); > } > } > > =========================================================================== > 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". =========================================================================== 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".