// ============================================================================ // // Copyright (c) 1997 The CGAL Consortium // // This software and related documentation is part of an INTERNAL release // of the Computational Geometry Algorithms Library (CGAL). It is not // intended for general use. // // ---------------------------------------------------------------------------- // // release : $CGAL_Revision: $ // release_date : $CGAL_Date: $ // // file : File_writer_wavefront.h // chapter : $CGAL_Chapter: Support Library ... $ // package : $CGAL_Package: Polyhedron_IO 2.11 (04 Feb 2000) $ // source : polyhedron_io.fw // revision : $Revision$ // revision_date : $Date$ // author(s) : Lutz Kettner // // coordinator : Herve Bronnimann // // Writer for polyhedral surfaces in Wavefront file format (.obj) // ============================================================================ #ifndef CGAL_IO_FILE_WRITER_WAVEFRONT_H #define CGAL_IO_FILE_WRITER_WAVEFRONT_H 1 #ifndef CGAL_IO_BINARY_FILE_IO_H #include #endif // CGAL_IO_BINARY_FILE_IO_H #ifndef CGAL_PROTECT_IOSTREAM #include #define CGAL_PROTECT_IOSTREAM #endif #ifndef CGAL_PROTECT_CSTDDEF #include #define CGAL_PROTECT_CSTDDEF #endif CGAL_BEGIN_NAMESPACE class File_writer_wavefront { std::ostream* m_out; std::size_t m_facets; public: std::ostream& out() const { return *m_out; } void write_header( std::ostream& out, std::size_t vertices, std::size_t halfedges, std::size_t facets); void write_footer() const { out() << "\n# End of Wavefront obj format #" << std::endl; } void write_vertex( const double& x, const double& y, const double& z) { out() << "v " << x << ' ' << y << ' ' << z << '\n'; } void write_facet_header() { out() << "\n# " << m_facets << " facets\n"; out() << "# ------------------------------------------\n\n"; } void write_facet_begin( std::size_t) { out() << "f "; } void write_facet_vertex_index( std::size_t idx) { out() << ' ' << idx+1; } void write_facet_end() { out() << '\n'; } }; CGAL_END_NAMESPACE #endif // CGAL_IO_FILE_WRITER_WAVEFRONT_H // // EOF //