Package com.jme.math

Examples of com.jme.math.Matrix4f


     */
    @InternalAPI
    public Matrix4f getCameraModelViewMatrix (Matrix4f ret) {
  synchronized (cameraLock) {
      if (ret == null) {
    return new Matrix4f(cameraModelViewMatrix);
      }
      ret.set(cameraModelViewMatrix);
      return ret;
  }
    }
View Full Code Here


     */
    @InternalAPI
    public Matrix4f getCameraModelViewMatrixInverse (Matrix4f ret) {
  synchronized (cameraLock) {
      if (cameraModelViewMatrixInverse == null) {
    cameraModelViewMatrixInverse = cameraModelViewMatrix.invert(new Matrix4f());
      }
      if (ret == null) {
    return new Matrix4f(cameraModelViewMatrixInverse);
      }
      ret.set(cameraModelViewMatrixInverse);
      return ret;
  }
    }
View Full Code Here

  Vector3f thisWorld = ((InputManager3D)InputManager3D.getInputManager()).
      getCamera().getWorldCoordinates(scrPos, 0f);
  logger.fine("thisWorld = " + thisWorld);

  // The calculations need to take place in eye space. Get the necessary matrices.
  Matrix4f camMatrix = InputPicker3D.getInputPicker().getCameraModelViewMatrix(null);
  Matrix4f camInverse = InputPicker3D.getInputPicker().getCameraModelViewMatrixInverse(null);
  logger.finest("camInverse = " + camInverse);

  // Transform vectors from world space into eye space
  Vector3f dragEye = new Vector3f();
  Vector3f dragStartEye = new Vector3f();
  Vector3f pressEye = new Vector3f();
  Vector3f eyeEye = new Vector3f();
  Vector3f thisEye = new Vector3f();
  camInverse.mult(dragWorld, dragEye);
  camInverse.mult(dragStartWorld, dragStartEye);
  camInverse.mult(pressWorld, pressEye);
  // TODO: perf: only really need to recalc eyeEye on camera change
  camInverse.mult(eyeWorld, eyeEye);
  camInverse.mult(thisWorld, thisEye);

  // The displacement vector of this event from the center of the drag plane
  Vector3f dragVectorEye = new Vector3f(
            (dragEye.x - pressEye.x) * (dragStartEye.z - eyeEye.z) / (thisEye.z - eyeEye.z),
      (pressEye.y - dragEye.y) * (dragStartEye.z - eyeEye.z) / (thisEye.z - eyeEye.z),
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();
View Full Code Here

        }
        logger.fine("world point = " + point);

        // The first thing we do is transform the point into local coords
        // TODO: perf: avoid doing a matrix invert every time
        Matrix4f local2World = getLocalToWorldMatrix(null);
        Matrix4f world2Local = local2World.invert();
        Vector3f pointLocal = world2Local.mult(point, new Vector3f());
        logger.fine("local point = " + pointLocal);

        // First calculate the actual coordinates of the top left corner of the view in local coords.
        float width = view.getDisplayerLocalWidth();
        float height = view.getDisplayerLocalHeight();
View Full Code Here

        // Calculate an arbitrary point on the plane (in this case, the top left corner)
        float width = view.getDisplayerLocalWidth();
        float height = view.getDisplayerLocalHeight();
        Vector3f topLeftLocal = new Vector3f(-width / 2f, height / 2f, 0f);
        Matrix4f local2World = getLocalToWorldMatrix(null);
        Vector3f topLeftWorld = local2World.mult(topLeftLocal, new Vector3f());

        // Calculate the plane normal
        Vector3f planeNormalWorld = getPlaneNormalWorld();
       
        // Now find the intersection of the ray with the plane
View Full Code Here

        Vector3f bottomRightLocal = new Vector3f(width / 2f, -height / 2f, 0f);
        logger.fine("topLeftLocal = " + topLeftLocal);
        logger.fine("topRightLocal = " + topRightLocal);
        logger.fine("bottomLeftLocal = " + bottomLeftLocal);
        logger.fine("bottomRightLocal = " + bottomRightLocal);
        Matrix4f local2World = getLocalToWorldMatrix(null); // TODO: prealloc
        Vector3f topLeftWorld = local2World.mult(topLeftLocal, new Vector3f()); // TODO:prealloc
        Vector3f topRightWorld = local2World.mult(topRightLocal, new Vector3f()); // TODO:prealloc
        Vector3f bottomLeftWorld = local2World.mult(bottomLeftLocal, new Vector3f()); // TODO:prealloc
        Vector3f bottomRightWorld = local2World.mult(bottomRightLocal, new Vector3f()); // TODO:prealloc
        logger.fine("topLeftWorld = " + topLeftWorld);
        logger.fine("topRightWorld = " + topRightWorld);
        logger.fine("bottomLeftWorld = " + bottomLeftWorld);
        logger.fine("bottomRightWorld = " + bottomRightWorld);
View Full Code Here

TOP

Related Classes of com.jme.math.Matrix4f

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.