Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java 3D > Problem with 3d...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 797 of 818
Post > Topic >>

Problem with 3ds loader

by "cooljprincess" <u38717@[EMAIL PROTECTED] > Nov 1, 2007 at 07:38 AM

I've tried starfire loader for .3ds files, and I cannot see anything. Yes,
it
loads OK (no errors) but no image is seen.
here is my code


import java.awt.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;
 
import java.applet.Applet;
import com.sun.j3d.utils.applet.MainFrame;
 
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.loaders.Scene;
 
import java.net.URL;
import java.net.MalformedURLException;
 
import com.sun.j3d.loaders.ParsingErrorException;
import com.sun.j3d.loaders.IncorrectFormatException;
import java.io.FileNotFoundException;
 
import com.mnstarfire.loaders3d.Loader3DS; 
//import com.microcrowd.loader.java3d.max3ds.Loader3DS;
//import com.mnstarfire.loaders3d.Inspector3DS;
 
 
public class load3d extends Applet
{
      
  private Canvas3D c;
       
       public load3d()
		 {
		        setLayout(new BorderLayout());
              GraphicsConfiguration config =
              SimpleUniverse.getPreferredConfiguration();
              c = new Canvas3D(config);
              add("Center",c);
              SimpleUniverse u = new SimpleUniverse();
              BranchGroup scene = createSceneBranchGroup();
              u.getViewingPlatform().setNominalViewingTransform();
              u.addBranchGraph(scene);
		 }
 
 
 
		 protected BranchGroup createSceneBranchGroup()
       {
              BranchGroup objRoot = new BranchGroup();
        
		 
              TransformGroup objTrans1 = new TransformGroup();
              Transform3D tr = new Transform3D();
              objTrans1.getTransform( tr );
           // tr.rotX(90.0 * Math.PI / 180.0);
              tr.setScale( 0.7 );
              objTrans1.setTransform( tr );
              TransformGroup objTrans2 = new TransformGroup();
             
objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
             
objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
     
	 BoundingSphere bounds = new BoundingSphere(
                                      new Point3d(0.0,0.0,0.0), 100.0);
												  
												 
              //Set up the global lights
              Color3f lColor1 = new Color3f(0.7f, 0.7f, 0.7f);
              Vector3f lDir1 = new Vector3f(1.0f, 1.0f, 1.0f);
              Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);
              AmbientLight aLgt = new AmbientLight(alColor);
              aLgt.setInfluencingBounds(bounds);
              DirectionalLight lgt1 = new DirectionalLight(lColor1,
lDir1);
              lgt1.setInfluencingBounds(bounds);
              objRoot.addChild(aLgt);
              objRoot.addChild(lgt1);
				 
				  
             //load the object file
 
				  
                Loader3DS loader = new Loader3DS();
	 loader.setFlags(Loader3DS.LOAD_ALL);
			  
 
                 Scene scene = null;
	 try{
	 scene = loader.load("3Dimka_Pink_Panther_ready.3DS");
	 }
	 catch (Exception e)
              {
              scene = null;
              System.err.println(e);
              }
              if( scene == null )
                  System.exit(1);
				
	
              //connect the scenegraph
              objTrans2.addChild( scene.getSceneGroup() );
              objTrans1.addChild( objTrans2 );  
              objRoot.addChild( objTrans1 );
				  
	 // Set up the background
              Color3f bgColor = new Color3f(0.05f, 0.05f, 0.5f);
              Background bgNode = new Background(bgColor);
              bgNode.setApplicationBounds(bounds);
              objRoot.addChild(bgNode);
    
              return objRoot;
       }
 
 
 
		 public static void main(String[] args)
       {
		        load3d t = new load3d();				  
       }
}
 


what should I do to get the model on screen, is it something wrong with
the
model if so please show me where I can get a model that works(just for the
test). 

Does anyone have an example that uses any of the free .3ds loaders that
actually WORKS?

THANKS!




 1 Posts in Topic:
Problem with 3ds loader
"cooljprincess"  2007-11-01 07:38:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 12:37:13 CDT 2008.