Package org.jdesktop.mtgame

Examples of org.jdesktop.mtgame.WorldManager


            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();
            wm.addRenderUpdater(updater, wm);
        }
    }
View Full Code Here


     * {@inheritDoc}
     */
    public WlAvatarCharacter getAvatarCharacter(Cell avatarCell,
            String userName, AvatarConfigInfo info) {

        WorldManager wm = ClientContextJME.getWorldManager();
        CharacterParams attributes = new MaleAvatarParams(userName);

        // Formulate the configuration URL to load the info. If null, then use
        // some default.
        String avatarURL = DEFAULT_URL;
View Full Code Here

    }

    // For debug
    public static void printOrthoNodes () {
        // Print ortho nodes attached to the world manager
        WorldManager wm = ClientContextJME.getWorldManager();
        for (int i=0; i < wm.numEntities(); i++) {
            Entity e = wm.getEntity(i);
            RenderComponent rc = (RenderComponent) e.getComponent(RenderComponent.class);
            if (rc == null || !rc.getOrtho()) continue;
            System.err.println("Ortho node = " + rc.getSceneRoot());
            GraphicsUtils.printNode(rc.getSceneRoot());
        }
View Full Code Here

TOP

Related Classes of org.jdesktop.mtgame.WorldManager

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.