Package org.lwjgl.util.vector

Examples of org.lwjgl.util.vector.Vector3f.normalise()


    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);
    glEnable(GL_DEPTH_TEST);

    final Vector3f lp = new Vector3f(5.0f, 5.0f, 10.0f);
    lp.normalise();
    glLight(GL_LIGHT0, GL_POSITION, lp.getX(), lp.getY(), lp.getZ(), 0.0f);

    /* make the gears */
    gear1 = new Gear(gear(1.0f, 4.0f, 1.0f, 20, 0.7f), new float[] { 0.8f, 0.1f, 0.0f, 1.0f });
    gear2 = new Gear(gear(0.5f, 2.0f, 2.0f, 10, 0.7f), new float[] { 0.0f, 0.8f, 0.2f, 1.0f });
View Full Code Here


    this.fieldOfView = Math.max(10, Math.min(100, fov));
  }
 
  public void lookAt(float x, float y, float z){
    Vector3f forward = new Vector3f(x-this.position.x, y-this.position.y, z-this.position.z);
    forward.normalise();

    this.rotation.x = (float) Math.toDegrees(Math.asin(-forward.y));
    this.rotation.y = (float) Math.toDegrees(Math.PI/2+Math.atan2(forward.z, forward.x));
  }
}
View Full Code Here

        public void generateViewMatrix() {
            Vector3f u = new Vector3f(), v = new Vector3f(), w = new Vector3f();
            //Calculating w
            Vector3f.sub(cameraPos, target, w);
            w.normalise();
            //Calculating u
            Vector3f.cross(up, w, u);
            u.normalise();
            //Calculating v
            Vector3f.cross(w, u, v);
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.