OBJ Importer Issues

The OBJ file importer is fairly picky when it comes to whitespace.  I have found that changing the following line:



toReturn[index++]=parts[i];



in the removeEmpty method to:


toReturn[index++]=parts[i].trim();



Seems to help significantly with the accuracy of the model loading (most notably, missing textures).  Many exporters write textures out with the texture detail information tabbed/spaced in, causing the importer to miss them.

Also, it seems that many exporters have no problem writing u/v coordinates out of the [0-1] range.  When they do this, they assume that WRAP will be used as the texture bounding mode, however CLAMP is the current default.  I added the following line:


t.setWrap(Texture.WM_WRAP_S_WRAP_T);



to the method processLine, here:


            Texture t=new Texture();

            t.setWrap(Texture.WM_WRAP_S_WRAP_T);

            t.setImageLocation("file:/"+s.trim().substring(6));
            curGroup.ts.setTexture(t);
            curGroup.ts.setEnabled(true);
            return;



which causes these OBJ files to import correctly.  I have not yet seen an obj file which uses the CLAMP mode, although I guess this is possible.  If this is the case, perhaps a property could be set on the converter and used here?

--Ruab

changes made and committed. Thank you!

this is related to obj importer, some modeling programs export with 4 verts to a face not 3 this may or may not be obj standard but does it hurt to add it in?