Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Camera {
- public static float fov, aspect, near, far, x, y, z, rx, ry, rz;
- public static void init(float x, float y, float z, float rx, float ry, float rz, float fov, float aspect, float near, float far) {
- Camera.x = x;
- Camera.y = y;
- Camera.z = z;
- Camera.rx = rx;
- Camera.ry = ry;
- Camera.rz = rz;
- Camera.fov = fov;
- Camera.aspect = aspect;
- Camera.near = near;
- Camera.far = far;
- initGl(x, y, z, rx, ry, rz, fov, aspect, near, far);
- }
- public static void initGl(float x, float y, float z, float rx, float ry, float rz, float fov, float aspect, float near, float far) {
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(fov, aspect, near, far);
- glMatrixMode(GL_MODELVIEW);
- glEnable(GL_DEPTH);
- glEnable(GL_DEPTH_FUNC);
- glDepthFunc(GL_LEQUAL);
- useTraits();
- }
- public static void useTraits() {
- glPushMatrix();
- glRotatef(rx, 1, 0, 0);
- glRotatef(ry, 0, 1, 0);
- glRotatef(rz, 0, 0, 1);
- glTranslatef(x, y, z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement