Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Problem with 3ds loader  (Read 2158 times)
0 Members and 1 Guest are viewing this topic.
Offline Rahoobah

Junior Newbie





« Posted 2007-10-31 17:26:33 »

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


Quote
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();              
       }
}


I tried to use obj loader and it work but without the color

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!
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #1 - Posted 2007-11-07 16:32:09 »

http://www.flyingguns.com uses Starfires 3DS loader successfully.

If you like, I can give further hints where it is actually used in the source tree. Look for 'scene3d' project as a small-scale example.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (18 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (41 views)
2014-07-23 21:16:32

Riven (28 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!