<commit_before>#include "Game.hpp"
#include <algorithm>
#include "../Window/GlfwError.hpp"
#include "../Util/WarnGuard.hpp"
WARN_GUARD_ON
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "../Graphics/Image/ImageLoader.hpp"
#include "../Graphics/Model/ModelLoader.hpp"
WARN_GUARD_OFF
#include "../Util/FileLoad.hpp"

///==============================================================
///= Game
///==============================================================
// BufferType for the files loaded
using BufferType = std::vector<std::uint8_t>;

Game::Game()
{
}

void Game::Init()
{
    // Setup window and input
    SetupWindow();

    // Cube rotation state
    mRotationData.degreesInc = 0.05f;
    mRotationData.rotating = false;

    // Camera initial position
    mCamera.SetPos(glm::vec3(0, 0, 8));

    // Load the textures
    LoadTextures();

    // Load the models
    LoadModels();

    // Load the shaders
    LoadShaders();

    // Create world objects
    SetupWorld();

    // Initialize the renderer
    renderer.Init(
        mWindow.GetWidth(),
        mWindow.GetHeight(),
        mShaderPrograms.at("geometry_pass").Id(),
        mShaderPrograms.at("light_pass").Id()
    );

    // Pass the current scene to renderer
    renderer.SetScene(&mScene);

    // Load the skybox
    mSkybox = std::make_unique<Skybox>();
    ImageLoader imLoader;
    mSkybox->Load(
        {
            { Skybox::Target::Right,  imLoader.LoadFile("ext/Skybox/right.jpg")  },
            { Skybox::Target::Left,   imLoader.LoadFile("ext/Skybox/left.jpg")   },
            { Skybox::Target::Top,    imLoader.LoadFile("ext/Skybox/top.jpg")    },
            { Skybox::Target::Bottom, imLoader.LoadFile("ext/Skybox/bottom.jpg") },
            { Skybox::Target::Back,   imLoader.LoadFile("ext/Skybox/back.jpg")   },
            { Skybox::Target::Front,  imLoader.LoadFile("ext/Skybox/front.jpg")  }
        }
    );
    renderer.SetSkybox(mSkybox.get());
}

void Game::SetupWorld()
{
    auto& scene = mScene;

    //
    // Normal objects
    //
    // Create various Cube instances in the world
    std::vector<glm::vec3> cubePositions = {
        glm::vec3(0.0f, 0.0f, 0.0f),
        glm::vec3(4.0f, 10.0f, -20.0f),
        glm::vec3(-3.0f, -4.4f, -5.0f),
        glm::vec3(-7.6f, -4.0f, -14.0f),
        glm::vec3(4.4f, -3.5f, -4.0f),
        glm::vec3(-3.4f, 6.0f, -15.0f),
        glm::vec3(2.6f, -4.0f, -17.0f),
        glm::vec3(4.0f, 3.0f, -5.0f),
        glm::vec3(3.0f, 0.4f, -12.0f),
        glm::vec3(-3.5f, 2.0f, -3.0f)
    };
    for (std::size_t i = 0; i < cubePositions.size(); ++i)
    {
        const auto& pos = cubePositions[i];

        const std::string name = "cube" + std::to_string(i);
        const auto& initAABB = renderer.GetModelStore()["cube"]->localAABB;
        scene.CreateNode("cube", name, SceneNodeCategory::Normal, initAABB);
        scene.Move(name, pos);
        scene.Scale(name, glm::vec3(2.0f));
        scene.Rotate(name, RotationAxis::X, 20.0f * i);
        scene.Rotate(name, RotationAxis::Y, 7.0f * i);
        scene.Rotate(name, RotationAxis::Z, 10.0f * i);
    }

    // Add house
    {
        const auto& initAABB = renderer.GetModelStore()["house"]->localAABB;
        scene.CreateNode("house", "house", SceneNodeCategory::Normal, initAABB);
        scene.Move("house", glm::vec3(0.0f, -10.0f, -40.0f));
        scene.Scale("house", glm::vec3(0.3f));
    }

    // Add well
    {
        const auto& initAABB = renderer.GetModelStore()["well"]->localAABB;
        scene.CreateNode("well", "well", SceneNodeCategory::Normal, initAABB);
        scene.Move("well", glm::vec3(0.0f, -5.0f, -10.0f));
        scene.Scale("well", glm::vec3(2.0f));
    }
<commit_msg>Added bottom plane<commit_after>#include "Game.hpp"
#include <algorithm>
#include "../Window/GlfwError.hpp"
#include "../Util/WarnGuard.hpp"
WARN_GUARD_ON
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "../Graphics/Image/ImageLoader.hpp"
#include "../Graphics/Model/ModelLoader.hpp"
WARN_GUARD_OFF
#include "../Util/FileLoad.hpp"

///==============================================================
///= Game
///==============================================================
// BufferType for the files loaded
using BufferType = std::vector<std::uint8_t>;

Game::Game()
{
}

void Game::Init()
{
    // Setup window and input
    SetupWindow();

    // Cube rotation state
    mRotationData.degreesInc = 0.05f;
    mRotationData.rotating = false;

    // Camera initial position
    mCamera.SetPos(glm::vec3(0, 0, 8));

    // Load the textures
    LoadTextures();

    // Load the models
    LoadModels();

    // Load the shaders
    LoadShaders();

    // Create world objects
    SetupWorld();

    // Initialize the renderer
    renderer.Init(
        mWindow.GetWidth(),
        mWindow.GetHeight(),
        mShaderPrograms.at("geometry_pass").Id(),
        mShaderPrograms.at("light_pass").Id()
    );

    // Pass the current scene to renderer
    renderer.SetScene(&mScene);

    // Load the skybox
    mSkybox = std::make_unique<Skybox>();
    ImageLoader imLoader;
    mSkybox->Load(
        {
            { Skybox::Target::Right,  imLoader.LoadFile("ext/Skybox/right.jpg")  },
            { Skybox::Target::Left,   imLoader.LoadFile("ext/Skybox/left.jpg")   },
            { Skybox::Target::Top,    imLoader.LoadFile("ext/Skybox/top.jpg")    },
            { Skybox::Target::Bottom, imLoader.LoadFile("ext/Skybox/bottom.jpg") },
            { Skybox::Target::Back,   imLoader.LoadFile("ext/Skybox/back.jpg")   },
            { Skybox::Target::Front,  imLoader.LoadFile("ext/Skybox/front.jpg")  }
        }
    );
    renderer.SetSkybox(mSkybox.get());
}

void Game::SetupWorld()
{
    auto& scene = mScene;

    //
    // Normal objects
    //
    // Create various Cube instances in the world
    std::vector<glm::vec3> cubePositions = {
        glm::vec3(0.0f, 0.0f, 0.0f),
        glm::vec3(4.0f, 10.0f, -20.0f),
        glm::vec3(-3.0f, -4.4f, -5.0f),
        glm::vec3(-7.6f, -4.0f, -14.0f),
        glm::vec3(4.4f, -3.5f, -4.0f),
        glm::vec3(-3.4f, 6.0f, -15.0f),
        glm::vec3(2.6f, -4.0f, -17.0f),
        glm::vec3(4.0f, 3.0f, -5.0f),
        glm::vec3(3.0f, 0.4f, -12.0f),
        glm::vec3(-3.5f, 2.0f, -3.0f)
    };
    for (std::size_t i = 0; i < cubePositions.size(); ++i)
    {
        const auto& pos = cubePositions[i];

        const std::string name = "cube" + std::to_string(i);
        const auto& initAABB = renderer.GetModelStore()["cube"]->localAABB;
        scene.CreateNode("cube", name, SceneNodeCategory::Normal, initAABB);
        scene.Move(name, pos);
        scene.Scale(name, glm::vec3(2.0f));
        scene.Rotate(name, RotationAxis::X, 20.0f * i);
        scene.Rotate(name, RotationAxis::Y, 7.0f * i);
        scene.Rotate(name, RotationAxis::Z, 10.0f * i);
    }

    // Add house
    {
        const auto& initAABB = renderer.GetModelStore()["house"]->localAABB;
        scene.CreateNode("house", "house", SceneNodeCategory::Normal, initAABB);
        scene.Move("house", glm::vec3(0.0f, -10.0f, -40.0f));
        scene.Scale("house", glm::vec3(0.3f));
    }

    // Add well
    {
        const auto& initAABB = renderer.GetModelStore()["well"]->localAABB;
        scene.CreateNode("well", "well", SceneNodeCategory::Normal, initAABB);
        scene.Move("well", glm::vec3(0.0f, -5.0f, -10.0f));
        scene.Scale("well", glm::vec3(2.0f));
    }

    // Add bottom plane
    {
        const auto& initAABB = renderer.GetModelStore()["cube"]->localAABB;
        scene.CreateNode("cube", "plane", SceneNodeCategory::Normal, initAABB);
        scene.Move("plane", glm::vec3(0.0f, -11.0f, 0.0f));
        scene.Scale("plane", glm::vec3(150.0f, 0.1f, 150.0f));
    }

{'fraction_non_alphanumeric': 0.20918564260903127, 'fraction_numerical': 0.03332046828766242, 'mean_word_length': 2.6514795678722405, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 24, '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': '2710657', 'n_tokens_mistral': 2951, 'n_tokens_neox': 2793, 'n_words': 461}