Package org.jdesktop.wonderland.common.cell

Examples of org.jdesktop.wonderland.common.cell.CellTransform


            };
        }

        return new ResponseListener() {
            public void responseReceived(ResponseMessage response) {
                CellTransform requestedTransform = null;
                CellTransform actualTransform = null;

                if (response instanceof MovableMessageResponse) {
                    MovableMessageResponse msg = (MovableMessageResponse) response;
                    actualTransform = new CellTransform(msg.getRotation(),
                                                        msg.getTranslation(),
                                                        msg.getScale());
                }
              
                int reason = 1;
View Full Code Here


     * Called when a message arrives from the server requesting that the
     * cell be moved.
     * @param msg the message received from the server
     */
    protected void serverMoveRequest(MovableMessage msg) {
        CellTransform transform = msg.getCellTransform();
        applyLocalTransformChange(transform, TransformChangeListener.ChangeSource.REMOTE);
        notifyServerCellMoveListeners(msg, transform, CellMoveSource.REMOTE);
    }
View Full Code Here

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

    private Placemark getCurrentPlacemark(ServerSessionManager sessionManager) {
        // Fetch the current translation of the avatar and the (x, y, z) of its
        // position
        ViewManager manager = ViewManager.getViewManager();
        ViewCell viewCell = manager.getPrimaryViewCell();
        CellTransform viewTransform = viewCell.getWorldTransform();
        Vector3f location = viewTransform.getTranslation(null);
        float x = location.x;
        float y = location.y;
        float z = location.z;

        // Find out what the URL to the server is
        String url = sessionManager.getServerURL();

        // Compute the current look angle, as degrees from the +x axis, ignoring
        // any look in the y-axis.
        Quaternion viewRotation = viewTransform.getRotation(null);

        Vector3f v1 = new Vector3f(0, 0, 1);
        Vector3f normal = new Vector3f(0, 1, 0);
        Vector3f v2 = viewRotation.mult(v1);
        v2.normalizeLocal();
View Full Code Here

      time = now;
  }

        movableComp.localMoveRequest(
            new CellTransform(rotation, currentPosition));

  if (listener != null) {
      listener.positionChanged(currentPosition);
  }
    }
View Full Code Here

            } catch (NoSuchElementException ex) {
            }
        }
        if (cellView == null) {
            // Return identity. (This happens in the SAS).
            return new CellTransform(null, null);
        }

        return cellView.getUserTransformCell();
    }
View Full Code Here

        // React to transform related changes
        // Uses: type, parent, pixelscale, size, offset, ortho, locationOrtho, stack
        if ((changeMask & (CHANGED_TYPE | CHANGED_PARENT | CHANGED_PIXEL_SCALE | CHANGED_SIZE_APP |
                           CHANGED_OFFSET | CHANGED_ORTHO | CHANGED_LOCATION_ORTHO | CHANGED_STACK)) != 0) {
            CellTransform transform = null;

            switch (type) {
            case UNKNOWN:
            case PRIMARY:
                transform = new CellTransform(null, null);
                if (ortho) {
                    Vector3f orthoLocTranslation = new Vector3f();
                    orthoLocTranslation.x = locationOrtho.x;
                    orthoLocTranslation.y = locationOrtho.y;
                    transform.setTranslation(orthoLocTranslation);
                } else {
                    // Note: primaries now also honor the offset.
                    // Uses: type, parent, pixelScale, size, offset, ortho
                    transform = calcOffsetStackTransform();
                }
                break;
            case SECONDARY:
            case POPUP:
                // Uses: type, parent, pixelScale, size, offset, ortho
                transform = calcOffsetStackTransform();
            }
            sgChangeGeometryTransformOffsetStackSet(geometryNode, transform);
        }

        // Update the view node's user transform, if necessary
        // Uses: type, deltaTranslationToApply
        if ((changeMask & (CHANGED_TYPE | CHANGED_USER_TRANSFORM | CHANGED_ORTHO)) != 0) {

            // Select the current user transform based on the ortho mode
            CellTransform currentUserTransform;
            if (ortho) {
                currentUserTransform = userTransformOrtho;
            } else {
                currentUserTransform = userTransformCell;
            }

            if (!userTransformCellReplaced) {           
                // Apply any pending user transform deltas (by post-multiplying them
                // into the current user transform
                logger.fine("currentUserTransform (before) = " + currentUserTransform);
                userTransformApplyDeltas(currentUserTransform);
            }

            logger.fine("currentUserTransform (latest) = " + currentUserTransform);

            // Now put the update user transformation into effect
            switch (type) {
            case UNKNOWN:
            case PRIMARY:
                updatePrimaryTransform(currentUserTransform);
                break;
            case SECONDARY:
                sgChangeTransformUserSet(viewNode, currentUserTransform);
                // Note: moving a secondary in the cell doesn't change the position
                // of the secondary in ortho, and vice versa.
                if (!ortho && !userTransformCellChangedLocalOnly) {
                    window.changedUserTransformCell(userTransformCell, this);
                }
                break;
            case POPUP:
                // Always set to identity
                sgChangeTransformUserSet(viewNode, new CellTransform(null, null));
            }

            userTransformCellReplaced = false;
            userTransformCellChangedLocalOnly = false;
        }
View Full Code Here

    protected abstract Entity getParentEntity ();

    // Uses: type, parent, pixelscale, size, offset
    // View2DCell subclass uses: type, ortho, parent, stack
    private CellTransform calcOffsetStackTransform () {
        CellTransform transform = new CellTransform(null, null);

        // Uses: parent, pixelScale, size, offset, ortho
        Vector3f offsetTranslation = calcOffsetTranslation();

        // Uses: type
        Vector3f stackTranslation = calcStackTranslation();

        offsetTranslation.addLocal(stackTranslation);

        // TODO: HACK: Part 3 of 4 temporary workaround for 951
        offsetTranslation.addLocal(new Vector3f(0f, 0f, hackZEpsilon));

        transform.setTranslation(offsetTranslation);

        return transform;
    }
View Full Code Here

    }

    // Apply any pending translation delta to the given user transform.
    protected void userTransformApplyDeltaTranslation (CellTransform userTransform) {
        if (deltaTranslationToApply != null) {
            CellTransform transform = new CellTransform(null, null);
            transform.setTranslation(deltaTranslationToApply);
            //System.err.println("******* delta translation transform = " + transform);
            userTransform.mul(transform);
            deltaTranslationToApply = null;
        }
    }
View Full Code Here

                         break;
                     }

                     case TRANSFORM_USER_SET: {
                         SGChangeTransformUserSet chg = (SGChangeTransformUserSet) sgChange;
                         CellTransform userTransform = chg.transform.clone(null);
                         Quaternion r = userTransform.getRotation(null);
                         chg.viewNode.setLocalRotation(r);
                         logger.fine("View node set rotation = " + r);
                         Vector3f t = userTransform.getTranslation(null);
                         chg.viewNode.setLocalTranslation(t);
                         logger.fine("View node set translation = " + t);
                         break;
                     }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.cell.CellTransform

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.