Package br.com.lbbento.glapp.model

Examples of br.com.lbbento.glapp.model.GL_Vector


    }
    if (dirx == 0 && diry == 0 && dirz == 0) {
      System.out.println("GLCamera.setCamera(): ViewDirection vector needs to be defined");
      dirx=0; diry=0; dirz=-1;
    }
    Position   = new GL_Vector(posx, posy, posz);
    ViewDir   = new GL_Vector(dirx, diry, dirz);
    UpVector   = new GL_Vector(upx, upy, upz);
    RightVector  = GL_Vector.crossProduct(ViewDir, UpVector);
    RotatedX = RotatedY = RotatedZ = 0.0f// TO DO: should set these to correct values
  }
View Full Code Here


   * @param targetZ
   * @param distance    distance from target
   */
  public void setCamera(float targetX, float targetY, float targetZ,  float distance)
  {
    Position   = new GL_Vector(targetX, targetY, targetZ+distance);
    ViewDir   = new GL_Vector(0, 0, -1);
    UpVector   = new GL_Vector(0, 1, 0);
    RightVector  = GL_Vector.crossProduct(ViewDir, UpVector);
    RotatedX = RotatedY = RotatedZ = 0.0f;
  }
View Full Code Here

 
  /**
   * Move camera position in the given direction
   */
  public void Move(float x, float y, float z) {
    GL_Vector Direction = new GL_Vector(x,y,z);
    Position = GL_Vector.add(Position, Direction);
  }
View Full Code Here

 
  /**
   * Move camera to the given xyz
   */
  public void MoveTo(float x, float y, float z) {
    Position = new GL_Vector(x, y, z);
  }
View Full Code Here

   */
  public void RotateV(float Angle) {
    // Make a matrix to rotate the given number of degrees around Y axis
    GL_Matrix M = GL_Matrix.rotateMatrix(0,(float)Math.toRadians(Angle),0);
    // rotate the view vector
    GL_Vector vd = M.transform(ViewDir);
    // the up vector is perpendicular to the old view and the new view
    UpVector = (Angle > 0)? GL_Vector.crossProduct(ViewDir,vd) : GL_Vector.crossProduct(vd,ViewDir);
    // the right vector is perpendicular to the new view and Up vectors
    RightVector = GL_Vector.crossProduct(vd,UpVector);
    // set the view direction
View Full Code Here

   * sure that the modelview matrix is current before calling Render()
   * (glMatrixMode(GL_MODEL_VIEW)).
   */
  public void Render() {
    //The point at which the camera looks:
    GL_Vector ViewPoint = GL_Vector.add(Position, ViewDir);
   
    //as we know the up vector, we can easily use gluLookAt:
    GLU.gluLookAt(Position.x, Position.y, Position.z,
        ViewPoint.x, ViewPoint.y, ViewPoint.z,
        UpVector.x, UpVector.y, UpVector.z);
View Full Code Here

TOP

Related Classes of br.com.lbbento.glapp.model.GL_Vector

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.