Package org.jdesktop.mtgame

Examples of org.jdesktop.mtgame.WorldManager


        });
        clip2.setInterpolator(Interpolators.getEasingInstance(0.4f, 0.4f));
        clip2.start();
        // End HUGE HACK.

        WorldManager worldManager = ClientContextJME.getWorldManager();
        worldManager.getRenderManager().setDesiredFrameRate(getDesiredFrameRate());

        createUI(worldManager, width, height);

        // Register our loginUI for login requests
        login = new JmeLoginUI(frame);
View Full Code Here


        // get the login manager for the given server
        ServerSessionManager lm = LoginManager.getSessionManager(serverURL);

        // Register physics and phyiscs collision systems for this session
        WorldManager worldManager = ClientContextJME.getWorldManager();
        CollisionManager collisionManager = worldManager.getCollisionManager();
        CollisionSystem collisionSystem = collisionManager.loadCollisionSystem(
                JBulletDynamicCollisionSystem.class);
        JBulletDynamicCollisionSystem jBulletCollisionSystem =
                (JBulletDynamicCollisionSystem) collisionSystem;
        PhysicsManager physicsManager = worldManager.getPhysicsManager();
        JBulletPhysicsSystem jBulletPhysicsSystem =
                (JBulletPhysicsSystem) physicsManager.loadPhysicsSystem(
                JBulletPhysicsSystem.class, jBulletCollisionSystem);
        ClientContextJME.addCollisionSystem(
                lm, "Physics", jBulletCollisionSystem);
View Full Code Here

        // accordingly.
        updateListener = new TransformChangeListener() {
            public void transformChanged(final Cell cell, ChangeSource source) {
                // We need to perform this work inside a proper updater, to
                // make sure we are MT thread safe
                final WorldManager wm = ClientContextJME.getWorldManager();
                RenderUpdater u = new RenderUpdater() {
                    public void update(Object obj) {
                        CellTransform transform = cell.getWorldTransform();
                        rootNode.setLocalTranslation(transform.getTranslation(null));
      rootNode.setLocalRotation(transform.getRotation(null));
                        rootNode.setLocalScale(transform.getScaling(null));
                        wm.addToUpdateList(rootNode);
                    }
                };
                wm.addRenderUpdater(u, this);
            }
        };
        cell.addTransformChangeListener(updateListener);
  setVisible(true);
    }
View Full Code Here

     * Sets whether the bounds viewer is visible (true) or invisible (false).
     *
     * @param visible True to make the affordance visible, false to not
     */
    public synchronized void setVisible(boolean visible) {
        WorldManager wm = ClientContextJME.getWorldManager();

        // If we want to make the affordance visible and it already is not
        // visible, then make it visible. We do not need to put add/remove
        // Entities on the MT Game render thread, they are already thread safe.
        if (visible == true && isVisible == false) {
            wm.addEntity(this);
            isVisible = true;
            return;
        }

        // If we want to make the affordance invisible and it already is
        // visible, then make it invisible
        if (visible == false && isVisible == true) {
            wm.removeEntity(this);
            isVisible = false;
            return;
        }
    }
View Full Code Here

        RenderUpdater updater = new RenderUpdater() {
            public void update(Object arg0) {
                changeAvatarInternal(avatar);
            }
        };
        WorldManager wm = ClientContextJME.getWorldManager();
        wm.addRenderUpdater(updater, null);
    }
View Full Code Here

        logger.info("selectedForInput "+selected);
        selectedForInput = selected;

        if (avatarCharacter!=null) {
             WorldManager wm = ClientContextJME.getWorldManager();

            ((WlAvatarContext) avatarCharacter.getContext()).getBehaviorManager().setEnable(false);

            if (controlScheme == null && selectedForInput) {
                controlScheme = new DefaultCharacterControls(ClientContextJME.getWorldManager());
                ((AvatarControls)wm.getUserData(AvatarControls.class)).setDefault(controlScheme);
            }
            setCollisionController(avatarCharacter);
            if (selectedForInput) {

                // Listen for avatar movement and update the cell
View Full Code Here

        // XXX
        try {
            String serverHostAndPort = manager.getServerNameAndPort();
            String baseURL = "wla://avatarbaseart/";
            URL url = AssetUtils.getAssetURL(baseURL, serverHostAndPort);
            WorldManager worldManager = ClientContextJME.getWorldManager();
            worldManager.addUserData(Repository.class, new Repository(worldManager,
                    new WonderlandAvatarCache(url.toExternalForm(),
                    ClientContext.getUserDirectory("AvatarCache"))));
        } catch (MalformedURLException excp) {
            logger.log(Level.WARNING, "Unable to form avatar base URL", excp);
        } catch(Exception e) {
View Full Code Here

     * {@inheritDoc]
     */
    @Override
    public void cleanup() {
        // XXX should be done in deactivate XXX
        WorldManager worldManager = ClientContextJME.getWorldManager();
        worldManager.removeUserData(Repository.class);

        ServerSessionManager manager = getSessionManager();
        ClientContextJME.getAvatarRenderManager().unregisterRenderer(manager);
       
        super.cleanup();
View Full Code Here

                    Node rootNode = affordance.getRootNode();
                    ClientContextJME.getWorldManager().addEntity(affordance);
                    ClientContextJME.getWorldManager().addToUpdateList(rootNode);
                }
            };
            WorldManager wm = ClientContextJME.getWorldManager();
            wm.addRenderUpdater(updater, this);
            isVisible = true;
            return;
        }

        // If we want to make the affordance invisible and it already is
        // visible, then make it invisible
        if (visible == false && isVisible == true) {
            RenderUpdater updater = new RenderUpdater() {
                public void update(Object arg0) {
                    Affordance affordance = (Affordance)arg0;
                    ClientContextJME.getWorldManager().removeEntity(affordance);
                }
            };
            WorldManager wm = ClientContextJME.getWorldManager();
            wm.addRenderUpdater(updater, this);
            isVisible = false;
            return;
        }
    }
View Full Code Here

    private void deployToServerBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deployToServerBActionPerformed

        String moduleName = targetModuleTF.getText();
        final ArrayList<DeployedModel> deploymentInfo = new ArrayList();
        WorldManager wm = ClientContextJME.getWorldManager();
        final ServerSessionManager targetServer =
                (ServerSessionManager) targetServerSelector.getSelectedItem();

        // Check we are not about to overwrite an existing module
        String url = targetServer.getServerURL();
        ModuleList moduleList = ModuleUtils.fetchModuleList(url);
        ModuleInfo[] modules = moduleList.getModuleInfos();
        if (modules != null) {
            boolean conflict = false;
            for (int i = 0; i < modules.length && !conflict; i++) {
                if (moduleName.equals(modules[i].getName())) {
                    conflict = true;
                }
            }

            if (conflict) {
                int ret = JOptionPane.showConfirmDialog(this,
                        BUNDLE.getString("Module_Conflict_Message"),
                        BUNDLE.getString("Module_Conflict"),
                        JOptionPane.YES_NO_OPTION);
                if (ret == JOptionPane.NO_OPTION) {
                    return;
                }
            }
        }

        final File moduleJar = createModuleJar(deploymentInfo, null);

        // Now deploy to server
        Thread t = new Thread() {
            private JDialog uploadingDialog;
            @Override
            public void run() {
                try {
                    try {
                        SwingUtilities.invokeAndWait(new Runnable() {

                            public void run() {
                                uploadingDialog = new JDialog(ImportSessionFrame.this);
                                    uploadingDialog.setLayout(new BorderLayout());
                                    uploadingDialog.add(loadingDialogPanel, BorderLayout.CENTER);
                                    uploadingDialog.pack();
                                    uploadingDialog.setSize(200, 100);
                                    uploadingDialog.setVisible(true);
                                    uploadingDialog.setAlwaysOnTop(true);
                            }
                        });
                    } catch (InterruptedException ex) {
                        Logger.getLogger(ImportSessionFrame.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InvocationTargetException ex) {
                        Logger.getLogger(ImportSessionFrame.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    ModuleUploader uploader = new ModuleUploader(new URL(targetServer.getServerURL()));

                    // if the authentication type is NONE, don't authenticate,
                    // since the upload will only accept modules from an
                    // administrator.
                    // XXX TODO: we should fix this so that upload writes to
                    // the content repository, so that non-admin users can
                    // upload art when authenication is turned on XXX
                    if (targetServer.getDetails().getAuthInfo().getType() !=
                            AuthenticationInfo.Type.NONE)
                    {
                        uploader.setAuthURL(targetServer.getCredentialManager().getAuthenticationURL());
                    }

                    uploader.upload(moduleJar);
                } catch (MalformedURLException ex) {
                    LOGGER.log(Level.SEVERE, "MalformedURL " + targetServer.getServerURL(), ex);
                    return;
                } catch (IOException e) {
                    LOGGER.log(Level.SEVERE, "IO Exception during upload", e);
                    return;
                } catch (Throwable t) {
                    LOGGER.log(Level.SEVERE, "Exception during upload", t);
                    return;
                }

                // Now create the cells for the new content
                WonderlandSession session =
                        LoginManager.getPrimary().getPrimarySession();
                CellEditChannelConnection connection =
                        (CellEditChannelConnection) session.getConnection(
                        CellEditConnectionType.CLIENT_TYPE);
                for (DeployedModel info : deploymentInfo) {
                    CellID parentCellID = null;
                    CellCreateMessage msg = new CellCreateMessage(
                            parentCellID, info.getCellServerState());
                    connection.send(msg);
                }

                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        uploadingDialog.setVisible(false);
                        uploadingDialog.dispose();
                    }
                });
            }
        };
        t.start();

        // Remove entities, once we create the cells on the server we
        // will be sent the client cells
        for (ImportedModel model : imports) {
            wm.removeEntity(model.getEntity());
        }

        tableModel.setRowCount(0);
        imports.clear();
    }
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.