<commit_before>package com.jacudibu;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.math.Vector3;

/**
 * Created by <NAME> (Jacudibu) on 11.05.2017.
 */
public class MainCamera {
    public static MainCamera instance;

    private PerspectiveCamera cam;
    public Vector3 camRightVector = new Vector3();

    private MainCamera() {
        cam = new PerspectiveCamera(67, Core.windowWidth, Core.windowHeight);
        cam.position.set(0f,0f,10f);
        cam.near = 1f;
        cam.far = 300f;
    }

    public static MainCamera initialize() {
        if (instance != null) {
            return instance;
        }

        instance = new MainCamera();
        return instance;
    }

    public static Camera getCamera() {
        if (instance != null) {
            return instance.cam;
        } else {
            return initialize().cam;
        }

    }

    public void update(float deltaTime) {
        float moveSpeed = 10f;

        // Move
        float forward = 0f;
        float right = 0f;
        if (Gdx.input.isKeyPressed(Input.Keys.W)) {
            forward += moveSpeed * deltaTime;
        }
        if (Gdx.input.isKeyPressed(Input.Keys.S)) {
            forward -= moveSpeed * deltaTime;
        }
        if (Gdx.input.isKeyPressed(Input.Keys.D)) {
            right += moveSpeed * deltaTime;
        }
        if (Gdx.input.isKeyPressed(Input.Keys.A)) {
            right -= moveSpeed * deltaTime;
        }

        if (Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT)) {
            forward *= 10f;
            right *= 10f;
        }

        zoom(forward);

        Vector3 camRightVector = new Vector3().set(cam.direction).crs(cam.up).nor();
        cam.position.add(camRightVector.x * right, camRightVector.y * right, camRightVector.z * right);
        cam.update();
    }

    public void dragRotation(float xRot, float yRot) {
        camRightVector.set(cam.direction).crs(cam.up).nor();
        cam.rotate(camRightVector, InputManager.invertY ? -yRot : yRot);
        cam.rotate(Vector3.Y, InputManager.invertX ? -xRot : xRot);
        cam.update();
    }

    public void zoom(float distance) {
        cam.position.add(cam.direction.x * distance, cam.direction.y * distance, cam.direction.z * distance);
    }
}<commit_msg>Improved Camera controls, Q/E now moves camera up/down.<commit_after>package com.jacudibu;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.math.Vector3;

/**
 * Created by <NAME> (Jacudibu) on 11.05.2017.
 */
public class MainCamera {
    public static MainCamera instance;

    private PerspectiveCamera cam;
    public Vector3 camRightVector = new Vector3();

    private MainCamera() {
        cam = new PerspectiveCamera(67, Core.windowWidth, Core.windowHeight);
        cam.position.set(0f,0f,10f);
        cam.near = 1f;
        cam.far = 300f;
    }

    public static MainCamera initialize() {
        if (instance != null) {
            return instance;
        }

        instance = new MainCamera();
        return instance;
    }

    public static Camera getCamera() {
        if (instance != null) {
            return instance.cam;
        } else {
            return initialize().cam;
        }

    }

    public void update(float deltaTime) {

        Vector3 movement = processMovementInput(deltaTime);

        Vector3 camRightVector = new Vector3().set(cam.direction).crs(cam.up).nor();
        cam.position.add(camRightVector.x * movement.x, camRightVector.y * movement.x, camRightVector.z * movement.x);
        cam.position.add(cam.up.x * movement.y, cam.up.y * movement.y, cam.up.z * movement.y);
        zoom(movement.z);

        cam.update();
    }

    private Vector3 processMovementInput(float deltaTime) {
        float moveSpeed = 10f;

        Vector3 movement = new Vector3();

        // Forward
        if (Gdx.input.isKeyPressed(Input.Keys.W) || Gdx.input.isKeyPressed(Input.Keys.UP)) {
            movement.z += moveSpeed * deltaTime;
        }
        if (Gdx.input.isKeyPressed(Input.Keys.S) || Gdx.input.isKeyPressed(Input.Keys.DOWN)) {
            movement.z -= moveSpeed * deltaTime;
        }

        // Right
        if (Gdx.input.isKeyPressed(Input.Keys.D) || Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
            movement.x += moveSpeed * deltaTime;
        }
        if (Gdx.input.isKeyPressed(Input.Keys.A) || Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
            movement.x -= moveSpeed * deltaTime;
        }

        // Up
        if (Gdx.input.isKeyPressed(Input.Keys.Q) || Gdx.input.isKeyPressed(Input.Keys.PAGE_UP)) {
            movement.y += moveSpeed * deltaTime;
        }
        if (Gdx.input.isKeyPressed(Input.Keys.E) || Gdx.input.isKeyPressed(Input.Keys.PAGE_DOWN)) {
            movement.y -= moveSpeed * deltaTime;
        }

        if (Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT)) {
            movement.x *= 10f;
            movement.y *= 10f;
            movement.z *= 10f;
        }

        return movement;
    }

    public void dragRotation(float xRot, float yRot) {
        camRightVector.set(cam.direction).crs(cam.up).nor();
        cam.rotate(camRightVector, InputManager.invertY ? -yRot : yRot);
        cam.rotate(Vector3.Y, InputManager.invertX ? -xRot : xRot);
        cam.update();
    }

    public void zoom(float distance) {
        cam.position.add(cam.direction.x * distance, cam.direction.y * distance, cam.direction.z * distance);
    }
}
{'fraction_non_alphanumeric': 0.12411598302687411, 'fraction_numerical': 0.012022630834512023, 'mean_word_length': 2.21969265793967, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7375101', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1766, 'n_words': 338}