Package com.jme.math

Examples of com.jme.math.Vector3f


            }

            // Get the vector of the drag motion from the initial starting
            // point in world coordinates.
            MouseDraggedEvent3D dragEvent = (MouseDraggedEvent3D) event;
            Vector3f dragVector = dragEvent.getDragVectorWorld(dragStartWorld,
                    dragStartScreen, new Vector3f());

            // Figure out how to translate based upon the axis of the affordance
            Vector3f addVector;
            float moved = 0.0f;
            switch (direction) {
                case X_AXIS:
                    addVector = new Vector3f(dragVector.x, 0, 0);
                    moved = dragVector.x;
                    break;

                case Y_AXIS:
                    addVector = new Vector3f(0, dragVector.y, 0);
                    moved = dragVector.y;
                    break;

                case Z_AXIS:
                    addVector = new Vector3f(0, 0, dragVector.z);
                    moved = dragVector.z;
                    break;

                default:
                    addVector = new Vector3f();
                    break;
            }

            // Update the position label, make sure we do this in an AWT Event
            // Thread
View Full Code Here


                    logger.fine("attenuate other groups");
        softphonePlayer.attenuateOtherGroups(audioGroup, 0, 0);
                    logger.fine("back from attenuate other groups");
                }
            } else {
    Vector3f center = new Vector3f();

    phoneCellMO.getWorldBounds().getCenter(center);

          center.setY((float).5);

                new Orb(listing.getContactName(), listing.getContactName(),
        externalCallID, center, .1, listing.simulateCalls());
      }

            if (listing.simulateCalls() == false) {
                //Place the calls audio at the phones position
             Vector3f location = new Vector3f();

                location = phoneCellMO.getWorldTransform(null).getTranslation(location);

                externalPlayer.moved(location.x, location.y, location.z, 0);
            }
         
            /*
       * Send PLACE_CALL_RESPONSE message back to all the clients
       * to signal success.
       */
            sender.send(clientID, new PlaceCallResponseMessage(
    phoneCellMO.getCellID(), listing, true));

      logger.fine("back from notifying user");
      return;
  }

  if (msg instanceof JoinCallMessage) {
            //Our phone cell wants us to join the call into the world.
           
            if (listing.simulateCalls() == false) {
                //Stop any current ringing.
          try {
                    softphoneCall.stopTreatment("ring_tone.au");
          } catch (IOException e) {
        logger.fine("Unable to stop treatment to " + softphoneCall + ":  "
            + e.getMessage());
          }

    AudioGroup defaultLivePlayerAudioGroup = parameters.livePlayerAudioGroup;

    defaultLivePlayerAudioGroup.addPlayer(externalPlayer,
        new AudioGroupPlayerInfo(true,
        AudioGroupPlayerInfo.ChatType.PUBLIC));

    AudioGroup defaultStationaryPlayerAudioGroup = parameters.stationaryPlayerAudioGroup;

    defaultStationaryPlayerAudioGroup.addPlayer(externalPlayer,
        new AudioGroupPlayerInfo(false,
        AudioGroupPlayerInfo.ChatType.PUBLIC));

          softphonePlayer.attenuateOtherGroups(audioGroup,
        AudioGroup.DEFAULT_SPEAKING_ATTENUATION,
        AudioGroup.DEFAULT_LISTEN_ATTENUATION);

    audioGroup.removePlayer(externalPlayer);
    audioGroup.removePlayer(softphonePlayer);
          vm.removeAudioGroup(audioGroup);
            }
           
            listing.setPrivateClientName("");
             
            //Inform the PhoneCells that the call has been joined successfully
            sender.send(clientID, new JoinCallResponseMessage(
    phoneCellMO.getCellID(), listing, true));
           
      Vector3f center = new Vector3f();

      phoneCellMO.getWorldBounds().getCenter(center);

            center.setY((float).5);

            new Orb(listing.getContactName(), listing.getContactName(), externalCallID,
    center, .1, false);
      return;
  }
View Full Code Here

    public void setServerState(CellServerState cellServerState) {
        super.setServerState(cellServerState);

  ConeOfSilenceCellServerState coneOfSilenceCellServerState = (ConeOfSilenceCellServerState) cellServerState;

  setLocalBounds(new BoundingSphere(4.5f, new Vector3f()));
    }
View Full Code Here

    public PhoneCellMO() {
    }

    public PhoneCellMO(Vector3f center, float size) {
        super(new BoundingBox(new Vector3f(), size, size, size),
                new CellTransform(null, center));
    }
View Full Code Here

            radius = Math.max(xExtent, Math.max(yExtent, zExtent));
        }

        // Fetch the world translation for the root node of the cell and set
        // the translation for this entity root node
        Vector3f translation = sceneRoot.getWorldTranslation();
        rootNode.setLocalTranslation(translation);
        rootNode.setLocalScale(new Vector3f(LENGTH_SCALE, LENGTH_SCALE, LENGTH_SCALE));

        resizeEntity = new Entity("Sphere Entity");
        Node sphereNode = createSphereNode("Sphere Node");
        addSubEntity(resizeEntity, sphereNode);
        resizeListener = addResizeListener(resizeEntity, sphereNode);

        // Listen for changes to the cell's translation and apply the same
        // update to the root node of the affordances. We also re-set the size
        // of the affordances: this handles the case where the bounds of the
        // scene graph has changed and we need to update the affordances
        // accordingly.
        sceneRoot.addGeometricUpdateListener(updateListener = new GeometricUpdateListener() {
            public void geometricDataChanged(final Spatial spatial) {
                RenderUpdater u = new RenderUpdater() {
                    public void update(Object arg0) {
                        Vector3f translation = spatial.getWorldTranslation();
                        rootNode.setLocalTranslation(translation);
                        setSizeInternal(currentScale);
                        ClientContextJME.getWorldManager().addToUpdateList(rootNode);
                    }
                };
View Full Code Here

            scale = (newRadius / radius) * currentScale;
        }

        // In order to set the size of the resize affordance, we just scale
        // the root node.
        rootNode.setLocalScale(new Vector3f(scale, scale, scale));
        ClientContextJME.getWorldManager().addToUpdateList(rootNode);
    }
View Full Code Here

     * an
     */
    protected void viewCellMoved(CellID viewCellID, CellTransform viewCellTransform,
                                 boolean cleanup)
    {
        Vector3f viewCellWorldTranslation = viewCellTransform.getTranslation(null);

        // View Cell has moved
        synchronized(lock) {
            int currentContainerIndex = -1;      // -1 = not in any bounding volume
            int i = 0;
View Full Code Here

            }
        }
    }

    private boolean contains(BoundingBox bounds, Vector3f point) {
  Vector3f center = bounds.getCenter();
  Vector3f extent = bounds.getExtent(null);
 
        return FastMath.abs(center.x - point.x) - extent.x <= .01
                && FastMath.abs(center.y - point.y) - extent.y <= .01
                && FastMath.abs(center.z - point.z) - extent.z <= .01;
    }
View Full Code Here

    /**
     * Returns the view frustum bounds. This is computed from the values
     * provided in the last computeViewPlatformTransform call
     */
    public static BoundingVolume getFrustumBounds(CellTransform avatarT3D) {
        Vector3f p = new Vector3f(0f,0f,-MAX_VIEW_DISTANCE/2f*0.95f);
        avatarT3D.transform(p);
               
        return new BoundingSphere(MAX_VIEW_DISTANCE/2, p);
    }
View Full Code Here

    /**
     * Compute and return the View Platform Transform3D give the users position, direction and up
     */
    public static Matrix4f computeViewPlatformTransform(Vector3f userPosition, Vector3f direction, Vector3f up) {       
        Matrix4f mat = new Matrix4f();
        Vector3f axisX = new Vector3f();
        Vector3f axisY = new Vector3f();
        Vector3f axisZ = new Vector3f(direction);
        axisZ.negate();
        axisZ.normalize();

        axisX.cross(up, axisZ);
        axisX.normalize();

        axisY.cross(axisZ, axisX);
View Full Code Here

TOP

Related Classes of com.jme.math.Vector3f

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.