Examples of ModelCellServerState


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

        return "org.jdesktop.wonderland.client.cell.ModelCell";
    }

    @Override
    public CellServerState getServerState(CellServerState state) {
        return super.getServerState(new ModelCellServerState());
    }
View Full Code Here

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

            targetDir.mkdirs();

            // Must deploy textures before models so we have the deployment url mapping
            deployTextures(targetDir, textureDeploymentMapping, importedModel);

            ModelCellServerState cellSetup = new ModelCellServerState();
            ModelCellComponentServerState setup = new ModelCellComponentServerState();
            cellSetup.addComponentServerState(setup);
            cellSetup.setName(importedModel.getWonderlandName());
           
           
            BoundingVolume modelBounds = importedModel.getModelBG().getWorldBound();
            float scale = scaleBounds(modelBounds);
            modelBounds = modelBounds.transform(new Quaternion(), Vector3f.ZERO,
                                                new Vector3f(scale, scale, scale));
           
            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,
                         moduleName,
View Full Code Here

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

            String deployedURL,
            Vector3f modelTranslation,
            Quaternion modelRotation,
            Vector3f modelScale,
            Map<String, Object> properties) {
        ModelCellServerState cellSetup = new ModelCellServerState();
        JmeColladaCellComponentServerState setup = new JmeColladaCellComponentServerState();
        cellSetup.addComponentServerState(setup);

        setup.setModel(deployedURL);
        setup.setModelScale(modelScale);
        setup.setModelRotation(modelRotation);
        setup.setModelTranslation(modelTranslation);
View Full Code Here

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

    }

    public <T extends CellServerState> T getDefaultCellServerState(
            Properties props) {

        ModelCellServerState cellState = new ModelCellServerState();
        cellState.setBoundingVolumeHint(new BoundingVolumeHint(true,
                new BoundingBox(Vector3f.ZERO,
                                1.44526004f,
                                1.44525876f,
                                0.13593452f)));
       
        // add the model
        ModelCellComponentServerState mccss = new ModelCellComponentServerState();
        mccss.setDeployedModelURL("wla://portal/portal.kmz/portal.kmz.dep");
        mccss.setLightingEnabled(false);
        cellState.addComponentServerState(mccss);
       
        // 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

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

            posComp.setBounds(dm.getModelBounds());
        }

        // Create a new server state for a Model Cell that knows how to display
        // the URL.
        ModelCellServerState state = new ModelCellServerState();
        ModelCellComponentServerState compState = new ModelCellComponentServerState();
        compState.setDeployedModelURL(url.toExternalForm());
        state.addComponentServerState(compState);
        state.setBoundingVolumeHint(hint);
        state.addComponentServerState(posComp);

        // Set the name of the Cell based upon the URL of the model
        state.setName(getFileName(url));

        return (T)state;
    }
View Full Code Here

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

    public String[] getExtensions() {
        return new String[] { "dae" };
    }

    public <T extends CellServerState> T getDefaultCellServerState(Properties props) {
        ModelCellServerState state = new ModelCellServerState();

       // Look for the content-uri field and set if so
       if (props != null) {
           String uri = props.getProperty("content-uri");
           if (uri != null) {
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.