Package org.jdesktop.wonderland.client.jme

Examples of org.jdesktop.wonderland.client.jme.ViewManager


                        filename.lastIndexOf(File.separatorChar) + 1);
                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


        pack();
    }// </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(),
View Full Code Here

}//GEN-LAST:event_okBActionPerformed

    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

    private void avatarMoveCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_avatarMoveCBActionPerformed
        if (userMotionListener == null) {
            return;
        }

        ViewManager viewManager = ViewManager.getViewManager();
        ViewCell viewCell = viewManager.getPrimaryViewCell();
        if (avatarMoveCB.isSelected()) {
            enableSpinners(false);
            viewCell.addTransformChangeListener(userMotionListener);
        } else {
            enableSpinners(true);
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);

                // Create the camera state if it does not yet exist. Initialize
                // the initial position to that of the view Cell.
                if (camState == null) {
                    camModel = (ChaseCamModel) CameraModels.getCameraModel(ChaseCamModel.class);
                    camState = new ChaseCamState(offset, new Vector3f(0.0f, 1.8f, 0.0f));
                    camState.setDamping(1.7f);
                    camState.setLookAtDamping(1.7f);
                }
                camState.setCameraPosition(translation.add(offset));
                camState.setTargetCharacter(avatarCellRenderer.getAvatarCharacter());

                // Create the Chase Camera with the model and state and add to
                // the View Manager
                FlexibleCameraAdapter chaseCamera =
                        new FlexibleCameraAdapter(camModel, camState);
                viewManager.setCameraController(chaseCamera);
            }
        });

        // A menu item for a test control panel for the avatar.
//        avatarControlsMI = new JMenuItem(bundle.getString("Avatar_Controls"));
View Full Code Here

     */
    public void stateChanged(State state) {
        if (state == State.READY) {
            // If the state is ready, then set-up the primary view Cell if it is
            // ready or wait for it to become ready.
            ViewManager manager = ViewManager.getViewManager();
            manager.addViewManagerListener(this);
            if (manager.getPrimaryViewCell() != null) {
                // fake a view cell changed event
                primaryViewCellChanged(null, manager.getPrimaryViewCell());
            }
        }
    }
View Full Code Here

        // repository and set the initial values in the view manager's
        // properties
        try {
            ViewProperties properties =
                    ViewPropertiesUtils.loadViewProperties();
            ViewManager manager = ViewManager.getViewManager();
            ViewProperties viewProperties = manager.getViewProperties();
            viewProperties.setFieldOfView(properties.getFieldOfView());
            viewProperties.setFrontClip(properties.getFrontClip());
            viewProperties.setBackClip(properties.getBackClip());
        } catch (java.lang.Exception excp) {
            LOGGER.log(Level.WARNING,
View Full Code Here

    public ViewPropertiesJDialog() {
        initComponents();
        setTitle(BUNDLE.getString("View_Properties"));

        // Fetch the view properties object
        ViewManager manager = ViewManager.getViewManager();
        viewProperties = manager.getViewProperties();

        // Listen for when the field-of-view slider value is changed and update
        // the text field.
        fovSlider.addChangeListener(new ChangeListener() {
View Full Code Here

    public static Vector3f getCellOrigin(ServerSessionManager session,
            BoundingVolume bounds, CellTransform viewTransform) {

        // If the given session is null, then simply take the current primary
        // session.
        ViewManager vm = ViewManager.getViewManager();
        if (session == null) {
            session = LoginManager.getPrimary();
        }

        // Fetch a whole bunch of things about the view cell: its transform,
        // position, rotation, and "look at" vector.
        Vector3f viewPosition = viewTransform.getTranslation(null);
        Quaternion viewRotation = viewTransform.getRotation(null);
        Vector3f lookAt = CellPlacementUtils.getLookDirection(viewRotation, null);

        logger.info("Using position of view cell " + viewPosition);
        logger.info("Using look-at vector of view cell " + lookAt);

        // Use the "Default" collision system
        JMECollisionSystem system = (JMECollisionSystem)
                ClientContextJME.getCollisionSystem(session, "Default");

        // Project a vector away from the avatar and see the distance to the
        // closest collidable. We want to make sure that the Cell is in front
        // of this collidable by a small (0.1f) amount.
//        float minDistance = CellPlacementUtils.getVectorToCollidable(system,
//                viewPosition, lookAt);
//        logger.warning("Distance away from the closest collidable " + minDistance);
        float minDistance = -1.0f;

        // Find the distance away from the view Cell to place the Cell based
        // upon the field-of-view, subject to a minimum and maximum distance.
        float fov = vm.getViewProperties().getFieldOfView();
        float distance = CellPlacementUtils.getDistance(bounds, fov,
                MIN_DISTANCE, minDistance);

        logger.info("Using field-of-view " + fov + " degrees.");
        logger.info("Distance away to place the Cell " + distance);
View Full Code Here

            return null;
        }

        // 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
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.client.jme.ViewManager

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.