protected Texture loadTexture(String path){ String[] split = path.trim().split("\\p{javaWhitespace}+"); // will crash if path is an empty string path = split[split.length-1]; String name = new File(path).getName(); TextureKey texKey = new TextureKey(folderName + name); texKey.setGenerateMips(true); Texture texture; try { texture = assetManager.loadTexture(texKey); texture.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); texture = new Texture2D(PlaceholderAssets.getPlaceholderImage(assetManager)); texture.setWrap(WrapMode.Repeat); texture.setKey(key); } return texture; }
texture.setKey(textureKey); texture.setName(textureKey.getName());
/** Retrieve a basic clone of this Texture (ie, clone everything but the * image data, which is shared) * * @return Texture * * @deprecated Use {@link Texture#clone()} instead. */ @Deprecated public Texture createSimpleClone(Texture rVal) { rVal.setMinFilter(minificationFilter); rVal.setMagFilter(magnificationFilter); rVal.setShadowCompareMode(shadowCompareMode); rVal.setAnisotropicFilter(anisotropicFilter); rVal.setImage(image); // NOT CLONED. rVal.setKey(key); rVal.setName(name); return rVal; }
textures[texUnit].setMagFilter(loadedTexture.getMagFilter()); textures[texUnit].setAnisotropicFilter(loadedTexture.getAnisotropicFilter()); textures[texUnit].setKey(loadedTexture.getKey()); logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, matName}); textures[texUnit].setImage(PlaceholderAssets.getPlaceholderImage(assetManager)); textures[texUnit].setKey(texKey);
private void readExtendingMaterialStatement(Statement statement) throws IOException { if (statement.getLine().startsWith("set_texture_alias")){ String[] split = statement.getLine().split(" ", 3); String aliasName = split[1]; String texturePath = split[2]; String jmeParamName = matExt.getTextureMapping(aliasName); TextureKey texKey = new TextureKey(texturePath, false); texKey.setGenerateMips(true); Texture tex; try { tex = assetManager.loadTexture(texKey); tex.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); tex = new Texture2D( PlaceholderAssets.getPlaceholderImage(assetManager) ); tex.setWrap(WrapMode.Repeat); tex.setKey(texKey); } material.setTexture(jmeParamName, tex); } }
result.setKey(new GeneratedTextureKey(textureStructure.getName()));
protected Texture loadTexture(String path){ String[] split = path.trim().split("\\p{javaWhitespace}+"); // will crash if path is an empty string path = split[split.length-1]; String name = new File(path).getName(); TextureKey texKey = new TextureKey(folderName + name); texKey.setGenerateMips(true); Texture texture; try { texture = assetManager.loadTexture(texKey); texture.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); texture = new Texture2D(PlaceholderAssets.getPlaceholderImage(assetManager)); texture.setWrap(WrapMode.Repeat); texture.setKey(key); } return texture; }
texture.setKey(textureKey); texture.setName(textureKey.getName());
textures[texUnit].setKey(loadedTexture.getKey());
/** Retrieve a basic clone of this Texture (ie, clone everything but the * image data, which is shared) * * @return Texture * * @deprecated Use {@link Texture#clone()} instead. */ @Deprecated public Texture createSimpleClone(Texture rVal) { rVal.setMinFilter(minificationFilter); rVal.setMagFilter(magnificationFilter); rVal.setShadowCompareMode(shadowCompareMode); rVal.setAnisotropicFilter(anisotropicFilter); rVal.setImage(image); // NOT CLONED. rVal.setKey(key); rVal.setName(name); return rVal; }
textures[texUnit].setMagFilter(loadedTexture.getMagFilter()); textures[texUnit].setAnisotropicFilter(loadedTexture.getAnisotropicFilter()); textures[texUnit].setKey(loadedTexture.getKey()); logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, matName}); textures[texUnit].setImage(PlaceholderAssets.getPlaceholderImage(assetManager)); textures[texUnit].setKey(texKey);
textures[texUnit].setMagFilter(loadedTexture.getMagFilter()); textures[texUnit].setAnisotropicFilter(loadedTexture.getAnisotropicFilter()); textures[texUnit].setKey(loadedTexture.getKey()); logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, matName}); textures[texUnit].setImage(PlaceholderAssets.getPlaceholderImage(assetManager)); textures[texUnit].setKey(texKey);
private void readExtendingMaterialStatement(Statement statement) throws IOException { if (statement.getLine().startsWith("set_texture_alias")){ String[] split = statement.getLine().split(" ", 3); String aliasName = split[1]; String texturePath = split[2]; String jmeParamName = matExt.getTextureMapping(aliasName); TextureKey texKey = new TextureKey(texturePath, false); texKey.setGenerateMips(true); Texture tex; try { tex = assetManager.loadTexture(texKey); tex.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); tex = new Texture2D( PlaceholderAssets.getPlaceholderImage(assetManager) ); tex.setWrap(WrapMode.Repeat); tex.setKey(texKey); } material.setTexture(jmeParamName, tex); } }
private void readExtendingMaterialStatement(Statement statement) throws IOException { if (statement.getLine().startsWith("set_texture_alias")){ String[] split = statement.getLine().split(" ", 3); String aliasName = split[1]; String texturePath = split[2]; String jmeParamName = matExt.getTextureMapping(aliasName); TextureKey texKey = new TextureKey(texturePath, false); texKey.setGenerateMips(true); Texture tex; try { tex = assetManager.loadTexture(texKey); tex.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); tex = new Texture2D( PlaceholderAssets.getPlaceholderImage(assetManager) ); tex.setWrap(WrapMode.Repeat); tex.setKey(texKey); } material.setTexture(jmeParamName, tex); } }
private void readExtendingMaterialStatement(Statement statement) throws IOException { if (statement.getLine().startsWith("set_texture_alias")){ String[] split = statement.getLine().split(" ", 3); String aliasName = split[1]; String texturePath = split[2]; String jmeParamName = matExt.getTextureMapping(aliasName); TextureKey texKey = new TextureKey(texturePath, false); texKey.setGenerateMips(true); texKey.setAsCube(false); Texture tex; try { tex = assetManager.loadTexture(texKey); tex.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); tex = new Texture2D( PlaceholderAssets.getPlaceholderImage() ); tex.setWrap(WrapMode.Repeat); tex.setKey(texKey); } material.setTexture(jmeParamName, tex); } }
private void readExtendingMaterialStatement(Statement statement) throws IOException { if (statement.getLine().startsWith("set_texture_alias")){ String[] split = statement.getLine().split(" ", 3); String aliasName = split[1]; String texturePath = split[2]; String jmeParamName = matExt.getTextureMapping(aliasName); TextureKey texKey = new TextureKey(texturePath, false); texKey.setGenerateMips(true); texKey.setAsCube(false); Texture tex; try { tex = assetManager.loadTexture(texKey); tex.setWrap(WrapMode.Repeat); } catch (AssetNotFoundException ex){ logger.log(Level.WARNING, "Cannot locate {0} for material {1}", new Object[]{texKey, key}); tex = new Texture2D( PlaceholderAssets.getPlaceholderImage() ); tex.setWrap(WrapMode.Repeat); tex.setKey(texKey); } material.setTexture(jmeParamName, tex); } }
textures[texUnit].setKey(loadedTexture.getKey());
/** Retrieve a basic clone of this Texture (ie, clone everything but the * image data, which is shared) * * @return Texture */ public Texture createSimpleClone(Texture rVal) { rVal.setMinFilter(minificationFilter); rVal.setMagFilter(magnificationFilter); rVal.setShadowCompareMode(shadowCompareMode); // rVal.setHasBorder(hasBorder); rVal.setAnisotropicFilter(anisotropicFilter); rVal.setImage(image); // NOT CLONED. // rVal.memReq = memReq; rVal.setKey(key); rVal.setName(name); // rVal.setBlendColor(blendColor != null ? blendColor.clone() : null); // if (getTextureKey() != null) { // rVal.setTextureKey(getTextureKey()); // } if (original != null) { rVal.original = original; } else { rVal.original = this; } return rVal; }