talpa/iomesh.cpp
// ---------------------------------------------------------
///
/// Write mesh in Renderman RIB format.
///
// ---------------------------------------------------------
Write mesh in Renderman RIB format.
Write mesh in Renderman RIB format .
bool write_ribfile(const NonDestructiveTriMesh &mesh, const std::vector<float> &x, const char *filename_format, ...)
{
#ifdef _MSC_VER
    va_list ap;
    va_start(ap, filename_format);
    int len=_vscprintf(filename_format, ap) 
        +1; 
    char *filename=new char[len];
    vsprintf(filename, filename_format, ap);
    std::ofstream output(filename, std::ofstream::binary);
    delete[] filename;
    va_end(ap);
#else
    va_list ap;
    va_start(ap, filename_format);
    char *filename;
    vasprintf(&filename, filename_format, ap);
    std::ofstream output(filename, std::ofstream::binary);
    std::free(filename);
    va_end(ap);
#endif
    if(!output.good()) return false;
    return write_ribfile(mesh, x, output);
}
bool write_ribfile ( const NonDestructiveTriMesh & mesh , const std :: vector < float > & x , const char * filename_format , ... ) { #ifdef _MSC_VER va_list ap ; va_start ( ap , filename_format ) ; int len = _vscprintf ( filename_format , ap ) + 1 ; char * filename = new char [ len ] ; vsprintf ( filename , filename_format , ap ) ; std :: ofstream output ( filename , std :: ofstream :: binary ) ; delete [ ] filename ; va_end ( ap ) ; #else va_list ap ; va_start ( ap , filename_format ) ; char * filename ; vasprintf ( & filename , filename_format , ap ) ; std :: ofstream output ( filename , std :: ofstream :: binary ) ; std :: free ( filename ) ; va_end ( ap ) ; #endif if ( ! output . good ( ) ) return false ; return write_ribfile ( mesh , x , output ) ; }
Write mesh in Renderman RIB format.
Write mesh in Renderman RIB format .
// _vscprintf doesn't count // terminating '\0'