@Provides @Singleton TextureLibraryStorageService provideTextureLibraryStorageService(ResourceService pUrlReciverService) { TextureLibraryService textureLibraryService = new TextureLibraryService(pUrlReciverService); return textureLibraryService; }
private void loadUrl(URL pUrl) throws JAXBException, FileNotFoundException { List<TextureSet> pointModelsInternalList = loadXml(pUrl); for (TextureSet p : pointModelsInternalList) { for (org.kendzi3d.TextureData td : p.getTextureData()) { TextureData td2 = convert(td); addTexture(p.getKey(), td2); } } }
@Deprecated private String getKey(String pPattern, String... pKeyParts) { return getKey(pPattern, true, pKeyParts); }
/** * Initialize. */ private void init() { this.textureMap.clear(); try { // load internal load(TEXTURE_LIBRARY_INTERNAL_XML); } catch (Exception e) { log.error(e, e); } try { // load wiki load(TEXTURE_LIBRARY_WIKI_XML); } catch (Exception e) { log.error(e, e); } try { // load wiki loadUserFile(this.userTextureLibraryUrl); } catch (Exception e) { log.error(e, e); } }
private void load(String url) throws FileNotFoundException, JAXBException { // this.textureMap.clear(); URL pointModelConf = this.urlReciverService.resourceToUrl(url); if (!UrlUtil.existUrl(pointModelConf)) { log.warn("cant load texture configuration from: " + url + " url don't exist: " + pointModelConf); return; } loadUrl(pointModelConf); }
/** * Constructor. * * @param urlReciverService * url reciver service */ public TextureLibraryService(ResourceService urlReciverService) { super(); this.urlReciverService = urlReciverService; init(); }
/** * Return random texture for key. * * @param key * texture key * @return is texture exist */ @Deprecated public TextureData getRadnomTextureForKey(String key) { ArrayList<TextureData> set = this.textureMap.get(key); return getRadnomTextureFromSet(set); }
/** * {@inheritDoc} * * @see kendzi.josm.kendzi3d.service.TextureLibrary#getTextureDefault(java.lang.String) */ @Override public TextureData getTextureDefault(String key) { TextureData texture = getRadnomTextureForKey(key); if (texture == null) { return new TextureData(null, 1, 1); } return texture; }
@Override public void loadUserFile(UrlTextureLibrary pUrlTextureLibrary) throws FileNotFoundException, JAXBException, MalformedURLException { if (pUrlTextureLibrary == null) { return; } if (pUrlTextureLibrary.isOverwrite()) { this.textureMap.clear(); } loadUrl(pUrlTextureLibrary.getUrl()); this.userTextureLibraryUrl = pUrlTextureLibrary; }
@Override public void reload() { this.textureMap.clear(); init(); }
/** * {@inheritDoc} * * @see kendzi.buildings.example.BaseJoglFrame#init(com.jogamp.opengl.GLAutoDrawable) */ @Override public void init(GLAutoDrawable drawable) { super.init(drawable); /* * This is required only for textures file finding. Renderer use it to * load files with textures. If textures are not used but only colored * materials it is not required. */ ResourceService resourceService = new LocalResourceReciver(); // cache for textures files. TextureCacheServiceImpl textureCacheService = new TextureCacheServiceImpl(); textureCacheService.setFilter(true); // Manual injection of dependencies. textureCacheService.setFileUrlReciverService(resourceService); textureLibraryStorageService = new TextureLibraryService(resourceService); // Set up of my model renderer to display my model modelRender = new ModelRender(); // Manual injection of dependencies. modelRender.setTextureCacheService(textureCacheService); // Create model mesh. model = createRoofModel(); }
/** * {@inheritDoc} * * @see kendzi.josm.kendzi3d.service.TextureLibrary#getKey(kendzi.josm.kendzi3d.service.TextureLibraryService.TextureLibraryKey, * java.lang.String) */ @Override public String getKey(TextureLibraryKey pKey, String... pKeyParts) { return getKey(pKey.getKey(), true, pKeyParts); }