Package com.ardor3d.renderer.state

Examples of com.ardor3d.renderer.state.BlendState


        ts.setTexture(TextureManager.load("images/ball.png", Texture.MinificationFilter.NearestNeighborNoMipMaps,
                TextureStoreFormat.GuessCompressedFormat, true));
        root.setRenderState(ts);

        // Add blending.
        final BlendState blend = new BlendState();
        blend.setBlendEnabled(true);
        blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        blend.setTestEnabled(true);
        blend.setReference(0f);
        blend.setTestFunction(BlendState.TestFunction.GreaterThan);
        root.setRenderState(blend);

        // setup scene
        // Add background
        final CanvasRenderer canvasRenderer = canvas.getCanvasRenderer();
View Full Code Here


        ms3.setEnabled(true);
        ms3.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(1, 0, 0, .5f));
        ms3.setShininess(MaterialFace.FrontAndBack, 128);
        tb3.setRenderState(ms3);

        final BlendState as = new BlendState();
        as.setEnabled(true);
        as.setBlendEnabled(true);
        as.setSourceFunction(SourceFunction.SourceAlpha);
        as.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha);
        transps.setRenderState(as);

        final Vector2 center = new Vector2(_canvas.getCanvasRenderer().getCamera().getWidth() >> 1, _canvas
                .getCanvasRenderer().getCamera().getWidth() >> 1);
View Full Code Here

        ts.setEnabled(true);
        ts.setTexture(TextureManager.load("fonts/OkasaSansSerif-35-medium-regular_00.png",
                Texture.MinificationFilter.Trilinear, true));
        billboard.setRenderState(ts);

        final BlendState bs = new BlendState();
        bs.setEnabled(true);
        bs.setBlendEnabled(false);
        bs.setTestEnabled(true);
        bs.setTestFunction(TestFunction.GreaterThan);
        bs.setReference(0.7f);
        billboard.setRenderState(bs);

        return billboard;
    }
View Full Code Here

        particles.setEndColor(new ColorRGBA(0, 1, 0, 0));
        particles.setMaximumAngle(360 * MathUtils.DEG_TO_RAD);
        particles.getParticleController().setControlFlow(false);
        particles.setParticlesInWorldCoords(true);

        final BlendState blend = new BlendState();
        blend.setBlendEnabled(true);
        blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        blend.setDestinationFunction(BlendState.DestinationFunction.One);
        particles.setRenderState(blend);

        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/flaresmall.jpg", Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true));
View Full Code Here

                explosion.removeFromParent();
            }
        });
        explosion.forceRespawn();

        final BlendState blend = new BlendState();
        blend.setBlendEnabled(true);
        blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        blend.setDestinationFunction(BlendState.DestinationFunction.One);
        explosion.setRenderState(blend);

        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/flaresmall.jpg", Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true));
View Full Code Here

                    useTransparency = false;
                }

                if (useTransparency) {
                    if (diffuseTexture != null) {
                        final BlendState blend = new BlendState();
                        blend.setBlendEnabled(true);
                        blend.setTestEnabled(true);
                        blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
                        blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
                        mesh.setRenderState(blend);
                    } else {
                        final BlendState blend = new BlendState();
                        blend.setBlendEnabled(true);
                        blend.setTestEnabled(true);
                        transparent.setAlpha(transparent.getAlpha() * transparency);
                        blend.setConstantColor(transparent);
                        blend.setSourceFunction(BlendState.SourceFunction.ConstantAlpha);
                        blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusConstantAlpha);
                        mesh.setRenderState(blend);
                    }

                    mesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);
                }
View Full Code Here

        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);
View Full Code Here

        if (!isSupported() || !useCurrentScene && _spatials.size() == 0) {
            return;
        }

        final BlendState blend = (BlendState) fullScreenQuad.getWorldRenderState(RenderState.StateType.Blend);

        if (sinceLast > throttle) {
            sinceLast = 0;

            tRenderer.getCamera().setLocation(cam.getLocation());
            tRenderer.getCamera().setDirection(cam.getDirection());
            tRenderer.getCamera().setUp(cam.getUp());
            tRenderer.getCamera().setLeft(cam.getLeft());

            blend.setEnabled(false);
            final TextureState ts = (TextureState) fullScreenQuad.getWorldRenderState(RenderState.StateType.Texture);

            // see if we should use the current scene to bloom, or only things added to the pass.
            if (useCurrentScene) {
                // grab backbuffer to texture
                if (screenTexture == null) {
                    final DisplaySettings settings = new DisplaySettings(cam.getWidth(), cam.getHeight(), 24, 0, 0, 8,
                            0, 0, false, false);
                    fullTRenderer = TextureRendererFactory.INSTANCE.createTextureRenderer(settings, false, r,
                            ContextManager.getCurrentContext().getCapabilities());
                    screenTexture = new Texture2D();
                    screenTexture.setWrap(Texture.WrapMode.Clamp);
                    screenTexture.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
                    fullTRenderer.setupTexture(screenTexture);
                }
                fullTRenderer.copyToTexture(screenTexture, 0, 0, cam.getWidth(), cam.getHeight(), 0, 0);
                ts.setTexture(screenTexture, 0);
            } else {
                // Render scene to texture
                tRenderer.render(_spatials, mainTexture, Renderer.BUFFER_COLOR_AND_DEPTH);
                ts.setTexture(mainTexture, 0);
            }

            // Extract intensity
            extractionShader.setUniform("exposurePow", getExposurePow());
            extractionShader.setUniform("exposureCutoff", getExposureCutoff());

            fullScreenQuad.setRenderState(extractionShader);
            fullScreenQuad.updateWorldRenderStates(false);
            // fullScreenQuad.states[RenderState.StateType.GLSLShaderObjects.ordinal()] = extractionShader;
            tRenderer.render(fullScreenQuad, secondTexture, Renderer.BUFFER_NONE);

            if (!useSeparateConvolution) {
                blurShader.setUniform("sampleDist", getBlurSize());
                blurShader.setUniform("blurIntensityMultiplier", getBlurIntensityMultiplier());

                ts.setTexture(secondTexture, 0);
                fullScreenQuad.setRenderState(blurShader);
                fullScreenQuad.updateWorldRenderStates(false);
                // fullScreenQuad.states[RenderState.StateType.GLSLShaderObjects.ordinal()] = blurShader;
                tRenderer.render(fullScreenQuad, mainTexture, Renderer.BUFFER_NONE);

                // Extra blur passes
                for (int i = 1; i < getNrBlurPasses(); i++) {
                    blurShader.setUniform("sampleDist", getBlurSize() - i * getBlurSize() / getNrBlurPasses());
                    if (i % 2 == 1) {
                        ts.setTexture(mainTexture, 0);
                        tRenderer.render(fullScreenQuad, secondTexture, Renderer.BUFFER_NONE);
                    } else {
                        ts.setTexture(secondTexture, 0);
                        tRenderer.render(fullScreenQuad, mainTexture, Renderer.BUFFER_NONE);
                    }
                }
                if (getNrBlurPasses() % 2 == 1) {
                    ts.setTexture(mainTexture, 0);
                } else {
                    ts.setTexture(secondTexture, 0);
                    tRenderer.render(fullScreenQuad, mainTexture, Renderer.BUFFER_NONE);
                    ts.setTexture(mainTexture, 0);
                }
            } else {
                blurShaderVertical.setUniform("blurIntensityMultiplier", getBlurIntensityMultiplier());

                for (int i = 0; i < getNrBlurPasses(); i++) {
                    blurShaderHorizontal
                            .setUniform("sampleDist", getBlurSize() - i * getBlurSize() / getNrBlurPasses());
                    blurShaderVertical.setUniform("sampleDist", getBlurSize() - i * getBlurSize() / getNrBlurPasses());

                    ts.setTexture(secondTexture, 0);
                    fullScreenQuad.setRenderState(blurShaderHorizontal);
                    fullScreenQuad.updateWorldRenderStates(false);
                    // fullScreenQuad.states[RenderState.StateType.GLSLShaderObjects.ordinal()] = blurShaderHorizontal;
                    tRenderer.render(fullScreenQuad, mainTexture, Renderer.BUFFER_NONE);
                    ts.setTexture(mainTexture, 0);
                    fullScreenQuad.setRenderState(blurShaderVertical);
                    fullScreenQuad.updateWorldRenderStates(false);
                    // fullScreenQuad.states[RenderState.StateType.GLSLShaderObjects.ordinal()] = blurShaderVertical;
                    tRenderer.render(fullScreenQuad, secondTexture, Renderer.BUFFER_NONE);
                }
                ts.setTexture(secondTexture, 0);
            }
        }

        // Final blend
        blend.setEnabled(true);

        fullScreenQuad.setRenderState(finalShader);
        fullScreenQuad.updateWorldRenderStates(false);
        // fullScreenQuad.states[RenderState.StateType.GLSLShaderObjects.ordinal()] = finalShader;
        r.draw((Renderable) fullScreenQuad);
View Full Code Here

        final TextureState ts = new TextureState();
        ts.setEnabled(true);
        fullScreenQuad.setRenderState(ts);

        final BlendState as = new BlendState();
        as.setBlendEnabled(true);
        as.setSourceFunction(BlendState.SourceFunction.One);
        as.setDestinationFunction(BlendState.DestinationFunction.One);
        as.setEnabled(true);
        fullScreenQuad.setRenderState(as);

        fullScreenQuad.updateGeometricState(0.0f, true);
    }
View Full Code Here

        _flat = new ShadingState();
        _flat.setShadingMode(ShadingMode.Flat);

        // When rendering and comparing the shadow map with the current depth, the result will be set to alpha 1 if in
        // shadow and to 0 if not in shadow.
        _discardShadowFragments = new BlendState();
        _discardShadowFragments.setEnabled(true);
        _discardShadowFragments.setBlendEnabled(true);
        _discardShadowFragments.setTestEnabled(true);
        _discardShadowFragments.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        _discardShadowFragments.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
View Full Code Here

TOP

Related Classes of com.ardor3d.renderer.state.BlendState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.