Package org.lwjgl.util.vector

Examples of org.lwjgl.util.vector.Matrix4f.translate()


        lightProjection.flip();
        lightModelView.flip();

        Matrix4f tempMatrix = new Matrix4f();
        tempMatrix.setIdentity();
        tempMatrix.translate(new Vector3f(0.5F, 0.5F, 0.5F));
        tempMatrix.scale(new Vector3f(0.5F, 0.5F, 0.5F));
        Matrix4f.mul(tempMatrix, lightProjectionTemp, textureMatrix);
        Matrix4f.mul(textureMatrix, lightModelViewTemp, tempMatrix);
        Matrix4f.transpose(tempMatrix, textureMatrix);
    }
View Full Code Here


  }

  public static void glTranslatef(final float x, final float y, final float z) {
    final Matrix4f m = getCurrentMatrix();
    v3f.set(x, y, z);
    m.translate(v3f);
  }

  public static void glRotatef(final float angle, final float x, final float y, final float z) {
    final Matrix4f m = getCurrentMatrix();
    v3f.set(x, y, z);
View Full Code Here

  }

  public static Matrix4f getTransformation() {
    Matrix4f matrix = new Matrix4f();

    matrix.translate(new Vector3f(-position.x, -position.y, -position.z));

    // convert angles from degrees to radians
    matrix.rotate((float) ((-rotX) * Math.PI / 180.0), new Vector3f(1.0f, 0.0f, 0.0f));
    matrix.rotate((float) ((-rotY) * Math.PI / 180.0), new Vector3f(0.0f, 1.0f, 0.0f));
    matrix.rotate((float) ((-rotZ) * Math.PI / 180.0), new Vector3f(0.0f, 0.0f, 1.0f));
View Full Code Here

  /**
   * Calculates Z-position in eye coordinates. Call getZDepth to get result.
   */
  public void updateZDepth() {
    Matrix4f transformation = Camera.getTransformation();
    transformation.translate(getPosition());

    zDepth = transformation.m32;
  }

  /**
 
View Full Code Here

    Matrix4f.mul(camera, orientation(), camera);
   
    Vector3f negPosition = new Vector3f();
    position.negate(negPosition);
   
    camera.translate(negPosition);
   
    return camera;
   
  }
 
View Full Code Here

 
  public Matrix4f getModelMatrix() {
    Matrix4f mat4 = new Matrix4f();
    mat4.setIdentity();
   
    mat4.translate(new Vector3f(this.position.x,this.position.y,this.position.z));
    mat4.scale(new Vector3f(this.scale.x,this.scale.y,this.scale.z));
    mat4.rotate((float)Math.toRadians(this.rotation.x), new Vector3f(1.0f, 0.0f, 0.0f));
    mat4.rotate((float)Math.toRadians(this.rotation.y), new Vector3f(0.0f, 1.0f, 0.0f));
    mat4.rotate((float)Math.toRadians(this.rotation.z), new Vector3f(0.0f, 0.0f, 1.0f));
   
View Full Code Here

    if (zoom != 1f) {
      view.scale(new Vector3f(zoom, zoom, 1f));
    }
   
    //pan the camera by translating the view matrix
    view.translate(new Vector2f(panX, panY));
   
    //after translation, we can rotate...
    if (rot!=0f) {
      //we want to rotate by a center origin point, so first we translate
      view.translate(new Vector2f(Display.getWidth()/2, Display.getHeight()/2));
View Full Code Here

    view.translate(new Vector2f(panX, panY));
   
    //after translation, we can rotate...
    if (rot!=0f) {
      //we want to rotate by a center origin point, so first we translate
      view.translate(new Vector2f(Display.getWidth()/2, Display.getHeight()/2));
     
      //then we rotate
      view.rotate(rot, new Vector3f(0, 0, 1));
     
      //then we translate back
View Full Code Here

     
      //then we rotate
      view.rotate(rot, new Vector3f(0, 0, 1));
     
      //then we translate back
      view.translate(new Vector2f(-Display.getWidth()/2, -Display.getHeight()/2));
    }
   
    //apply other transformations here...
   
   
View Full Code Here

 
  public Matrix4f getModelMatrix() {
    Matrix4f mat4 = new Matrix4f();
    mat4.setIdentity();
   
    mat4.translate(new Vector3f(0,0,0));
    mat4.scale(new Vector3f(1,1,1));
   
    return mat4;
  }
 
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.