Hello! I can't get this right. I try to load a object from a 3DS-file but it will not be visible in the Canvas. I do not know what I'm doing wrong. Perhaps my 3DS-files is corrupt, but I do not think so. I have also added lights. So if any one could give me some code that loads and show a 3DS-object I would be most thankfull.
My objects can be found at: http://medlem.spray.se/fredand44/questions/girl.3DS or http://medlem.spray.se/fredand44/questions/test.3DS The last one (test.3DS) doesn't seem to remain any Shape3D-objects strangely. So if any one could help me to load and add an 3DS-object, it would really make my day! PS I use starfire for loading the 3DS-file and I have looked at the CargadorBob.java but it doesn't help. So I think some code really should help. Best regards Fredrik My code for this: 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.Loader3DS; 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(); addDirectionalLight(new Vector3f(0.0f, 0.0f, -20.0f), new Color3f(0.9f, 0.9f, 0.9f)); addDirectionalLight(new Vector3f(0.0f, 0.0f, -20.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".