Package com.jme.scene.state

Examples of com.jme.scene.state.MaterialState


                    // assign the blender state to the node
                    quad.setRenderState(as);
                    quad.updateRenderState();

                    MaterialState ms = (MaterialState) quad.getRenderState(RenderState.StateType.Material);
                    if (ms == null) {
                        ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
                        quad.setRenderState(ms);
                    }

                    if (ms != null) {
                        ColorRGBA diffuse = ms.getDiffuse();
                        diffuse.a = 1.0f - transparency;
                        ms.setDiffuse(diffuse);
                    } else {
                        logger.warning("quad has no material state, unable to set transparency");
                        return;
                    }
View Full Code Here


    public synchronized void setColor(final ColorRGBA color) {
        if (quad != null) {
            ClientContextJME.getWorldManager().addRenderUpdater(new RenderUpdater() {
                public void update(Object arg0) {
                    if (quad != null) {
                        MaterialState ms = (MaterialState) quad.getRenderState(RenderState.RS_MATERIAL);
                        if (ms == null) {
                            ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
                            quad.setRenderState(ms);
                        }
                        ms.setAmbient(new ColorRGBA(color));
                        ms.setDiffuse(new ColorRGBA(color));
                        ClientContextJME.getWorldManager().addToUpdateList(localToCellNode);
                    }
                }
            }, null);
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public ColorRGBA getColor() {
        MaterialState ms = null;
        if (quad != null) {
            ms = (MaterialState) quad.getRenderState(RenderState.RS_MATERIAL);
        }
        if (ms == null) {
            return new ColorRGBA(1f, 1f, 1f, 1f);
        } else {
            return ms.getDiffuse();
        }
    }
View Full Code Here

TOP

Related Classes of com.jme.scene.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.