I am having problems loading a .3ds model. I am using the ncsa model loader used in Killer Game Programming in Java. I think this problem is caused by the program being inside of a jar because the code works when the class files are on their own. The code that actually loads the model is here. I encountered a similar problem when loading images from within a .jar but remedied this with a solution not applicable to 3D models. Any advice on how to get this loader working would be appreciated.:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| private void loadModel(String fn) { FileWriter ofw = null; System.out.println( "Loading: " + fn );
try { ModelLoader loader = new ModelLoader(); loadedScene = loader.load(fn); if(loadedScene != null ) { loadedBG = loadedScene.getSceneGroup(); Transform3D t3d = new Transform3D(); t3d.rotX( -Math.PI/2.0 ); Vector3d scaleVec = calcScaleFactor(loadedBG, fn); t3d.setScale( scaleVec );
TransformGroup tg = new TransformGroup(t3d); tg.addChild(loadedBG);
sceneBG.addChild(tg); } else System.out.println("Load error with: " + fn); } catch( IOException ioe ) { System.err.println("Could not find object file: " + fn); } } |