#ifndef CCS_SLIDEWRITER_GUARD #define CCS_SLIDEWRITER_GUARD #include "globals.h" #include "Mesh.h" using TXS::TiffImage; #include namespace CCS { class SlideWriter { private: ofstream slfOut; ofstream batOut; char *outDir; Mesh *mesh; bool doTxtrs; /* * We need unique names for verts and faces for SLF files. * These functions just take the address and append some letter to them. * So they are unique within this proceses. */ char *vertUseName(char *buf, Face *f, Vertex *v) { sprintf(buf, "v%d_%d", (long)f, (long)v); return buf; } char *surfaceName(char *buf, TiffImage *t) { sprintf(buf, "s%d", (long)t); return buf; } char *faceName(char *buf, Face *f) { sprintf(buf, "f%d", (long)f); return buf; } /* * the main output functions */ void outputVertex(Vertex *v, Face *usingFace, TXS::UVs uv); void outputFace(Face *f); void writeTextureTiffs(Mesh *mesh); void outputMesh(Mesh *mesh); public: SlideWriter(); /* * Call this to write a CCS::Mesh (mesh) out to a SLIDE-loadable * directory. Some post-processing is required, tho: * - run convert-TIFs.bat to get GIFs which SLIDE can read * - append the necessary boilerplate code to the SLF file. */ void write(char *outDir, Mesh *mesh, bool doTxtrs = true); }; } #endif /* CCS_SLIDEWRITER_GUARD */