I'm trying to use Brendan's object loader for wavefront objects. The problem I'm having is it looks like his load routine takes in a string name, and then checks the .obj's first line to see if it specifies a texture:
Using java Syntax Highlighting
protected static final String[] suffs = new String[] {".jpg", ".png", ".gif"};
Parsed in 0.034 seconds, using
GeSHi 1.0.8.4
Using java Syntax Highlighting
public Model load(String file)
throws IOException
{
Model m = load(new FileInputStream(file));
int ix = file.indexOf(".obj");
if (ix != -1) {
String texture = file.substring(0, ix);
for (int i=0;i<suffs.length;i++) {
File f = new File(texture+suffs[i]);
if (f.exists()) {
m.getFrame(0).getMesh().setTextureFile(texture+suffs[i]);
break;
}
}
}
return m;
}
Parsed in 0.038 seconds, using
GeSHi 1.0.8.4
I have my .obj in the /src folder of my project as well as the texture, but it always fails when it tries to read the texture file. Where should I be storing these objects in my project for this code to work properly? Are there any examples for this code that are specificly using the WaveFront loader? Any help would be greatly appreciated.