<commit_before>#include "renderer.h"

Renderer::Renderer() : m_projection(1.0), m_camera(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0), glm::vec3(0, 0, 1))
{
}

Renderer::~Renderer()
{
}

void Renderer::setProjection(glm::mat4 &projection)
{
    m_projection = glm::mat4(projection) ;
}

void Renderer::setPerspective(float angle, float ratio, float near, float far)
{
    m_projection = glm::perspective(angle, ratio, near, far);
}

void Renderer::draw(Drawable const& objet, GLenum mode)
{
    GLuint shader = objet.getShader()->getProgramID() ;
    glPolygonMode(GL_FRONT_AND_BACK, mode);
    glUseProgram(shader);
        glBindVertexArray(objet.getIdVAO());
                glUniformMatrix4fv(glGetUniformLocation(shader, "projection"), 1, GL_FALSE, glm::value_ptr(m_projection));
                glUniformMatrix4fv(glGetUniformLocation(shader, "view"), 1, GL_FALSE, glm::value_ptr(m_camera.getView()));
                glUniformMatrix4fv(glGetUniformLocation(shader, "model"), 1, GL_FALSE, glm::value_ptr(objet.getModel()));
                //glBindTexture(GL_TEXTURE_2D, objet.getNomTexture());
                //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, objet.getIdIndices());
                glDrawElements(GL_TRIANGLES, objet.getIndicesNumber(), GL_UNSIGNED_INT, NULL);
            //Solution temporaire qui permet d'afficher les vertices (fonctionne).<commit_msg>modif camera<commit_after>#include "renderer.h"

Renderer::Renderer() : m_projection(1.0), m_camera(glm::vec3(10, 0, 0), glm::vec3(0, 0, 0), glm::vec3(0, 0, 1))
{
}

Renderer::~Renderer()
{
}

void Renderer::setProjection(glm::mat4 &projection)
{
    m_projection = glm::mat4(projection) ;
}

void Renderer::setPerspective(float angle, float ratio, float near, float far)
{
    m_projection = glm::perspective(angle, ratio, near, far);
}

void Renderer::draw(Drawable const& objet, GLenum mode)
{
    GLuint shader = objet.getShader()->getProgramID() ;
    glPolygonMode(GL_FRONT_AND_BACK, mode);
    glUseProgram(shader);
        glBindVertexArray(objet.getIdVAO());
                glUniformMatrix4fv(glGetUniformLocation(shader, "projection"), 1, GL_FALSE, glm::value_ptr(m_projection));
                glUniformMatrix4fv(glGetUniformLocation(shader, "view"), 1, GL_FALSE, glm::value_ptr(m_camera.getView()));
                glUniformMatrix4fv(glGetUniformLocation(shader, "model"), 1, GL_FALSE, glm::value_ptr(objet.getModel()));
                //glBindTexture(GL_TEXTURE_2D, objet.getNomTexture());
                //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, objet.getIdIndices());
                glDrawElements(GL_TRIANGLES, objet.getIndicesNumber(), GL_UNSIGNED_INT, NULL);
            //Solution temporaire qui permet d'afficher les vertices (fonctionne).
{'fraction_non_alphanumeric': 0.1414437522902162, 'fraction_numerical': 0.01832172957127153, 'mean_word_length': 4.46, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2700778', 'n_tokens_mistral': 947, 'n_tokens_neox': 924, 'n_words': 154}