Package org.jdesktop.wonderland.client.jme.utils.graphics

Examples of org.jdesktop.wonderland.client.jme.utils.graphics.TexturedQuad


            if ((node == null) || !(node.getChild(0) instanceof TexturedQuad)) {
                logger.warning("can't find quad for view, unable to set transparency");
                return;
            }
            final TexturedQuad quad = (TexturedQuad) node.getChild(0);

            RenderUpdater updater = new RenderUpdater() {

                public void update(Object arg0) {
                    WorldManager wm = (WorldManager) arg0;

                    BlendState as = (BlendState) wm.getRenderManager().createRendererState(RenderState.StateType.Blend);
                    // activate blending
                    as.setBlendEnabled(true);
                    // set the source function
                    as.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
                    // set the destination function
                    as.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
                    // disable test
                    as.setTestEnabled(false);
                    // activate the blend state
                    as.setEnabled(true);

                    // 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;
                    }

                    ColorRGBA color = quad.getDefaultColor();
                    color.a = transparency;
                    quad.setDefaultColor(color);

                    wm.addToUpdateList(quad);
                }
            };
            WorldManager wm = ClientContextJME.getWorldManager();
View Full Code Here


     * @param view The view object the geometry is to display.
     */
    GeometryNodeQuad (View2D view) {
        super(view);

        quad = new TexturedQuad(null, "TexturedQuad for Geometry Node of " + view.getName());
        quad.setModelBound(new BoundingBox());
        attachChild(quad);

        // Arbitrary; will be later changed
        setSize(1f, 1f);
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected Spatial[] getSpatials() {
        if (quad == null) {
            quad = new TexturedQuad(texture, "FrameTexRect-Quad", width, height);
            quad.setModelBound(new BoundingBox());
            quad.updateModelBound();
        }
        return new Spatial[]{quad};
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.jme.utils.graphics.TexturedQuad

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.