Package org.jdesktop.wonderland.client.cell.view

Examples of org.jdesktop.wonderland.client.cell.view.ViewCell


        // see if we need to change servers
        // issue #859 - compare URLs as URLs
        if (curSession != null && urlEquals(serverURL,
                curSession.getSessionManager().getServerURL())) {
            // no need to change - make a local move request
            ViewCell vc = curSession.getLocalAvatar().getViewCell();
            if (vc instanceof AvatarCell) {
                ((AvatarCell) vc).triggerGoto(translation, look);
            }

        } else {
View Full Code Here


    public void setPrimaryViewCell(ViewCell cell) {
        if (cell==null)
            detach();
        else
            attach(cell);
        ViewCell oldViewCell = primaryViewCell;
        primaryViewCell = cell;

        // TODO all non primary view cells should track the movements of the primary

        notifyViewManagerListeners(oldViewCell, primaryViewCell);
View Full Code Here

                filename = filename.substring(0, filename.lastIndexOf('.'));
                modelNameTF.setText(filename);

                if (avatarMoveCB.isSelected()) {
                    ViewManager viewManager = ViewManager.getViewManager();
                    ViewCell viewCell = viewManager.getPrimaryViewCell();
                    viewCell.addTransformChangeListener(userMotionListener);
                }
            }
        });

    }
View Full Code Here

    }// </editor-fold>//GEN-END:initComponents

    private void okBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okBActionPerformed
        if (avatarMoveCB.isSelected()) {
            ViewManager viewManager = ViewManager.getViewManager();
            ViewCell viewCell = viewManager.getPrimaryViewCell();
            viewCell.removeTransformChangeListener(userMotionListener);
        }
        setVisible(false);
        Vector3f translation = new Vector3f((Float) translationXTF.getValue(),
                (Float) translationYTF.getValue(),
                (Float) translationZTF.getValue());
View Full Code Here

    private void cancelBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBActionPerformed
        this.setVisible(false);
        if (userMotionListener != null) {
            ViewManager viewManager = ViewManager.getViewManager();
            ViewCell viewCell = viewManager.getPrimaryViewCell();
            viewCell.removeTransformChangeListener(userMotionListener);
        }
        sessionFrame.loadCancelled(importedModel);
    }//GEN-LAST:event_cancelBActionPerformed
View Full Code Here

        if (userMotionListener == null) {
            return;
        }

        ViewManager viewManager = ViewManager.getViewManager();
        ViewCell viewCell = viewManager.getPrimaryViewCell();
        if (avatarMoveCB.isSelected()) {
            enableSpinners(false);
            viewCell.addTransformChangeListener(userMotionListener);
        } else {
            enableSpinners(true);
            viewCell.removeTransformChangeListener(userMotionListener);
        }

    }//GEN-LAST:event_avatarMoveCBActionPerformed
View Full Code Here

     * @return An instance of this class that is the avatar cell renderer
     */
    public static AvatarImiJME getPrimaryAvatarRenderer() {
        // Fetch the primary view cell, make sure it is an avatar and then get
        // its cell renderer.
        ViewCell cell = ClientContextJME.getViewManager().getPrimaryViewCell();
        if (cell instanceof AvatarCell) {
            AvatarCell avatarCell = (AvatarCell) cell;
            return (AvatarImiJME) avatarCell.getCellRenderer(ClientContext.getRendererType());
        }
        return null;
View Full Code Here

                    // Fetch the initial position of the camera. This is based
                    // upon the current avatar position. We can assume that the
                    // primary View Cell exists at this point, since the menu
                    // item is not added until a primary View Cell exists.
                    ViewManager viewManager = ViewManager.getViewManager();
                    ViewCell viewCell = viewManager.getPrimaryViewCell();
                    CellTransform transform = viewCell.getWorldTransform();
                    Vector3f translation = transform.getTranslation(null);

                    // This is the offset from the avatar view Cell to place the
                    // camera
                    Vector3f offset = new Vector3f(0.0f, 4.0f, -10.0f);

                    // force an update
                    camState.setCameraPosition(translation.add(offset));
                }

                // OWL issue #125: Reinitialize the gesture HUD panel with the
                // current avatar character.
                if (gestureHUDRef != null && gestureHUDRef.get() != null) {
                    if (newAvatar instanceof WlAvatarCharacter) {
                        gestureHUDRef.get().setAvatarCharacter((WlAvatarCharacter) newAvatar,
                                                               gestureMI.getState());
                    } else {
                        gestureHUDRef.get().setVisible(false);
                    }
                }
            }
        };

        // A menu item for the chase camera
        chaseCameraMI = new JRadioButtonMenuItem(bundle.getString("Chase_Camera"));
        chaseCameraMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                // Fetch the initial position of the camera. This is based upon
                // the current avatar position. We can assume that the primary
                // View Cell exists at this point, since the menu item is not
                // added until a primary View Cell exists.
                ViewManager viewManager = ViewManager.getViewManager();
                ViewCell viewCell = viewManager.getPrimaryViewCell();
                CellTransform transform = viewCell.getWorldTransform();
                Vector3f translation = transform.getTranslation(null);

                // This is the offset from the avatar view Cell to place the
                // camera
                Vector3f offset = new Vector3f(0.0f, 4.0f, -10.0f);
View Full Code Here

        }

        // Fetch the transform of the view (avatar) Cell and its "look at"
        // direction.
        ViewManager vm = ViewManager.getViewManager();
        ViewCell viewCell = vm.getPrimaryViewCell();
        CellTransform viewTransform = viewCell.getWorldTransform();
        ServerSessionManager manager =
                viewCell.getCellCache().getSession().getSessionManager();

        // The Cell Transform to apply to the Cell
        CellTransform transform = null;

        // Look for the "bounds hint" provided by the Cell. There are three
        // possible cases:
        //
        // (1) There is a hint and the Cell wants us to do the optimal layout
        // so go ahead and do it.
        //
        // (2) There is no hint, so use the default bounds radius and do the
        // optimal layout
        //
        // (3) There is a hint that says do not do the optimal layout, so we
        // will just put the Cell right on top of the avatar.
        BoundingVolumeHint hint = state.getBoundingVolumeHint();

        logger.info("Using bounding volume hint " + hint.getBoundsHint() +
                ", do placement=" + hint.isDoSystemPlacement());
       
        if (hint != null && hint.isDoSystemPlacement() == true) {
            // Case (1): We have a bounds hint and we want to do the layout,
            // so we find the distance away from the avatar and also the height
            // above the ground.
            BoundingVolume boundsHint = hint.getBoundsHint();
            transform = CellPlacementUtils.getCellTransform(manager, boundsHint,
                    viewTransform);
        }
        else if (hint == null) {
            // Case (2): Do the optimal placement using the default radius.
            BoundingVolume boundsHint = new BoundingSphere(DEFAULT_RADIUS, Vector3f.ZERO);
            transform = CellPlacementUtils.getCellTransform(manager, boundsHint,
                    viewTransform);
        }
        else if (hint != null && hint.isDoSystemPlacement() == false) {
            // Case (3): The Cell will take care of its own placement, use
            // the origin of the avatar as the initial placement.
           
            // Issue 998: make sure this is actually the current location of
            // the avatar, and not the origin.  This guarantees that the
            // cell will be in the viewcache of the creator at least, so
            // that the cell object can be (for example) positioned manually
            // by the client.
            transform = viewTransform;
        }
       
        // We also need to convert the initial origin of the Cell (in world
        // coordinates to the coordinates of the parent Cell (if non-null)
        if (parentCellID != null) {
            Cell parent = viewCell.getCellCache().getCell(parentCellID);
            CellTransform worldTransform = new CellTransform(null, null);
            CellTransform parentTransform = parent.getWorldTransform();

            logger.info("Transform of the parent cell: translation=" +
                    parentTransform.getTranslation(null).toString() + ", rotation=" +
View Full Code Here

        // Update the avatar in the background thread.
        Runnable runner = new Runnable() {
            public void run() {
                // Fetch the name of the avatar from the text field first for
                // the loading messages and also the primary view cell
                ViewCell cell = ClientContextJME.getViewManager().getPrimaryViewCell();
                String name = nameTextField.getText().trim();

                // Ask the avatar to generate its character. If null, then
                // clean up the loading message and cursor and return.
                WlAvatarCharacter character = ImiAvatar.getAvatarCharacter(currentParams);
                if (character == null) {
                    LoadingInfo.finishedLoading(cell.getCellID(), name);
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            setBusy(false);
                        }
                    });
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.cell.view.ViewCell

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.