Files

24 lines
1.0 KiB
C++

// Fix both COLLADA and glTF bugs
#include "vde/brep/brep.h"
#include "vde/brep/modeling.h"
#include "vde/foundation/io_collada.h"
#include "vde/foundation/io_gltf.h"
#include <iostream>
#include <fstream>
int main() {
auto b = vde::brep::make_box(10,10,10);
std::cout << "=== COLLADA ===" << std::endl;
bool cok = vde::foundation::export_collada({b}, "/tmp/col.dae");
std::cout << "export=" << cok << std::endl;
std::cout << "file size=" << std::ifstream("/tmp/col.dae").seekg(0,std::ios::end).tellg() << std::endl;
auto cr = vde::foundation::import_collada("/tmp/col.dae");
std::cout << "import=" << cr.size() << std::endl;
std::cout << "=== glTF ===" << std::endl;
bool gok = vde::foundation::write_brep_gltf("/tmp/x.glb", b, 4);
std::cout << "write=" << gok << std::endl;
auto gr = vde::foundation::import_gltf("/tmp/x.glb");
std::cout << "meshes=" << gr.meshes.size() << " ok=" << gr.success << std::endl;
if (!gr.error_message.empty()) std::cout << "ERR: " << gr.error_message << std::endl;
}