}
if (MT4jSettings.getInstance().isOpenGlMode()){
PImage img = pa.loadImage(basePath + tFile);
if (Tools3D.isPowerOfTwoDimension(img)){
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
}else{
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.RECTANGULAR, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
// ((GLTexture)texture).setFilter(SHRINKAGE_FILTER.BilinearNoMipMaps, EXPANSION_FILTER.Bilinear);
}
}else{
texture = pa.loadImage(basePath + tFile);
}
textureCache.put(tFile, texture);
}else{
System.out.println("Trying to load obj texture from: " + basePath + tFile);
if (MT4jSettings.getInstance().isOpenGlMode()){
PImage img = pa.loadImage(basePath + tFile);
if (Tools3D.isPowerOfTwoDimension(img)){
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
}else{
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.RECTANGULAR, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
// ((GLTexture)texture).setFilter(SHRINKAGE_FILTER.BilinearNoMipMaps, EXPANSION_FILTER.Bilinear);
}
}else{
texture = pa.loadImage(basePath + tFile);
}
textureCache.put(tFile, texture);
}
}
// RgbFile f;
// if (fromUrl) {
// f = new RgbFile(new URL(basePath + tFile).openStream());
// } else {
// f = new RgbFile(new FileInputStream(basePath + tFile));
// }
// BufferedImage bi = f.getImage();
boolean luminance = suffix.equals("int") || suffix.equals("inta");
boolean alpha = suffix.equals("inta") || suffix.equals("rgba");
cur.transparent = alpha;
String s = null;
if (luminance && alpha) s = "LUM8_ALPHA8";
else if (luminance) s = "LUMINANCE";
else if (alpha) s = "RGBA";
else s = "RGB";
// t = new TextureLoader(bi, s, TextureLoader.GENERATE_MIPMAP);
} else {
// tFile.toLowerCase();
// tFile.toLowerCase(Locale.ENGLISH);
// basePath.toLowerCase();
PImage cachedImage = textureCache.get(tFile);
if (cachedImage != null){
texture = cachedImage;
//System.out.println("->Loaded texture from CACHE : \"" + tFile + "\"");
}else{
File textureFile = new File(basePath + tFile);
if (textureFile.exists()){
boolean success = textureFile.renameTo(new File(basePath + tFile));
if (!success) {
// File was not successfully renamed
System.out.println("failed to RENAME file: " + textureFile.getAbsolutePath());
}
if (MT4jSettings.getInstance().isOpenGlMode()){
PImage img = pa.loadImage(basePath + tFile);
if (Tools3D.isPowerOfTwoDimension(img)){
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
}else{
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.RECTANGULAR, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
// ((GLTexture)texture).setFilter(SHRINKAGE_FILTER.BilinearNoMipMaps, EXPANSION_FILTER.Bilinear);
}
}else{
texture = pa.loadImage(basePath + tFile);
}
textureCache.put(tFile, texture);
}else{
System.out.println("Trying to load obj texture from: " + basePath + tFile);
if (MT4jSettings.getInstance().isOpenGlMode()){
PImage img = pa.loadImage(basePath + tFile);
if (Tools3D.isPowerOfTwoDimension(img)){
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.TEXTURE_2D, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
}else{
texture = new GLTexture(pa, img, new GLTextureSettings(TEXTURE_TARGET.RECTANGULAR, SHRINKAGE_FILTER.Trilinear, EXPANSION_FILTER.Bilinear, WRAP_MODE.REPEAT, WRAP_MODE.REPEAT));
// ((GLTexture)texture).setFilter(SHRINKAGE_FILTER.BilinearNoMipMaps, EXPANSION_FILTER.Bilinear);
}
}else{
texture = pa.loadImage(basePath + tFile);
}