jmeBinaryReader: texture loading problem with converted 3ds

hi there.



(i’m giving full paths here to clarify the problem)



i converted a 3ds to jme using

com.jme.scene.model.XMLparser.Converters.MaxToJme /Volumes/Data/Users/atze/Desktop/SOL2Stuff/LittleFighter/Fighter.3ds /Volumes/Data/Users/atze/Desktop/SOL2Stuff/LittleFighter/Fighter.jme



that worked fine with the 3ds being generated on a mac (MM format).

the textures Decayin0.bmp and Decayin1.bmp are in the same directory.



now i try to load the jme-model it with


   protected void simpleInitGame() {
      LoaderNode aFighter = new LoaderNode("Fighter");
      try {
         aFighter.loadFromFilePath("binary", "/Volumes/Data/Users/atze/Desktop/SOL2Stuff/LittleFighter/Fighter.jme", new HashMap());
      } catch (IOException e) {
         e.printStackTrace();
      }
      lightState.detachAll();
      rootNode.attachChild(aFighter);
   }



but it throws:


java.io.FileNotFoundException: /Volumes/Data/Users/atze/Source/JGL/LittleFighter/Decayin0.bmp (No such file or directory)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.<init>(FileInputStream.java:106)
   at java.io.FileInputStream.<init>(FileInputStream.java:66)
   at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69)
   at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156)
   at java.net.URL.openStream(URL.java:913)
   at com.jme.util.TextureManager.loadTexture(TextureManager.java:235)
   at com.jme.util.TextureManager.loadTexture(TextureManager.java:160)
   at com.jme.scene.model.XMLparser.JmeBinaryReader.buildTexture(JmeBinaryReader.java:809)
   at com.jme.scene.model.XMLparser.JmeBinaryReader.readBegining(JmeBinaryReader.java:178)
   at com.jme.scene.model.XMLparser.JmeBinaryReader.loadBinaryFormat(JmeBinaryReader.java:124)
   at com.jme.scene.model.XMLparser.LoaderNode.loadFromFilePath(LoaderNode.java:45)
   at Main.simpleInitGame(Main.java:31)
   at com.jme.app.SimpleGame.initGame(SimpleGame.java:344)
   at com.jme.app.BaseGame.start(BaseGame.java:64)
   at Main.main(Main.java:25)



what's the problem here? is it either
- the 3ds does have the wrong path in it (only LittleFighter/Decayin0.bmp) or
- LoaderNode assembles the path the wrong way?

/Volumes/Data/Users/atze/Source/JGL is my eclipse workspace containing both, jme and my test-project.
so how do i tell the LoaderNode how to find the texture?

and any insight on what the HashMap in loadFromFilePath is good for would be welcome as well :)

I really don’t know the answer to this, but I do notice this:



you load your model from -



/Volumes/Data/Users/atze/Desktop/SOL2Stuff/LittleFighter/



but it’s looking for the texture at -



/Volumes/Data/Users/atze/Source/JGL/LittleFighter/



Desktop/SOL2Stuff vs. Source/JGL



Any ideas where this descrepancy is coming from?

One of two things.


  1. Sometimes programs like milkshape or max will specify "specific" paths for textures that the .jme file will try to find. Make sure the path in max is relative.


  2. Try setting the texurl property to a URL where the “base” of the file path should be. For example, if in max your texture is suppose to be “mytexturesbugblue.jpg” and the actuall texture is in “c:programsmytexturesbugblue.jpg” then you’ll want to do something like this



JmeBinaryReader jbr=new JmeBinaryReader();
jbr.setProperty("texurl",new File("c:\programs").toURL())



If you play around with the file's location and the texture's location inside the model, along with texurl property, you should be able to get it to find the correct texture.