@@ -58,8 +58,8 @@ public PShapeOBJ(PApplet parent, BufferedReader reader, String basePath) {
5858 ArrayList <PVector > coords = new ArrayList <PVector >();
5959 ArrayList <PVector > normals = new ArrayList <PVector >();
6060 ArrayList <PVector > texcoords = new ArrayList <PVector >();
61- parseOBJ (parent , basePath , reader ,
62- faces , materials , coords , normals , texcoords );
61+ parseOBJ (parent , basePath ,
62+ reader , faces , materials , coords , normals , texcoords );
6363
6464 // The OBJ geometry is stored with each face in a separate child shape.
6565 parent = null ;
@@ -222,23 +222,22 @@ static protected void parseOBJ(PApplet parent, String path,
222222 if (parts [0 ].equals ("v" )) {
223223 // vertex
224224 PVector tempv = new PVector (Float .valueOf (parts [1 ]).floatValue (),
225- Float .valueOf (parts [2 ]).floatValue (),
226- Float .valueOf (parts [3 ]).floatValue ());
225+ Float .valueOf (parts [2 ]).floatValue (),
226+ Float .valueOf (parts [3 ]).floatValue ());
227227 coords .add (tempv );
228228 readv = true ;
229229 } else if (parts [0 ].equals ("vn" )) {
230230 // normal
231231 PVector tempn = new PVector (Float .valueOf (parts [1 ]).floatValue (),
232- Float .valueOf (parts [2 ]).floatValue (),
233- Float .valueOf (parts [3 ]).floatValue ());
232+ Float .valueOf (parts [2 ]).floatValue (),
233+ Float .valueOf (parts [3 ]).floatValue ());
234234 normals .add (tempn );
235235 readvn = true ;
236236 } else if (parts [0 ].equals ("vt" )) {
237237 // uv, inverting v to take into account Processing's inverted Y axis
238238 // with respect to OpenGL.
239239 PVector tempv = new PVector (Float .valueOf (parts [1 ]).floatValue (),
240- 1 - Float .valueOf (parts [2 ]).
241- floatValue ());
240+ 1 - Float .valueOf (parts [2 ]).floatValue ());
242241 texcoords .add (tempv );
243242 readvt = true ;
244243 } else if (parts [0 ].equals ("o" )) {
@@ -252,7 +251,8 @@ static protected void parseOBJ(PApplet parent, String path,
252251 }
253252 BufferedReader mreader = parent .createReader (fn );
254253 if (mreader != null ) {
255- parseMTL (parent , path , mreader , materials , mtlTable );
254+ parseMTL (parent , path ,
255+ mreader , materials , mtlTable );
256256 }
257257 }
258258 } else if (parts [0 ].equals ("g" )) {
@@ -432,14 +432,10 @@ static protected class OBJFace {
432432
433433
434434 static protected String getBasePath (PApplet parent , String filename ) {
435- // Obtaining the path
436- File file = new File (parent .dataPath (filename ));
437- if (!file .exists ()) {
438- file = parent .sketchFile (filename );
435+ if (-1 < filename .indexOf (File .separator )) {
436+ return filename .substring (0 , filename .lastIndexOf (File .separator ));
439437 }
440- String absolutePath = file .getAbsolutePath ();
441- return absolutePath .substring (0 ,
442- absolutePath .lastIndexOf (File .separator ));
438+ return "" ;
443439 }
444440
445441
0 commit comments