public TextureState getTextureState() { if (map_Kd != null) { final TextureState tState = new TextureState(); tState.setTexture(map_Kd, 0); return tState; } return null; }
public void actionPerformed(final ActionEvent e) { ((TextureState) getEdittedParticles().getLocalRenderState(StateType.Texture)).setTexture(null); _imageLabel.setIcon(null); } });
@Override public void apply(final EffectManager manager) { // prepare our texture state for (final String key : _targetMap.keySet()) { final RenderTarget target = manager.getRenderTarget(key); final Integer unit = _targetMap.get(key); _texState.setTexture(target.getTexture(), unit.intValue()); } // render a quad to the screen using our states. manager.renderFullScreenQuad(_enforcedMaterial, _states); }
@Override public void apply(final EffectManager manager) { // prepare our texture state for (final String key : _targetMap.keySet()) { final RenderTarget target = manager.getRenderTarget(key); final Integer unit = _targetMap.get(key); _texState.setTexture(target.getTexture(), unit.intValue()); } // render a quad to the screen using our states. manager.renderFullScreenQuad(_states); }
@Override public void prepare(final EffectManager manager) { _steps.clear(); _steps.add(new EffectStep_SetRenderTarget("*Next")); final EffectStep_RenderScreenOverlay colorizeStep = new EffectStep_RenderScreenOverlay(); colorizeStep.getTextureState().setTexture(_colorRampTexture, 1); colorizeStep.getTargetMap().put("*Previous", 0); colorizeStep.getEnforcedStates().put(StateType.GLSLShader, getColorizeShader()); _steps.add(colorizeStep); super.prepare(manager); }
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; }
@Override public void prepare(final EffectManager manager) { _replaceMaterial = MaterialManager.INSTANCE.findMaterial("effect/color_replace.yaml"); injectUniforms(_replaceMaterial); _steps.clear(); _steps.add(new EffectStep_SetRenderTarget(EffectManager.RT_NEXT)); final EffectStep_RenderScreenOverlay colorizeStep = new EffectStep_RenderScreenOverlay(); colorizeStep.getTextureState().setTexture(_colorRampTexture, 1); colorizeStep.getTargetMap().put(EffectManager.RT_PREVIOUS, 0); colorizeStep.setEnforcedMaterial(_replaceMaterial); _steps.add(colorizeStep); super.prepare(manager); }
/** * Convenience method for setting texture without managing TextureState. * * @param texture * the new texture to set on unit 0. */ public void setTexture(final Texture2D texture) { TextureState ts = (TextureState) getLocalRenderState(RenderState.StateType.Texture); if (ts == null) { ts = new TextureState(); ts.setEnabled(true); setRenderState(ts); } ts.setTexture(texture, 0); }
private void loadApplyTexture() throws MalformedURLException { final TextureState ts = (TextureState) getEdittedParticles().getLocalRenderState(StateType.Texture); // XXX: Needed? // TextureManager.clearCache(); ts.setTexture(TextureManager.load(new URLResourceSource(_newTexture.toURI().toURL()), Texture.MinificationFilter.BilinearNearestMipMap, TextureStoreFormat.GuessCompressedFormat, true)); ts.getTexture().setWrap(WrapMode.BorderClamp); ts.setEnabled(true); getEdittedParticles().setRenderState(ts); _newTexture = null; }
private void resetFakeTexture() { // create a texture to cache the contents to _fakeTexture = new Texture2D(); _fakeTexture.setMagnificationFilter(MagnificationFilter.Bilinear); _fakeTexture.setMinificationFilter(_minificationFilter); _fakeTexture.setTextureStoreFormat(TextureStoreFormat.RGBA8); _fakeTexture.setWrap(WrapMode.EdgeClamp); UIContainer._textureRenderer.setupTexture(_fakeTexture); // Set a texturestate on the standin, using the fake texture final TextureState ts = new TextureState(); ts.setTexture(_fakeTexture); _standin.setRenderState(ts); }
private void resetFakeTexture() { // create a texture to cache the contents to _fakeTexture = new Texture2D(); _fakeTexture.setMagnificationFilter(MagnificationFilter.Bilinear); _fakeTexture.setMinificationFilter(_minificationFilter); _fakeTexture.setTextureStoreFormat(TextureStoreFormat.RGBA8); _fakeTexture.setWrap(WrapMode.EdgeClamp); UIContainer._textureRenderer.setupTexture(_fakeTexture); // Set a texturestate on the standin, using the fake texture final TextureState ts = new TextureState(); ts.setTexture(_fakeTexture); _standin.setRenderState(ts); }
RenderStateSetter(final Texture texture, final boolean useBlend) { textureState = new TextureState(); textureState.setTexture(texture); blendState = new BlendState(); blendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); blendState.setTestEnabled(true); blendState.setTestFunction(BlendState.TestFunction.GreaterThan); zBuffState = new ZBufferState(); zBuffState.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); setUseBlend(useBlend); }
RenderStateSetter(final Texture texture, final boolean useBlend) { textureState = new TextureState(); textureState.setTexture(texture); blendState = new BlendState(); blendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); blendState.setTestEnabled(true); blendState.setTestFunction(BlendState.TestFunction.GreaterThan); zBuffState = new ZBufferState(); zBuffState.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo); setUseBlend(useBlend); }
private void applyStates(final TextMesh mesh, final Texture2D tex) { final TextureState textureState = new TextureState(); textureState.setTexture(tex); mesh.setRenderState(textureState); final BlendState blendState = new BlendState(); blendState.setBlendEnabled(true); blendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); blendState.setTestEnabled(true); blendState.setTestFunction(BlendState.TestFunction.GreaterThan); blendState.setReference(0f); mesh.setRenderState(blendState); mesh.updateWorldRenderStates(false); }
@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); }
private void applyStates(final TextMesh mesh, final Texture2D tex) { final TextureState textureState = new TextureState(); textureState.setTexture(tex); mesh.setRenderState(textureState); final BlendState blendState = new BlendState(); blendState.setBlendEnabled(true); blendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); blendState.setTestEnabled(true); blendState.setTestFunction(BlendState.TestFunction.GreaterThan); blendState.setReference(0f); mesh.setRenderState(blendState); mesh.updateWorldRenderStates(false); }
/** * Create setup to use as fallback if fancy water is not supported. */ private void createFallbackData() { fallbackTextureState = new TextureState(); fallbackTextureState.setEnabled(true); fallbackTexture = TextureManager.load(fallbackMapTextureString, Texture.MinificationFilter.Trilinear, TextureStoreFormat.GuessCompressedFormat, true); fallbackTextureState.setTexture(fallbackTexture, 0); fallbackTexture.setWrap(Texture.WrapMode.Repeat); fallbackTextureStateMatrix = new Matrix4(); as1 = new BlendState(); as1.setBlendEnabled(true); as1.setTestEnabled(true); as1.setSourceFunction(BlendState.SourceFunction.SourceAlpha); as1.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); as1.setEnabled(true); }
public void resetTexture() { _texture.setWrap(Texture.WrapMode.EdgeClamp); _texture.setMinificationFilter(Texture.MinificationFilter.BilinearNoMipMaps); _texture.setMagnificationFilter(Texture.MagnificationFilter.Bilinear); _texture.setTextureStoreFormat(TextureStoreFormat.RGBA8); _tRenderer.setupTexture(_texture); final TextureState ts = new TextureState(); ts.setEnabled(true); ts.setTexture(_texture, 0); _imposterQuad.setRenderState(ts); // Add a blending mode... This is so the background of the texture is // transparent. final BlendState as1 = new BlendState(); as1.setBlendEnabled(true); as1.setSourceFunction(BlendState.SourceFunction.SourceAlpha); as1.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); as1.setTestEnabled(true); as1.setTestFunction(BlendState.TestFunction.GreaterThan); as1.setEnabled(true); _imposterQuad.setRenderState(as1); }
private void setRenderStates(final Texture texture) { final BlendState bs = new BlendState(); bs.setBlendEnabled(true); bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha); bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); bs.setTestEnabled(true); bs.setReference(0.5f); bs.setTestFunction(BlendState.TestFunction.GreaterThan); // setRenderState(bs); final TextureState ts = new TextureState(); ts.setTexture(texture); setRenderState(ts); final ZBufferState zs = new ZBufferState(); zs.setWritable(false); setRenderState(zs); setDefaultColor(_tintColor); setModelBound(null); getSceneHints().setLightCombineMode(LightCombineMode.Off); getSceneHints().setTextureCombineMode(TextureCombineMode.Replace); getSceneHints().setCullHint(CullHint.Never); }