@MainThread public static void preloadCache(final Renderer r) { for (final Texture t : _tCache.values()) { if (t == null) { continue; } if (t.getTextureKey().getSource() != null) { r.loadTexture(t, 0); } } }
@MainThread public static void preloadCache(final ITextureUtils util) { for (final Texture t : _tCache.values()) { if (t == null) { continue; } if (t.getTextureKey().getSource() != null) { util.loadTexture(t, 0); } } }
private TextureState readTextureStateFromCurrent() { final Element el = _currentElem; TextureState ret = null; try { ret = (TextureState) readSavableFromCurrentElem(null); final Savable[] savs = readSavableArray("texture", new Texture[0]); for (int i = 0; i < savs.length; i++) { Texture t = (Texture) savs[i]; final TextureKey tKey = t.getTextureKey(); t = TextureManager.loadFromKey(tKey, null, t); ret.setTexture(t, i); } } catch (final Exception e) { Logger.getLogger(DOMInputCapsule.class.getName()).log(Level.SEVERE, null, e); } _currentElem = el; return ret; }
private TextureState readTextureStateFromCurrent() { final Element el = _currentElem; TextureState ret = null; try { ret = (TextureState) readSavableFromCurrentElem(null); final Savable[] savs = readSavableArray("texture", new Texture[0]); for (int i = 0; i < savs.length; i++) { Texture t = (Texture) savs[i]; final TextureKey tKey = t.getTextureKey(); t = TextureManager.loadFromKey(tKey, null, t); ret.setTexture(t, i); } } catch (final Exception e) { Logger.getLogger(DOMInputCapsule.class.getName()).log(Level.SEVERE, null, e); } _currentElem = el; return ret; }
/** * Add a given texture to the cache * * @param texture * our texture */ public static void addToCache(final Texture texture) { if (TextureState.getDefaultTexture() == null || (texture != TextureState.getDefaultTexture() && texture.getImage() != TextureState.getDefaultTextureImage())) { _tCache.put(texture.getTextureKey(), texture); } }
/** * Add a given texture to the cache * * @param texture * our texture */ public static void addToCache(final Texture texture) { if (TextureState.getDefaultTexture() == null || (texture != TextureState.getDefaultTexture() && texture.getImage() != TextureState .getDefaultTextureImage())) { _tCache.put(texture.getTextureKey(), texture); } }
@Override public void draw(final Renderer renderer, final UIComponent comp) { if (_texState.getNumberOfSetTextures() == 0 || _texState.getTexture().getTextureKey() == null || !_texState.getTexture().getTextureKey().equals(_image.getTexture().getTextureKey())) { _texState.setTexture(_image.getTexture()); ImageArcBackdrop._standin.setRenderState(_texState); ImageArcBackdrop._standin.updateWorldRenderStates(false); } drawBackdrop(ImageArcBackdrop._standin, renderer, comp, _image); }
final TextureState textureState = (TextureState) mesh.getLocalRenderState(StateType.Texture); if (textureState.isEnabled() && textureState.getTexture() != null) { final TextureKey tKey = textureState.getTexture().getTextureKey(); final String tmpTextureName = tKey.getSource().getName(); final int lastIndexOfUnixPathSeparator = tmpTextureName.lastIndexOf('/');
public TextureParameter(final Mesh mesh, final int textureIndex, final int targetTextureIndex) { if (mesh == null) { throw new IllegalArgumentException("Mesh is null"); } this.mesh = mesh; this.textureIndex = textureIndex; this.targetTextureIndex = targetTextureIndex; if (mesh.isDirty(DirtyType.RenderState)) { mesh.updateWorldRenderStates(false); mesh.clearDirty(DirtyType.RenderState); } final RenderState textureState = mesh.getWorldRenderState(StateType.Texture); if (textureState == null) { throw new Ardor3dException("No texture state found for mesh: " + mesh); } texture = ((TextureState) textureState).getTexture(textureIndex); textureKey = texture != null ? texture.getTextureKey() : null; }
tex = ((TextureState) system.getLocalRenderState(StateType.Texture)).getTexture(); if (tex != null) { if (tex.getTextureKey() != null && tex.getTextureKey().getSource() != null) { _imageLabel .setIcon(new ImageIcon(((URLResourceSource) tex.getTextureKey().getSource()).getURL())); logger.warning("image: " + tex + " : " + tex != null ? tex.getTextureKey().getSource().toString() : "");
/** * Retrieve a basic clone of this Texture (ie, clone everything but the image data, which is shared) * * @return Texture */ public Texture createSimpleClone(final Texture rVal) { rVal.setAnisotropicFilterPercent(_anisotropicFilterPercent); rVal.setBorderColor(_borderColor); rVal.setDepthCompareFunc(_depthCompareFunc); rVal.setDepthCompareMode(_depthCompareMode); rVal.setHasBorder(_hasBorder); rVal.setTextureStoreFormat(_storeFormat); rVal.setRenderedTexturePixelDataType(_rttPixelDataType); rVal.setImage(_image); // NOT CLONED. rVal.setLodBias(_lodBias); rVal.setMinificationFilter(_minificationFilter); rVal.setMagnificationFilter(_magnificationFilter); rVal.setStoreImage(_storeImage); if (getTextureKey() != null) { rVal.setTextureKey(getTextureKey()); } return rVal; }
@Override protected void takedownForSingleTexDraw(final Texture tex) { if (isEnableMipGeneration()) { // automatically generate mipmaps for our texture, if supported. if (tex.getMinificationFilter().usesMipMapLevels()) { Lwjgl3TextureStateUtil.doTextureBind(tex, 0, true); GL30C.glGenerateMipmap(Lwjgl3TextureStateUtil.getGLType(tex.getType())); } } tex.getTextureKey().markClean(ContextManager.getCurrentContext()); }
if (texture.getTextureKey() != null) { final TextureKey texKey = texture.getTextureKey(); final Texture cached = TextureManager.findCachedTexture(texKey);
final Texture cached = TextureManager.findCachedTexture(texture.getTextureKey());
final Texture cached = TextureManager.findCachedTexture(texture.getTextureKey());
if (tex.getTextureKey() == null) { tex.setTextureKey(TextureKey.getRTTKey(tex.getMinificationFilter())); } else if (tex.getTextureIdForContext(context.getGlContextRep()) != 0) {
if (tex.getTextureKey() == null) { tex.setTextureKey(TextureKey.getRTTKey(tex.getMinificationFilter())); } else if (tex.getTextureIdForContext(context.getGlContextRep()) != 0) {
if (_texState.getNumberOfSetTextures() == 0 || _texState.getTexture().getTextureKey() == null || !_texState.getTexture().getTextureKey().equals(_image.getTexture().getTextureKey())) { _texState.setTexture(_image.getTexture()); ImageDiskBackdrop._standin.setRenderState(_texState);
if (tex.getTextureKey() == null) { tex.setTextureKey(TextureKey.getRTTKey(tex.getMinificationFilter())); } else if (tex.getTextureIdForContext(context.getGlContextRep()) != 0) {
if (tex.getTextureKey() == null) { tex.setTextureKey(TextureKey.getRTTKey(tex.getMinificationFilter())); } else if (tex.getTextureIdForContext(context.getGlContextRep()) != 0) {