/**
 * \file generate_models.cpp
 * \brief Serialize model for core/world/models.hpp
 */

#define STANDALONE 1
#include "../client/render/api/Models.hpp"
#include "../core/world/materials.hpp"
#include <meshoptimizer.h>
#include <sstream>
#include <iostream>

/// Entry point
int main(int, char *[]){
    const auto pack = [](const glm::vec3 &pos) {
    return render::PackedVertexData(meshopt_quantizeHalf(pos.x), meshopt_quantizeHalf(pos.y),
        meshopt_quantizeHalf(pos.z), world::materials::textures_map[7],
        meshopt_quantizeHalf(pos.x), meshopt_quantizeHalf(pos.y),
        meshopt_quantizeHalf(pos.z));
    };
    auto model = render::Model::Data({
        pack({1, 0, 0}), pack({0, 1, 0}), pack({0, 0, 1}),
        pack({-1, 0, 0}), pack({0, -1, 0}), pack({0, 0, -1})
    }, {
        0, 1, 2, 0, 5, 1, 0, 2, 4, 0, 4, 5,
        1, 3, 2, 5, 3, 1, 2, 3, 4, 4, 3, 5
    });

    std::ostringstream sstr;
    model.serialize(sstr);
    for (auto& el: sstr.str()) {
        std::cout << (int)el << ',';
    }
    std::cout << std::endl;
    return 0;
}