public TextureState getTextureState() { if (map_Kd != null) { final TextureState tState = new TextureState(); tState.setTexture(map_Kd, 0); return tState; } return null; }
/** * 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); }
/** * Set the texture to be displayed on the given side of the skybox. Only replaces the texture at the index specified * by textureUnit. * * @param face * the face to set * @param texture * The texture for that side to assume. * @param textureUnit * The texture unite of the given side's TextureState the texture will assume. */ public void setTexture(final Face face, final Texture texture, final int textureUnit) { // Validate if (face == null) { throw new IllegalArgumentException("Face can not be null."); } TextureState ts = (TextureState) _skyboxQuads[face.ordinal()] .getLocalRenderState(RenderState.StateType.Texture); if (ts == null) { ts = new TextureState(); } // Initialize the texture state ts.setTexture(texture, textureUnit); ts.setEnabled(true); texture.setWrap(WrapMode.EdgeClamp); // Set the texture to the quad _skyboxQuads[face.ordinal()].setRenderState(ts); return; }
tbuf.rewind(); final TextureState texState = new TextureState(); texState.setTexture(graphTexture); quad.setRenderState(texState);
/** * Set the texture to be displayed on the given side of the skybox. Only replaces the texture at the index specified * by textureUnit. * * @param face * the face to set * @param texture * The texture for that side to assume. * @param textureUnit * The texture unite of the given side's TextureState the texture will assume. */ public void setTexture(final Face face, final Texture texture, final int textureUnit) { // Validate if (face == null) { throw new IllegalArgumentException("Face can not be null."); } TextureState ts = (TextureState) _skyboxQuads[face.ordinal()] .getLocalRenderState(RenderState.StateType.Texture); if (ts == null) { ts = new TextureState(); } // Initialize the texture state ts.setTexture(texture, textureUnit); ts.setEnabled(true); texture.setWrap(WrapMode.EdgeClamp); // Set the texture to the quad _skyboxQuads[face.ordinal()].setRenderState(ts); return; }
public static RenderState createState(final StateType type) { switch (type) { case Blend: return new BlendState(); case ColorMask: return new ColorMaskState(); case Cull: return new CullState(); case Light: return new LightState(); case Offset: return new OffsetState(); case Stencil: return new StencilState(); case Texture: return new TextureState(); case Wireframe: return new WireframeState(); case ZBuffer: return new ZBufferState(); } throw new IllegalArgumentException("Unknown state type: " + type); } }
tbuf.rewind(); final TextureState texState = new TextureState(); texState.setTexture(graphTexture); quad.setRenderState(texState);
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); }
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); }
_texList.add(_fboTexture); final TextureState screen = new TextureState(); screen.setTexture(_fboTexture); screen.setEnabled(true);
/** * 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); }
return new StencilState(); case Texture: return new TextureState(); case VertexProgram: return new VertexProgramState();
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); }
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); }
public OutlinePass(final boolean antialiased) { _wireframeState = new WireframeState(); _wireframeState.setFace(WireframeState.Face.FrontAndBack); _wireframeState.setLineWidth(DEFAULT_LINE_WIDTH); _wireframeState.setEnabled(true); _frontCull = new CullState(); _frontCull.setCullFace(Face.Front); _backCull = new CullState(); _backCull.setCullFace(Face.Back); _wireframeState.setAntialiased(antialiased); _noLights = new LightState(); _noLights.setGlobalAmbient(DEFAULT_OUTLINE_COLOR); _noLights.setEnabled(true); _noTexture = new TextureState(); _noTexture.setEnabled(true); _blendState = new BlendState(); _blendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha); _blendState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); _blendState.setBlendEnabled(true); _blendState.setEnabled(true); }
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); }