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 = new Texture2D(PlaceholderAssets.getPlaceholderImage(assetManager)); texture.setKey(textureKey); texture.setName(textureKey.getName());
} catch (AssetNotFoundException ex){ Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Cannot locate texture {0}", key); image = PlaceholderAssets.getPlaceholderImage(e.getAssetManager());
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); } }
image = PlaceholderAssets.getPlaceholderImage(assetManager);
result = new Texture2D(PlaceholderAssets.getPlaceholderImage(blenderContext.getAssetManager())); LOGGER.fine("ImageLoader returned null. It probably failed to load the packed texture, using placeholder asset");
@Override protected Texture toJmeObject() { Image image = null; TextureKey key = null; if (media != null) { image = (Image) media.getJmeObject(); key = media.getTextureKey(); } if (image == null) { image = PlaceholderAssets.getPlaceholderImage(assetManager); } Texture2D tex = new Texture2D(image); if (key != null) { tex.setKey(key); tex.setName(key.getName()); tex.setAnisotropicFilter(key.getAnisotropy()); } tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); if (wrapModeU == 0) { tex.setWrap(WrapAxis.S, WrapMode.Repeat); } if (wrapModeV == 0) { tex.setWrap(WrapAxis.T, WrapMode.Repeat); } return tex; }
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 = new Texture2D(PlaceholderAssets.getPlaceholderImage(assetManager)); texture.setKey(textureKey); texture.setName(textureKey.getName());
textures[texUnit].setImage(PlaceholderAssets.getPlaceholderImage());
} catch (AssetNotFoundException ex){ Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Cannot locate texture {0}", key); image = PlaceholderAssets.getPlaceholderImage(e.getAssetManager());
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); } }
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); 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); } }
image = PlaceholderAssets.getPlaceholderImage(assetManager);
@Override protected Texture toJmeObject() { Image image = null; TextureKey key = null; if (media != null) { image = (Image) media.getJmeObject(); key = media.getTextureKey(); } if (image == null) { image = PlaceholderAssets.getPlaceholderImage(assetManager); } Texture2D tex = new Texture2D(image); if (key != null) { tex.setKey(key); tex.setName(key.getName()); tex.setAnisotropicFilter(key.getAnisotropy()); } tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); if (wrapModeU == 0) { tex.setWrap(WrapAxis.S, WrapMode.Repeat); } if (wrapModeV == 0) { tex.setWrap(WrapAxis.T, WrapMode.Repeat); } return tex; }