Package org.jdesktop.wonderland.common.cell

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


        ContentExporterSPI exporter =
                ContentExportManager.INSTANCE.getContentExporter(selectedCell.getClass());
       
        // find the origin, which is the same as the location we would use to
        // go to the given cell
        CellTransform origin = getGotoLocation(selectedCell);
       
        // adjust the height so the export is relative to the avatar's current
        // height
        Vector3f translation = origin.getTranslation(null);
        CellTransform avatarTransform = ViewManager.getViewManager().getPrimaryViewCell().getWorldTransform();
        translation.y = avatarTransform.getTranslation(null).getY();
        origin.setTranslation(translation);
       
        exporter.exportCells(new Cell[] { selectedCell }, origin);      
    }//GEN-LAST:event_exportButtonActionPerformed
View Full Code Here


        bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        bs.setTestEnabled(true);
        bs.setTestFunction(BlendState.TestFunction.GreaterThan);
        rootNode.setRenderState(bs);

        CellTransform transform = cell.getWorldTransform();
        // Draw an arrow that mimics the light position --direction still under
        //construction.
        TextLabel2D label = new TextLabel2D(name,
                                            Color.black, Color.white, 1.0f, true, Font.getFont("SANS_SERIF"));
       
        Vector3f direction = directionalLight.getDirection();
        Vector3f position = lightNode.getLocalTranslation();
        Vector3f labelPosition = new Vector3f(position.x, position.y + 3, position.z);
       
        Arrow arrow = new Arrow("Arrow", 3, 0.5f);
        Node rotatedOnX = new Node("Rotated For Arrow");
        rotatedOnX.setLocalRotation(new Quaternion().fromAngleAxis(90*FastMath.DEG_TO_RAD, new Vector3f(1, 0, 0)));
        rotatedOnX.attachChild(arrow);
        rotatedOnX.setLocalTranslation(position);
//        arrow.setLocalTranslation(position);
        label.setLocalTranslation(labelPosition);
        arrow.lookAt(direction, new Vector3f(0,1,0));
        rootNode.attachChild(label);
        rootNode.attachChild(rotatedOnX);
        // Fetch the world translation for the root node of the cell and set
        // the translation for this entity root node
        rootNode.setLocalTranslation(transform.getTranslation(null));
  rootNode.setLocalRotation(transform.getRotation(null));
        // OWL issue #61: make sure to take scale into account
        rootNode.setLocalScale(transform.getScaling(null));
       
        // Listen for changes to the cell's translation and apply the same
        // update to the root node of the bounds viewer. We also re-set the size
        // of the bounds: this handles the case where the bounds of the
        // scene graph has changed and we need to update the bounds viewer
        // 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);
            }
View Full Code Here

            private Vector3f look = new Vector3f();
            private Vector3f pos = new Vector3f();

            public void transformChanged(Cell cell, ChangeSource source) {
                CellTransform t = cell.getWorldTransform();
                t.getLookAt(pos, look);

                look.mult(3);
                pos.addLocal(look);

                currentTranslation.set(pos);
View Full Code Here

            // from it and send this translation in the sync info.
            // TODO: someday: We can get away with this only because we currently don't
            // support secondary rotations. When we finally do support secondary
            // rotations we'll need to modify the sync protocol to send the entire
            // transform.
            CellTransform userTransformCell = win.getUserTransformCell();
            Vector3f userTranslation = userTransformCell.getTranslation(null);
            AppXrw.logger.info("userTranslation = " + userTranslation);

            // Send basic window attributes
            encode(syncBuf, 0, win.getWid());
            encode(syncBuf, 4, win.getOffsetX());
View Full Code Here

        logger.info("initialPlacementDone = " + state.isInitialPlacementDone());

        if (App2D.doAppInitialPlacement && !state.isInitialPlacementDone()) {
            // Initial cell placement hasn't yet been done. Volunteer to do it.
            CellTransform creatorViewTransform = state.getCreatorViewTransform();
            logger.info("creatorViewTransform = " + creatorViewTransform);
            if (creatorViewTransform != null) {
                fvi = new FirstVisibleInitializerCell(this, creatorViewTransform, initialPlacementSize);
            }
            logger.info("fvi = " + fvi);
View Full Code Here

            Logger.getLogger("org.jdesktop.wonderland.modules.appbase.client.cell.App2D.CellTransform");
       
        public void transformChanged(Cell cell, ChangeSource source) {
            logger.info("cell = " + cell.getName() + "(" + cell.getCellID() + ")");
            logger.info("source = " + source);
            CellTransform localTransform = cell.getLocalTransform();
            logger.info("localTransform = " + localTransform);
        }
View Full Code Here

        BoundingBox bbox = new BoundingBox(new Vector3f(), width3D/2.0f, height/2.0f, 1f);
        logger.info("new bbox = " + bbox);
       
        // Calculate the "best" initial cell transform, based on the size of the first
        // window made visible.
        CellTransform ct = CellPlacementUtils.getCellTransform(null, bbox, creatorViewTransform);
        if (ct != null) {
            logger.info("Best initial cell transform = " + ct);

            // if this cell has a parent, make sure to compute the child
            // relative to that parent
            if (cell.getParent() != null) {
                CellTransform pt = cell.getParent().getWorldTransform();
                ct = ScenegraphUtils.computeChildTransform(pt, ct);
            }
           
            cell.performFirstMove(ct);
        }
View Full Code Here

            windowParents.put(win, parentWid);
        }

        win.setDesiredZOrder(desiredZOrder);

        CellTransform userTransformCell = new CellTransform(null, null);
        userTransformCell.setTranslation(userTranslation);
        win.setUserTransformCellLocal(userTransformCell);

        boolean show = (bufQueue.nextByte() == 1) ? true : false;
        AppXrw.logger.info("show = " + show);
View Full Code Here

     * @param childWorldTransform
     * @return
     */
    public static CellTransform computeChildTransform(CellTransform parentWorld, CellTransform childWorldTransform) {

        CellTransform pInv = parentWorld.clone(null).invert();

        CellTransform newChildLocal = new CellTransform();
        newChildLocal.mul(pInv, childWorldTransform);

        return newChildLocal;
    }
View Full Code Here

        /**
         * @inheritDoc()
         */
        public void rotationPerformed(Quaternion rotation) {
            // Move the cell via the moveable comopnent
            CellTransform transform = cell.getLocalTransform();
            Quaternion newRotation = rotationOnPress.mult(rotation);
            transform.setRotation(newRotation);
            movableComp.localMoveRequest(transform);
        }
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.