Package com.ardor3d.renderer.state

Examples of com.ardor3d.renderer.state.TextureState


        return box;
    }

    private void setupStates(final Mesh mesh, final String textureName, final WrapMode mode) {
        // Add a texture to the mesh.
        final TextureState ts = new TextureState();
        final Texture texture = TextureManager.load(textureName, Texture.MinificationFilter.Trilinear, true);
        texture.setWrap(mode);
        texture.setBorderColor(ColorRGBA.RED);
        ts.setTexture(texture);
        mesh.setRenderState(ts);

        // Add a material to the mesh, to show both vertex color and lighting/shading.
        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.Diffuse);
View Full Code Here


        blend.setBlendEnabled(true);
        blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        smoke.setRenderState(blend);

        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/flare.png", Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true));
        ts.getTexture().setWrap(WrapMode.BorderClamp);
        ts.setEnabled(true);
        smoke.setRenderState(ts);

        final ZBufferState zstate = new ZBufferState();
        zstate.setWritable(false);
        smoke.setRenderState(zstate);
View Full Code Here

                        texture.setConstantColor(0, 0, 0, .07f);

                        texRend.setupTexture(texture);

                        // add reflection texture to unit 1
                        final TextureState ts = (TextureState) sp.getLocalRenderState(StateType.Texture);
                        ts.setTexture(texture, 1);
                        return null;
                    }
                });

        sp = new Sphere("sphere", 16, 16, 2);
        sp.getMeshData().copyTextureCoordinates(0, 1, 1f);
        _root.attachChild(sp);

        // add base texture to unit 0
        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        sp.setRenderState(ts);

        // add some scenery
        final Pyramid b = new Pyramid("box", 2, 3);
        b.setRotation(new Quaternion().fromAngleNormalAxis(MathUtils.PI, Vector3.UNIT_X));
        b.addController(new SpatialController<Spatial>() {
            public void update(final double time, final Spatial caller) {
                b.setTranslation(-3, 6 * MathUtils.sin(_timer.getTimeInSeconds()), 0);
            };
        });
        _root.attachChild(b);

        // add base texture to unit 0
        final TextureState ts2 = new TextureState();
        ts2.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        b.setRenderState(ts2);
    }
View Full Code Here

        final Teapot teapot = new Teapot("teapot");
        teapot.setScale(5);
        _root.attachChild(teapot);

        // Add a texture to the scene.
        final TextureState ts = new TextureState();
        projectedTexture = TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear,
                true);
        ts.setTexture(projectedTexture);
        projectedTexture.setTextureMatrix(new Matrix4());
        projectedTexture.setWrap(Texture.WrapMode.BorderClamp);
        projectedTexture.setEnvironmentalMapMode(Texture.EnvironmentalMapMode.EyeLinear);
        projectedTexture.setApply(ApplyMode.Add);
        projectedTexture.setConstantColor(ColorRGBA.WHITE);
View Full Code Here

        final CullState cullFrontFace = new CullState();
        cullFrontFace.setEnabled(true);
        cullFrontFace.setCullFace(CullState.Face.Back);
        _root.setRenderState(cullFrontFace);

        final TextureState ts = new TextureState();
        ts.setEnabled(true);
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        _root.setRenderState(ts);

        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.Diffuse);
        _root.setRenderState(ms);
View Full Code Here

                box.setRotation(_rotate);
            }
        });

        // Create a texture from the Ardor3D logo.
        final TextureState ts = new TextureState();
        ts.setEnabled(true);
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        box.setRenderState(ts);
    }
View Full Code Here

    private Node createObjects() {
        final Node objects = new Node("objects");

        final Torus torus = new Torus("Torus", 50, 50, 8, 17);
        torus.setTranslation(new Vector3(50, -5, 20));
        TextureState ts = new TextureState();
        torus.addController(new SpatialController<Torus>() {
            private double timer = 0;
            private final Matrix3 rotation = new Matrix3();

            public void update(final double time, final Torus caller) {
                timer += time * 0.5;
                caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
                rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
                caller.setRotation(rotation);
            }
        });

        Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
                Texture.MinificationFilter.BilinearNearestMipMap, true);
        ts.setTexture(t0, 0);
        ts.setEnabled(true);
        torus.setRenderState(ts);
        objects.attachChild(torus);

        ts = new TextureState();
        t0 = TextureManager
                .load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
        t0.setWrap(Texture.WrapMode.Repeat);
        ts.setTexture(t0);

        Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
        box.setTranslation(new Vector3(0, -7, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(15, 10, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(0, -10, 15));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(20, 0, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        ts = new TextureState();
        t0 = TextureManager
                .load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
        t0.setWrap(Texture.WrapMode.Repeat);
        ts.setTexture(t0);

        box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
        box.setTranslation(new Vector3(0, -15, 0));
        box.setRenderState(ts);
        box.setModelBound(new BoundingBox());
View Full Code Here

        Quad debugQuad = new Quad("reflectionQuad", quadSize, quadSize);
        debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        debugQuad.getSceneHints().setCullHint(CullHint.Never);
        debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        TextureState ts = new TextureState();
        ts.setTexture(waterNode.getTextureReflect());
        debugQuad.setRenderState(ts);
        debugQuad.setTranslation(quadSize * 0.6, quadSize * 1.0, 1.0);
        debugQuadsNode.attachChild(debugQuad);

        if (waterNode.getTextureRefract() != null) {
            debugQuad = new Quad("refractionQuad", quadSize, quadSize);
            debugQuad.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
            debugQuad.getSceneHints().setCullHint(CullHint.Never);
            debugQuad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
            ts = new TextureState();
            ts.setTexture(waterNode.getTextureRefract());
            debugQuad.setRenderState(ts);
            debugQuad.setTranslation(quadSize * 0.6, quadSize * 2.1, 1.0);
            debugQuadsNode.attachChild(debugQuad);
        }
    }
View Full Code Here

            _blurBufferTexture.setWrap(Texture.WrapMode.Clamp);
            _blurBufferTexture.setMinificationFilter(MinificationFilter.NearestNeighborNoMipMaps);
            _blurBufferTexture.setMagnificationFilter(Texture.MagnificationFilter.NearestNeighbor);
            _sceneTextureRenderer.setupTexture(_blurBufferTexture);

            final TextureState ts = new TextureState();
            ts.setEnabled(true);
            ts.setTexture(_blurBufferTexture);
            _screenQuad.setRenderState(ts);
            _screenQuad.updateWorldRenderStates(false);

            isInitialized = true;
        }
View Full Code Here

        addMesh(new Teapot("Teapot"));
        addMesh(new Torus("Torus", 16, 8, 1.0, 2.5));
        addMesh(new Tube("Tube", 2, 3, 4));
        addMesh(createLines());

        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true));
        _root.setRenderState(ts);

        final BlendState bs = new BlendState();
        bs.setBlendEnabled(true);
View Full Code Here

TOP

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

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.