<commit_before>#ifndef GLM_FORCE_RADIANS
#define GLM_FORCE_RADIANS
#define DEGREES_TO_RADIANS(x) (x * PI / 180.0f)
#endif

#ifndef RADIANS_TO_DEGREES
#define RADIANS_TO_DEGREES(x) (x * 180.0f / PI)
#endif

#include "cpp/ylikuutio/common/globals.hpp"
#include "cpp/ylikuutio/common/any_value.hpp"
#include "cpp/ylikuutio/callback/callback_engine.hpp"
#include "cpp/ylikuutio/callback/callback_object.hpp"
#include "cpp/ylikuutio/callback/callback_parameter.hpp"
#include "cpp/ylikuutio/model/shader_loader.hpp"
#include "cpp/ylikuutio/model/texture_loader.hpp"
#include "cpp/ylikuutio/model/vboindexer.hpp"
#include "cpp/ylikuutio/model/text2D.hpp"
#include "cpp/ylikuutio/model/text3D.hpp"
#include "cpp/ylikuutio/model/world.hpp"
#include "cpp/ylikuutio/model/shader.hpp"
#include "cpp/ylikuutio/model/material.hpp"
#include "cpp/ylikuutio/model/font.hpp"
#include "cpp/ylikuutio/model/glyph.hpp"
#include "cpp/ylikuutio/model/species.hpp"
#include "cpp/ylikuutio/model/object.hpp"

// Include GLEW
#ifndef __GL_GLEW_H_INCLUDED
#define __GL_GLEW_H_INCLUDED
#include <GL/glew.h> // GLfloat, GLuint etc.
#endif

// Include GLFW
#ifndef __GLFW3_H_INCLUDED
#define __GLFW3_H_INCLUDED
#include <glfw3.h>
#endif

GLFWwindow* window;

// Include GLM
#ifndef __GLM_GLM_HPP_INCLUDED
#define __GLM_GLM_HPP_INCLUDED
#include <glm/glm.hpp> // glm
#endif

// Include standard headers
#include <cstdio>   // std::FILE, std::fclose, std::fopen, std::fread, std::getchar, std::printf etc.
#include <iostream> // std::cout, std::cin, std::cerr
#include <string>   // std::string
#include <vector>   // std::vector
#include <stdint.h> // uint32_t etc.

// #define TESTING_SPHERICAL_WORLD_IN_USE

// model file format: obj/bmp/...
// std::string g_model_file_format = "bmp";
std::string g_model_file_format = "bmp";

// model filename.
// std::string g_model_filename = "cube.obj";
// std::string g_model_filename = "oma_icosphere.obj";
// std::string g_model_filename = "kirjainkuutio.obj";
// std::string g_model_filename = "noise1024x1024.bmp";
std::string g_model_filename = "noise256x256.bmp";
// std::string g_model_filename = "noise128x128.bmp";

// texture file format: bmp/...
std::string g_texture_file_format = "bmp";

// color channel to use for height data.
// std::string g_height_data_color_channel = "red";
// std::string g_height_data_color_channel = "green";
// std::string g_height_data_color_channel = "blue";
std::string g_height_data_color_channel = "mean"; // "all" is equivalent to "mean".

// texture filename.
// std::string_g_texture_filename = "kuutio-uv-numerot.bmp";
// std::string g_texture_filename = "punamusta.bmp";
std::string g_texture_filename = "GrassGreenTexture0002.bmp";

// font texture file format: bmp/...
std::string g_font_texture_file_format = "bmp";

// font texture filename.
// std::string g_font_texture_filename = "Holstein.DDS";
std::string g_font_texture_filename = "Holstein.bmp";

std::string g_font_file_format = "svg";
std::string g_font_filename = "kongtext.svg";

void full_cleanup(AnyValue any_value)
{
    std::cout << "Cleaning up.\n";

    if (any_value.type == datatypes::WORLD_POINTER)
    {
        delete static_cast<model::World*>(any_value.void_pointer);
    }
    else
    {
        std::cerr << "Invalid datatype for full_cleanup!\n";
    }

    // Delete the text's VBO, the shader and the texture
    text2D::cleanupText2D();

    // Close OpenGL window and terminate GLFW
    glfwTerminate();
}

int main(void)
{
    // Initial position : on +Z
    // position = glm::vec3(100, 100, 100);
    // position = glm::vec3(100, 3900, 100);
    // position = glm::vec3(100.0f, 5000.0f, 100.0f);
#ifdef TESTING_SPHERICAL_WORLD_IN_USE
    // position = glm::vec3(100.0f, 5000.0f + EARTH_RADIUS, 100.0f);
    // position = glm::vec3(100.0f, 5000.0f, 100.0f);
    // position = glm::vec3(-5658223.00f, -1700825.12f, 2322764.00f);
    position = glm::vec3(-5659377.50f, -1696985.38f, 2358353.25f);
#else
    position = glm::vec3(100.0f, 100.0f, 100.0f);
#endif
    // Initial horizontal angle : toward -Z
    // horizontalAngle = 0.0f;
    horizontalAngle = 42.42f;
    // Initial vertical angle : none
    // verticalAngle = PI / 2;
    verticalAngle = 7.44f;
    // Initial Field of View
    // initialFoV = 45.0f;
    initialFoV = 60.0f;

    callback_system::CallbackEngine* callback_engine = new callback_system::CallbackEngine();
    AnyValueToVoidCallback cleanup_callback = nullptr;

    bool does_suzanne_species_exist = true;
    bool does_suzanne_species_have_uvmap_texture = true;
    bool has_suzanne_2_transformed_into_terrain = false;

    // Initialise GLFW
    if (!glfwInit())
    {
        std::cerr << "Failed to initialize GLFW.\n";
        return -1;
    }

    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);

    // Open a window and create its OpenGL context.<commit_msg>`callback_system::CallbackObject*` is created (but not yet used).<commit_after>#ifndef GLM_FORCE_RADIANS
#define GLM_FORCE_RADIANS
#define DEGREES_TO_RADIANS(x) (x * PI / 180.0f)
#endif

#ifndef RADIANS_TO_DEGREES
#define RADIANS_TO_DEGREES(x) (x * 180.0f / PI)
#endif

#include "cpp/ylikuutio/common/globals.hpp"
#include "cpp/ylikuutio/common/any_value.hpp"
#include "cpp/ylikuutio/callback/callback_engine.hpp"
#include "cpp/ylikuutio/callback/callback_object.hpp"
#include "cpp/ylikuutio/callback/callback_parameter.hpp"
#include "cpp/ylikuutio/model/shader_loader.hpp"
#include "cpp/ylikuutio/model/texture_loader.hpp"
#include "cpp/ylikuutio/model/vboindexer.hpp"
#include "cpp/ylikuutio/model/text2D.hpp"
#include "cpp/ylikuutio/model/text3D.hpp"
#include "cpp/ylikuutio/model/world.hpp"
#include "cpp/ylikuutio/model/shader.hpp"
#include "cpp/ylikuutio/model/material.hpp"
#include "cpp/ylikuutio/model/font.hpp"
#include "cpp/ylikuutio/model/glyph.hpp"
#include "cpp/ylikuutio/model/species.hpp"
#include "cpp/ylikuutio/model/object.hpp"

// Include GLEW
#ifndef __GL_GLEW_H_INCLUDED
#define __GL_GLEW_H_INCLUDED
#include <GL/glew.h> // GLfloat, GLuint etc.
#endif

// Include GLFW
#ifndef __GLFW3_H_INCLUDED
#define __GLFW3_H_INCLUDED
#include <glfw3.h>
#endif

GLFWwindow* window;

// Include GLM
#ifndef __GLM_GLM_HPP_INCLUDED
#define __GLM_GLM_HPP_INCLUDED
#include <glm/glm.hpp> // glm
#endif

// Include standard headers
#include <cstdio>   // std::FILE, std::fclose, std::fopen, std::fread, std::getchar, std::printf etc.
#include <iostream> // std::cout, std::cin, std::cerr
#include <string>   // std::string
#include <vector>   // std::vector
#include <stdint.h> // uint32_t etc.

// #define TESTING_SPHERICAL_WORLD_IN_USE

// model file format: obj/bmp/...
// std::string g_model_file_format = "bmp";
std::string g_model_file_format = "bmp";

// model filename.
// std::string g_model_filename = "cube.obj";
// std::string g_model_filename = "oma_icosphere.obj";
// std::string g_model_filename = "kirjainkuutio.obj";
// std::string g_model_filename = "noise1024x1024.bmp";
std::string g_model_filename = "noise256x256.bmp";
// std::string g_model_filename = "noise128x128.bmp";

// texture file format: bmp/...
std::string g_texture_file_format = "bmp";

// color channel to use for height data.
// std::string g_height_data_color_channel = "red";
// std::string g_height_data_color_channel = "green";
// std::string g_height_data_color_channel = "blue";
std::string g_height_data_color_channel = "mean"; // "all" is equivalent to "mean".

// texture filename.
// std::string_g_texture_filename = "kuutio-uv-numerot.bmp";
// std::string g_texture_filename = "punamusta.bmp";
std::string g_texture_filename = "GrassGreenTexture0002.bmp";

// font texture file format: bmp/...
std::string g_font_texture_file_format = "bmp";

// font texture filename.
// std::string g_font_texture_filename = "Holstein.DDS";
std::string g_font_texture_filename = "Holstein.bmp";

std::string g_font_file_format = "svg";
std::string g_font_filename = "kongtext.svg";

void full_cleanup(AnyValue any_value)
{
    std::cout << "Cleaning up.\n";

    if (any_value.type == datatypes::WORLD_POINTER)
    {
        delete static_cast<model::World*>(any_value.void_pointer);
    }
    else
    {
        std::cerr << "Invalid datatype for full_cleanup!\n";
    }

    // Delete the text's VBO, the shader and the texture
    text2D::cleanupText2D();

    // Close OpenGL window and terminate GLFW
    glfwTerminate();
}

int main(void)
{
    // Initial position : on +Z
    // position = glm::vec3(100, 100, 100);
    // position = glm::vec3(100, 3900, 100);
    // position = glm::vec3(100.0f, 5000.0f, 100.0f);
#ifdef TESTING_SPHERICAL_WORLD_IN_USE
    // position = glm::vec3(100.0f, 5000.0f + EARTH_RADIUS, 100.0f);
    // position = glm::vec3(100.0f, 5000.0f, 100.0f);
    // position = glm::vec3(-5658223.00f, -1700825.12f, 2322764.00f);
    position = glm::vec3(-5659377.50f, -1696985.38f, 2358353.25f);
#else
    position = glm::vec3(100.0f, 100.0f, 100.0f);
#endif
    // Initial horizontal angle : toward -Z
    // horizontalAngle = 0.0f;
    horizontalAngle = 42.42f;
    // Initial vertical angle : none
    // verticalAngle = PI / 2;
    verticalAngle = 7.44f;
    // Initial Field of View
    // initialFoV = 45.0f;
    initialFoV = 60.0f;

    callback_system::CallbackEngine* callback_engine = new callback_system::CallbackEngine();
    callback_system::CallbackObject* callback_object = new callback_system::CallbackObject(callback_engine);
    AnyValueToVoidCallback cleanup_callback = nullptr;

    bool does_suzanne_species_exist = true;
    bool does_suzanne_species_have_uvmap_texture = true;
    bool has_suzanne_2_transformed_into_terrain = false;

    // Initialise GLFW
    if (!glfwInit())
    {
        std::cerr << "Failed to initialize GLFW.\n";
        return -1;
    }

    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);

    // Open a window and create its OpenGL context.
{'fraction_non_alphanumeric': 0.14086053708695218, 'fraction_numerical': 0.03873415194169911, 'mean_word_length': 4.2643194955333685, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 21, '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': '2842613', 'n_tokens_mistral': 4071, 'n_tokens_neox': 3779, 'n_words': 713}