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; }
mat = PlaceholderAssets.getPlaceholderMaterial(assetManager);
logger.log(Level.WARNING, "Cannot locate {0} for scene {1}", new Object[]{meshKey, key}); Spatial model = PlaceholderAssets.getPlaceholderModel(assetManager); model.setKey(key); entityNode.attachChild(model);
} catch (AssetNotFoundException ex){ Logger.getLogger(AudioNode.class.getName()).log(Level.FINE, "Cannot locate {0} for audio node {1}", new Object[]{audioKey, key}); data = PlaceholderAssets.getPlaceholderAudio();
} catch (AssetNotFoundException ex){ Logger.getLogger(AudioNode.class.getName()).log(Level.FINE, "Cannot locate {0} for audio node {1}", new Object[]{audioKey, key}); data = PlaceholderAssets.getPlaceholderAudio();
texture = new Texture2D(PlaceholderAssets.getPlaceholderImage(assetManager)); texture.setKey(textureKey); texture.setName(textureKey.getName());
public static Spatial getPlaceholderModel(AssetManager assetManager){ // What should be the size? Nobody knows // the user's expected scale... Box box = new Box(1, 1, 1); Geometry geom = new Geometry("placeholder", box); geom.setMaterial(getPlaceholderMaterial(assetManager)); return geom; }
logger.log(Level.WARNING, "Cannot locate {0} for scene {1}", new Object[]{meshKey, key}); Spatial model = PlaceholderAssets.getPlaceholderModel(assetManager); model.setKey(key); entityNode.attachChild(model);
} catch (AssetNotFoundException ex){ Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Cannot locate texture {0}", key); image = PlaceholderAssets.getPlaceholderImage(e.getAssetManager());
private void applyMaterial(Geometry geom, String matName) { Material mat = null; if (matName == null) { // no material specified. use placeholder. mat = null; } else if (matName.endsWith(".j3m")) { // load as native jme3 material instance try { mat = assetManager.loadMaterial(matName); } catch (AssetNotFoundException ex) { // Warning will be raised (see below) if (!ex.getMessage().equals(matName)) { throw ex; } } } else { if (materialList != null) { mat = materialList.get(matName); } } if (mat == null) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{matName, key}); mat = PlaceholderAssets.getPlaceholderMaterial(assetManager); //mat.setKey(new MaterialKey(matName)); } if (mat.isTransparent()) { geom.setQueueBucket(Bucket.Transparent); } geom.setMaterial(mat); }
logger.log(Level.WARNING, "Cannot locate {0} for scene {1}", new Object[]{meshKey, key}); Spatial model = PlaceholderAssets.getPlaceholderModel(assetManager); model.setKey(key); entityNode.attachChild(model);
textures[texUnit].setImage(PlaceholderAssets.getPlaceholderImage(assetManager)); textures[texUnit].setKey(texKey);
private void applyMaterial(Geometry geom, String matName) { Material mat = null; if (matName.endsWith(".j3m")) { // load as native jme3 material instance try { mat = assetManager.loadMaterial(matName); } catch (AssetNotFoundException ex) { // Warning will be raised (see below) if (!ex.getMessage().equals(matName)) { throw ex; } } } else { if (materialList != null) { mat = materialList.get(matName); } } if (mat == null) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{matName, key}); mat = PlaceholderAssets.getPlaceholderMaterial(assetManager); //mat.setKey(new MaterialKey(matName)); } if (mat.isTransparent()) { geom.setQueueBucket(Bucket.Transparent); } geom.setMaterial(mat); }
logger.log(Level.WARNING, "Cannot locate {0} for scene {1}", new Object[]{meshKey, key}); Spatial model = PlaceholderAssets.getPlaceholderModel(assetManager); model.setKey(key); entityNode.attachChild(model);
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); } }
mat = PlaceholderAssets.getPlaceholderMaterial(assetManager);
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; }