Examples of WorldManager


Examples of org.jdesktop.mtgame.WorldManager

                    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

Examples of org.jdesktop.mtgame.WorldManager

    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

Examples of org.jdesktop.mtgame.WorldManager

            }
        }
}//GEN-LAST:event_loadImportGroupMIActionPerformed

private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
    WorldManager wm = ClientContextJME.getWorldManager();
    for (ImportedModel model : imports) {
        wm.removeEntity(model.getEntity());
    }
    imports.clear();
    tableModel.setRowCount(0);
    importTable.repaint();
    setVisible(false);
View Full Code Here

Examples of org.jdesktop.mtgame.WorldManager

        ImportedModel loadedModel = modelLoader.importModel(settings);
        modelBG = loadedModel.getModelBG();

        rootBG.attachChild(modelBG);

        WorldManager wm = ClientContextJME.getWorldManager();

        RenderManager renderManager = wm.getRenderManager();
        ZBufferState buf = (ZBufferState) renderManager.createRendererState(
                RenderState.RS_ZBUFFER);
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);

        MaterialState matState =
                (MaterialState) renderManager.createRendererState(
                RenderState.RS_MATERIAL);
//        matState.setDiffuse(color);
        rootBG.setRenderState(matState);
        rootBG.setRenderState(buf);

        Entity entity = new Entity(loadedModel.getWonderlandName());
        RenderComponent scene = renderManager.createRenderComponent(rootBG);
        entity.addComponent(RenderComponent.class, scene);

        scene.setLightingEnabled(loadedModel.getImportSettings().isLightingEnabled());

        entity.addComponent(TransformProcessorComponent.class,
                new TransformProcessorComponent(wm, modelBG, rootBG));

        wm.addEntity(entity);
        loadedModel.setEntity(entity);

//        findTextures(modelBG);

        return loadedModel;
View Full Code Here

Examples of org.jdesktop.mtgame.WorldManager

     * a field of the argument color.
     */
    public void setColorAndOpacity (final ColorRGBA color) {
        setColor(color);

        final WorldManager wm = ClientContextJME.getWorldManager();
        wm.addRenderUpdater(new RenderUpdater() {
            public void update(Object 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();

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

                wm.addToUpdateList(quad);
            }
        }, null);
    }
View Full Code Here

Examples of org.jdesktop.mtgame.WorldManager

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

Examples of org.jdesktop.mtgame.WorldManager

     * 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

Examples of org.jdesktop.mtgame.WorldManager

        // Generate the set of character attributes, and create a new avatar
        // character from that.
        CharacterParams cp = params.getCharacterParams();
        cp.setBaseURL(baseURL);

        WorldManager wm = ClientContextJME.getWorldManager();
        WlAvatarCharacter wlc = new WlAvatarCharacter.WlAvatarCharacterBuilder(cp, wm).addEntity(false).build();

        // We need to manually apply all of the colors if they are present
        ConfigElement ce = params.getElement(ConfigType.HAIR_COLOR);
        if (ce != null) {
View Full Code Here

Examples of org.jdesktop.mtgame.WorldManager

        } catch (MalformedURLException excp) {
            logger.log(Level.WARNING, "Unable to annotate URI", excp);
            return null;
        }

        WorldManager wm = ClientContextJME.getWorldManager();
        return new WlAvatarCharacter.WlAvatarCharacterBuilder(url, wm).baseURL(baseURL).addEntity(false).build();
    }
View Full Code Here

Examples of org.jdesktop.mtgame.WorldManager

        } catch (MalformedURLException ex) {
            logger.log(Level.WARNING, "Unable to form base url", ex);
            return null;
        }

        WorldManager wm = ClientContextJME.getWorldManager();
        return new WlAvatarCharacterBuilder(configURL, wm).baseURL(baseURL).addEntity(false).build();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.