protected static final String[] suffs = new String[] {".jpg", ".png", ".gif"};
Java: |
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; } |