<commit_before>/*
 * Renderer.cpp
 *
 *  Created on: 2012-12-02
 *      Author: Nathan
 */

#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/quaternion.hpp>
#include "Renderer.h"
#include "Shaders/shaders.h"

Shader* shader;
glm::mat4 projection;

Renderer::Renderer(int width, int height) {
    this->height = height;
    this->width = width;
    std::cout << matrixStack.size() << std::endl;
    matrixStack.push_back(glm::mat4(1.0f));
    std::cout << matrixStack.size() << std::endl;
    loadShader("");
    useShader(0);
    uniforms.projection = setUniform("uprojection");
    uniforms.camera = setUniform("ucamera");
    uniforms.model = setUniform("umodel");
    uniforms.color = setUniform("ucolor");

    glm::mat4 projection = setProjection(width, height);
}

void Renderer::loadShader(const std::string &name){
    shader = new Shader("res/shaders/vert.glsl", "res/shaders/frag.glsl", width, height);
}

glm::vec3 Renderer::unProject(int x, int y, double z){
    glm::ivec4 viewport;
    glGetIntegerv(GL_VIEWPORT, glm::value_ptr(viewport));
    return glm::unProject(glm::vec3(x, y, z), currentMatrix(), projection, viewport);<commit_msg>Refactor renderer constructor<commit_after>/*
 * Renderer.cpp
 *
 *  Created on: 2012-12-02
 *      Author: Nathan
 */

#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/quaternion.hpp>
#include "Renderer.h"
#include "Shaders/shaders.h"

Shader* shader;
glm::mat4 projection;

Renderer::Renderer(int width, int height)
    : width(width), height(height) {

    // Load shader
    loadShader("");
    useShader(0);

    uniforms.projection = setUniform("uprojection");
    uniforms.camera = setUniform("ucamera");
    uniforms.model = setUniform("umodel");
    uniforms.color = setUniform("ucolor");

    matrixStack.push_back(glm::mat4(1.0f));
    setProjection(width, height);
    setCamera(0, 0, 0);
}

void Renderer::loadShader(const std::string &name){
    shader = new Shader("res/shaders/vert.glsl", "res/shaders/frag.glsl", width, height);
}

glm::vec3 Renderer::unProject(int x, int y, double z){
    glm::ivec4 viewport;
    glGetIntegerv(GL_VIEWPORT, glm::value_ptr(viewport));
    return glm::unProject(glm::vec3(x, y, z), currentMatrix(), projection, viewport);
{'fraction_non_alphanumeric': 0.1658868566567418, 'fraction_numerical': 0.015312632922160783, 'mean_word_length': 4.613365155131265, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, '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': '5266119', 'n_tokens_mistral': 872, 'n_tokens_neox': 848, 'n_words': 156}