public final AssetManager newAssetManager(URL configFile) { return new DesktopAssetManager(configFile); }
public Spatial loadModel(String name){ return loadModel(new ModelKey(name)); }
public void registerLoader(String clsName, String ... extensions){ Class<? extends AssetLoader> clazz = null; try{ clazz = (Class<? extends AssetLoader>) Class.forName(clsName); }catch (ClassNotFoundException ex){ logger.log(Level.WARNING, "Failed to find loader: "+clsName, ex); }catch (NoClassDefFoundError ex){ logger.log(Level.WARNING, "Failed to find loader: "+clsName, ex); } if (clazz != null){ registerLoader(clazz, extensions); } }
public static void main(String[] args) { DesktopAssetManager dam = new DesktopAssetManager(); String base = "file:///home/pgi/3d models/"; dam.registerLoader(ColladaLoader.class, "dae"); dam.registerLocator(base, UrlLocator.class.getName()); Spatial loadModel = dam.loadModel(base + "triangle_anim.dae"); } }
public Spatial loadModel(ModelKey key){ return (Spatial) loadAsset(key); }
DesktopAssetManager assets = new DesktopAssetManager(true); BitmapFont font = assets.loadFont("Interface/Fonts/Console.fnt"); BitmapText text1 = new BitmapText(font); text1.setText("Testing");
public void registerLocator(String rootPath, String clsName){ Class<? extends AssetLocator> clazz = null; try{ clazz = (Class<? extends AssetLocator>) Class.forName(clsName); }catch (ClassNotFoundException ex){ logger.log(Level.WARNING, "Failed to find locator: "+clsName, ex); }catch (NoClassDefFoundError ex){ logger.log(Level.WARNING, "Failed to find loader: "+clsName, ex); } if (clazz != null){ registerLocator(rootPath, clazz); } }
public Texture loadTexture(String name){ TextureKey key = new TextureKey(name, true); key.setGenerateMips(true); return loadTexture(key); }
obj = loadLocatedAsset(key, info, proc, cache); clone = registerAndCloneSmartAsset(key, clone, proc, cache);
public AudioData loadAudio(String name){ return loadAudio(new AudioKey(name, false)); }
public DesktopAssetManager(URL configFile){ if (configFile != null){ loadConfigFile(configFile); } logger.fine("DesktopAssetManager created."); }
@Override public <T> T loadAssetFromStream(AssetKey<T> key, InputStream inputStream) { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } for (AssetEventListener listener : eventListeners){ listener.assetRequested(key); } AssetProcessor proc = handler.getProcessor(key.getProcessorType()); StreamAssetInfo info = new StreamAssetInfo(this, key, inputStream); return loadLocatedAsset(key, info, proc, null); }
public FilterPostProcessor loadFilter(String name){ return loadFilter(new FilterKey(name)); }
public FilterPostProcessor loadFilter(FilterKey key){ return (FilterPostProcessor) loadAsset(key); }
public void registerLocator(String rootPath, String clsName){ Class<? extends AssetLocator> clazz = null; try{ clazz = (Class<? extends AssetLocator>) Class.forName(clsName); }catch (ClassNotFoundException ex){ logger.log(Level.WARNING, "Failed to find locator: "+clsName, ex); }catch (NoClassDefFoundError ex){ logger.log(Level.WARNING, "Failed to find loader: "+clsName, ex); } if (clazz != null){ registerLocator(rootPath, clazz); } }
public Texture loadTexture(String name){ return loadTexture(name, true); }
obj = loadLocatedAsset(key, info, proc, cache); clone = registerAndCloneSmartAsset(key, clone, proc, cache);
public AudioData loadAudio(String name){ return loadAudio(new AudioKey(name, false)); }
public DesktopAssetManager(URL configFile){ if (configFile != null){ loadConfigFile(configFile); } logger.fine("DesktopAssetManager created."); }
@Override public <T> T loadAssetFromStream(AssetKey<T> key, InputStream inputStream) { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } for (AssetEventListener listener : eventListeners){ listener.assetRequested(key); } AssetProcessor proc = handler.getProcessor(key.getProcessorType()); StreamAssetInfo info = new StreamAssetInfo(this, key, inputStream); return loadLocatedAsset(key, info, proc, null); }