Package com.ardor3d.renderer.state

Examples of com.ardor3d.renderer.state.MaterialState


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

        final MaterialState materialState = new MaterialState();
        materialState.setAmbient(MaterialFace.FrontAndBack, new ColorRGBA(1, 1, 1, 1));
        materialState.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(1, 1, 1, 1));
        materialState.setSpecular(MaterialFace.FrontAndBack, new ColorRGBA(1, 1, 1, 1));
        materialState.setShininess(MaterialFace.FrontAndBack, 64.0f);
        setRenderState(materialState);

        blendState = new BlendState();
        blendState.setBlendEnabled(true);
        blendState.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
View Full Code Here


        final ShadingState shade = new ShadingState();
        shade.setShadingMode(ShadingMode.Flat);
        grip.setRenderState(shade);

        // setup a material state to use the colors from the vertices.
        final MaterialState material = new MaterialState();
        material.setColorMaterial(ColorMaterial.Diffuse);
        grip.setRenderState(material);
    }
View Full Code Here

        return null;
    }

    public MaterialState getMaterialState() {
        if (Ka != null || Kd != null || Ks != null || d != -1 || Ns != -1) {
            final MaterialState material = new MaterialState();
            final float alpha = d != -1 ? MathUtils.clamp(d, 0, 1) : 1;
            if (Ka != null) {
                material.setAmbient(new ColorRGBA(Ka[0], Ka[1], Ka[2], alpha));
            }
            if (Kd != null) {
                material.setDiffuse(new ColorRGBA(Kd[0], Kd[1], Kd[2], alpha));
            }
            if (Ks != null) {
                material.setSpecular(new ColorRGBA(Ks[0], Ks[1], Ks[2], alpha));
            }

            if (Ns != -1) {
                material.setShininess(Ns);
            }

            return material;
        }
        return null;
View Full Code Here

            _totalMeshes++;
        }
    }

    private void applyCurrentMaterial(final Spatial target) {
        final MaterialState material = _currentMaterial.getMaterialState();
        if (material != null) {
            target.setRenderState(material);
        }

        final TextureState tState = _currentMaterial.getTextureState();
View Full Code Here

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

        // set a material state that applies our vertex coloring to the lighting equation
        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.AmbientAndDiffuse);
        scene.setRenderState(ms);

        // position our camera to take in all of the mesh
        _canvas.getCanvasRenderer().getCamera().setLocation(edge / 2, edge / 2, 2 * edge);

 
View Full Code Here

        }

        final Node n2 = n1.makeCopy(true);
        n2.setTranslation(new Vector3(50, 0, -200));

        final MaterialState ms = new MaterialState();
        ms.setDiffuse(MaterialFace.FrontAndBack, ColorRGBA.RED);
        n2.setRenderState(ms);

        _root.attachChild(n2);
    }
View Full Code Here

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

        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.Diffuse);
        _root.setRenderState(ms);

        _shader = new GLSLShaderObjectsState();
        try {
            _shader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(GLSLRibbonExample.class,
View Full Code Here

        final BlendState bs = new BlendState();
        bs.setBlendEnabled(true);
        _shapeRoot.setRenderState(bs);

        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.Diffuse);
        _shapeRoot.setRenderState(ms);

        // Set up our label
        _text = BasicText.createDefaultTextLabel("label", "[SPACE] display list on");
        _text.setTranslation(10, 10, 0);
View Full Code Here

        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);
        mesh.setRenderState(ms);
    }
View Full Code Here

                renderer.setBackgroundColor(ColorRGBA.BLUE);
                return null;
            }
        });

        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.AmbientAndDiffuse);

        // A box to check aspect ratio of 3D objects
        box1 = new Box("test box 1", new Vector3(-1, -1, -1), new Vector3(1, 1, 1));
        box1.setTranslation(0, 5, 0);
        box1.setRotation(new Quaternion().fromEulerAngles(MathUtils.DEG_TO_RAD * 45, MathUtils.DEG_TO_RAD * 60,
 
View Full Code Here

TOP

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

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.