#ifndef CCS_WRITER_GUARD #define CCS_WRITER_GUARD #include "globals.h" #include "Mesh.h" #include #include namespace CCS { /* * This class writes CCS Meshes out to a binary file * format. It's well suited for meshes with MANY faces. * It assumes all faces are quads. */ class BinaryWriter { private: /* * The mesh being written */ Mesh *mesh; /* * The file we're using to write out */ fstream fout; /* * Our table of vertices to IDs * Used during writing */ map vert2id; int getVertexID(Vertex *v) { return vert2id[v]; } template void out(TData data) { fout.write((char*) &data, sizeof(TData)); } public: BinaryWriter() : mesh(NULL) {} void write(Mesh *mesh, char *filename); }; } #endif /* CCS_WRITER_GUARD */