Commit 0e16e9cb authored by Justine Martin's avatar Justine Martin 💖
Browse files

feat : Ajoute de l'espace de jeu

parent 8d3bc6a1
Loading
Loading
Loading
Loading
+2 −0
Changes for include/GlApplication.hpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#define WIN_PLAYER_2 2
#define WIN_DRAW 3

#define SKYBOX_SIZE 400

class RenderObject;

class GlApplication : public Application {
+1136 −9097

File changed.

Preview size limit exceeded, changes collapsed.

+4 −4
Changes for src/GlApplication.cpp: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -87,8 +87,8 @@ void GlApplication::createEntities() {
    m_entities[ModelKeys::SPACESHIP_1].push_back(m_spaceshipPlayer1);
    m_entities[ModelKeys::SPACESHIP_2].push_back(m_spaceshipPlayer2);

    for(int i = 0 ; i < 150 ; i++) {
        glm::vec3 position = {rand() % 80 - 45, rand() % 80 - 45, rand() % 80 - 45};
    for(int i = 0 ; i < 600 ; i++) {
        glm::vec3 position = {rand() % (SKYBOX_SIZE - 20) - ((SKYBOX_SIZE - 20)/2), rand() % (SKYBOX_SIZE - 20) - ((SKYBOX_SIZE - 20)/2), rand() % (SKYBOX_SIZE - 20) - ((SKYBOX_SIZE - 20)/2)};
        if(position.x >= -10 && position.x <= 10 && position.y >= -10 && position.y <= 10 && position.z >= -10 && position.z <= 10) {
            i--;
            continue;
@@ -112,7 +112,7 @@ void GlApplication::createEntities() {
    m_entities[ModelKeys::TRON].push_back(tronEntity);*/
    
    std::shared_ptr<Entity> skybox(new Entity());
    skybox->setScale(45.0f);
    skybox->setScale(SKYBOX_SIZE / 2);
    m_entities[ModelKeys::SKYBOX].push_back(skybox);
}

@@ -437,7 +437,7 @@ void GlApplication::resize(GLFWwindow * window, int framebufferWidth, int frameb
    GlApplication & app = *static_cast<GlApplication *>(glfwGetWindowUserPointer(window));

    float aspect = framebufferWidth / float(framebufferHeight);
    app.m_proj = glm::perspective(80.f, aspect, 0.1f, 100.f);
    app.m_proj = glm::perspective(80.f, aspect, 0.1f, (float)(SKYBOX_SIZE + 100));

    glViewport(0, 0, framebufferWidth, framebufferHeight);