Got part of it...
In the method of OBJLoader
private void load(BufferedReader bufferedReader, NodeFactory factory,
Vector3f vec, LoadedGraph<SceneGraphObject> graph)
throws IOException {
In this line, around 145 of the OBJLoader class, currentApp was always null.
else if (line.startsWith("usemtl")) {
String name = line.substring(line.indexOf(" ") + 1);
currentApp = matMap.get(name);
}
I think it is because my *mtl file contains more than one entry. The prblem is the line below return a single Appearance no matter how many are defined in the file, in my case many.
Appearance app = matLoader.parse(name);
My hack fix is o add a static public HashMap to MaterialLibLoader which hold all of the Appearance defined, indexed by Appearance name. i then hacked the line as follows to extract the current Appearance from my HashMap. This is an almost complete fix for me.
else if (line.startsWith("usemtl")) {
String name = line.substring(line.indexOf(" ") + 1);
System.out.println("usemtl:name "+name);
currentApp =(Appearance) MaterialLibLoader.allApps.get(name);
// currentApp = matMap.get(name);
}
I do need to point out in previous version this was not a problem.
My mtl file looks like this, note more than one "newmtl" entry
===================================================
#Produced by Art of Illusion 2.3.1, Sat Dec 09 09:36:11 EST 2006
newmtl rain_1
Kd 1 1 1
map_Kd Untitled131.png
Ks 1 1 1
map_Ks Untitled132.png
Ka 0 0 0
illum 2
Ns 129
newmtl note
Kd 1 1 1
map_Kd Untitled49.png
Ks 0 0 0
Ka 0.8 0.3 0
illum 1
newmtl hide_1
Kd 1 1 1
map_Kd Untitled107.png
Ks 0.3 0.3 0.12
Ka 0 0 0
illum 2
Ns 103
newmtl silver_4
Kd 1 1 1
map_Kd Untitled29.png
Ks 0.3 0.3 0.3
Ka 0 0 0
illum 2
Ns 103