Package org.jdesktop.wonderland.common.cell.state

Examples of org.jdesktop.wonderland.common.cell.state.PositionComponentServerState


            // Check to see if the component server state is the special case
            // of the Position state. If so, set the values in the cell manually.
            if (compState instanceof PositionComponentServerState) {
               
                // Set up the transform (origin, rotation, scaling) and cell bounds
                PositionComponentServerState posState = (PositionComponentServerState)compState;
                setLocalTransform(PositionServerStateHelper.getCellTransform(posState));
                setLocalBounds(PositionServerStateHelper.getCellBounds(posState));
                continue;
            }
View Full Code Here


        // Set the name of the cell
        setup.setName(this.getName());

        // Fill in the details about the origin, rotation, and scaling. Create
        // and add a PositionComponentServerState with all of this information
        PositionComponentServerState position = new PositionComponentServerState();
        position.setBounds(PositionServerStateHelper.getSetupBounds(localBounds));
        position.setTranslation(PositionServerStateHelper.getSetupOrigin(localTransform));
        position.setRotation(PositionServerStateHelper.getSetupRotation(localTransform));
        position.setScaling(PositionServerStateHelper.getSetupScaling(localTransform));
        setup.addComponentServerState(position);

        // add setups for each component
        for (ManagedReference<CellComponentMO> componentRef : components.values()) {
            CellComponentMO component = componentRef.get();
View Full Code Here

                return;
            }

            // We want to modify the position of the new cell slight, so we
            // offset the position by (1, 1, 1).
            PositionComponentServerState position = (PositionComponentServerState)state.getComponentServerState(PositionComponentServerState.class);
            if (position == null) {
                logger.warning("Unable to determine the position of the cell " +
                        "to duplicate with id " + cellID);
                sender.send(clientID, new ErrorMessage(editMessage.getMessageID(),
                        "Unable to determine the position of the cell " +
                        "to duplicate with id " + cellID));
                return;
            }
            Vector3f offset = new Vector3f(1, 0, 1);
            Vector3f origin = position.getTranslation();
            position.setTranslation(offset.add(origin));
            state.addComponentServerState(position);

            // Set the desired name of the cell contained within the message
            state.setName(((CellDuplicateMessage)editMessage).getCellName());
           
View Full Code Here

           
            cellSetup.setBoundingVolumeHint(new BoundingVolumeHint(false, modelBounds));
            deployedModel.setModelBounds(modelBounds);

            Vector3f offset = importedModel.getRootBG().getLocalTranslation();
            PositionComponentServerState position = new PositionComponentServerState();
            Vector3f boundsCenter = modelBounds.getCenter();

            offset.subtractLocal(boundsCenter);
            deployedModel.setModelTranslation(offset);
            deployedModel.setModelRotation(importedModel.getModelBG().getLocalRotation());
            deployedModel.setModelScale(importedModel.getModelBG().getLocalScale().multLocal(scale));

//            System.err.println("BOUNDS CENTER "+boundsCenter);
//            System.err.println("OFfset "+offset);
//            System.err.println("Cell origin "+boundsCenter);
            position.setTranslation(boundsCenter);

            // The cell bounds already have the rotation and scale applied, so these
            // values must not go in the Cell transform. Instead they go in the
            // deployedModel so that the model is correctly oriented and thus
            // matches the bounds in the cell.

            // Center the worldBounds on the cell (ie 0,0,0)
            BoundingVolume worldBounds = modelBounds.clone(null);
            worldBounds.setCenter(new Vector3f(0,0,0));
            position.setBounds(worldBounds);
            cellSetup.addComponentServerState(position);

            deployedModel.addCellServerState(cellSetup);

            deployModels(targetDir,
View Full Code Here

        // add the portal state (by default this will send the user to the
        // origin)
        cellState.addComponentServerState(new PortalComponentServerState());
       
        // set the scaling to make the model smaller
        PositionComponentServerState pcss = new PositionComponentServerState();
        pcss.setScaling(new Vector3f(0.4f, 0.4f, 0.4f));
        cellState.addComponentServerState(pcss);
       
        return (T) cellState;
    }
View Full Code Here

                    url.toExternalForm(), excp);
            return null;
        }

        BoundingVolumeHint hint=null;
        PositionComponentServerState posComp = new PositionComponentServerState();

        if (dm.getModelBounds()==null) {
            // Legacy support, the DeployedModels object for new builds contains
            // the model bounds.
            // Go ahead and load the model. We need to load the model in order to
            // find out its bounds to set the hint.
            ModelLoader loader = dm.getModelLoader();
            Node node = loader.loadDeployedModel(dm, null);
            BoundingVolume bounds = node.getWorldBound();
            hint = getBoundingVolumeHint(bounds);
            posComp.setBounds(bounds);
        } else {
            hint = getBoundingVolumeHint(dm.getModelBounds());
            posComp.setBounds(dm.getModelBounds());
        }

        // Create a new server state for a Model Cell that knows how to display
        // the URL.
        ModelCellServerState state = new ModelCellServerState();
View Full Code Here

        }
       
        logger.info("Final adjusted origin " + transform.getTranslation(null).toString());
       
        // Create a position component that will set the initial origin
        PositionComponentServerState position = (PositionComponentServerState)
                state.getComponentServerState(PositionComponentServerState.class);
        if (position == null) {
            position = new PositionComponentServerState();
            state.addComponentServerState(position);
        }
        position.setTranslation(transform.getTranslation(null));
        position.setRotation(transform.getRotation(null));
        position.setScaling(transform.getScaling(null));

        // Always pass in the view transform to the Cell's server state
        state.addComponentServerState(new ViewComponentServerState(viewTransform));

        // Send the message to the server
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.cell.state.PositionComponentServerState

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.