project: COLLADA 2 BIN

Details

Program that converts geometric and animation 3D scene data, from a COLLADA "*.dae" file to a binary file, with a custom format.

  • current version: 1.0
  • last updated: February, 2019
Download source

main.cpp

View raw
#include <time.h>

#include "./src/def.hpp"
#include "./src/structs.hpp"

#include "./src/math/functions.h"
#include "./src/funcs.hpp"

int main(int argc, char* argv[])
{
  if(argc!= 3){
    LOG("Incorrect set of input arguments! \n");
    return -1;
  }

  //build angle tables
  math::fBUILD_ANGLE_TABLES();
  //seed pseudo-random generator
  math::fRAND_SEED(time(NULL));

  //open the binary output file for writing
  FILE* binfile;
  binfile = fopen(argv[2], "wb");// w for write, b for binary

  TiXmlDocument doc;
  doc.LoadFile(argv[1]);

  bindoc binDoc= bindoc();

  LOG("\nParsing...\n");

  read_geometries(&doc, binDoc);
  construct_mesh_geometries(binDoc.meshes);
  read_controllers(&doc, binDoc);
  read_animations(&doc, binDoc);
  compile_animations(binDoc);
  read_scene(&doc, binDoc);

  LOG("Exporting...\n");
  write_bindoc(binfile, binDoc);
  
  //finally free resources
  fclose(binfile);

  LOG("\nFinished!\n");
  return 0;
};