Fredrik, You moved your view in the wrong direction. Your loaded model is BEHIND the view. There are all kinds of problems you can have. It's very possible your model is far too large. As was mentioned before it's very possible you are "inside" your model. You need to look at the vertex data to get an idea how big your model is. Read the log file our loader can generate for that model and get an idea how big the model is.
- John Wright Starfire Research Fredrik Andersson wrote: > > 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".