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, std::ostream &output)
{
    output<<"# generated by editmesh"<<std::endl;
    output<<"PointsPolygons"<<std::endl;
    output<<" [ ";
    const std::vector<Vec3st>& tris = mesh.get_triangles();
    for(unsigned int i=0; i<tris.size(); ++i){
        output<<"3 ";
        if(i%38==37 && i!=tris.size()-1) output<<std::endl;
    }
    output<<"]"<<std::endl;
    output<<" [ ";
    for(unsigned int i=0; i<tris.size(); ++i){
        output<<tris[i]<<"  ";
        if(i%6==5 && i!=tris.size()-1) output<<std::endl;
    }
    output<<"]"<<std::endl;
    output<<" \"P\" [";
    for(unsigned int i=0; i<x.size(); ++i){
        output<<x[i]<<"  ";
        if(i%4==3 && i!=x.size()-1) output<<std::endl;
    }
    output<<"]"<<std::endl;
    return output.good();
}
bool write_ribfile ( const NonDestructiveTriMesh & mesh , const std :: vector < float > & x , std :: ostream & output ) { output << " " << std :: endl ; output << " " << std :: endl ; output << " " ; const std :: vector < Vec3st > & tris = mesh . get_triangles ( ) ; for ( unsigned int i = 0 ; i < tris . size ( ) ; ++ i ) { output << " " ; if ( i % 38 == 37 && i != tris . size ( ) - 1 ) output << std :: endl ; } output << " " << std :: endl ; output << " " ; for ( unsigned int i = 0 ; i < tris . size ( ) ; ++ i ) { output << tris [ i ] << " " ; if ( i % 6 == 5 && i != tris . size ( ) - 1 ) output << std :: endl ; } output << " " << std :: endl ; output << " \" \" " ; for ( unsigned int i = 0 ; i < x . size ( ) ; ++ i ) { output << x [ i ] << " " ; if ( i % 4 == 3 && i != x . size ( ) - 1 ) output << std :: endl ; } output << " " << std :: endl ; return output . good ( ) ; }
Write mesh in Renderman RIB format.
Write mesh in Renderman RIB format .