/* This code is to render a Mesh given a 3x4 camera matrix with an image resolution widthxheight. The rendering result is an ID map for facets, edges and vertices. This can usually used for occlusion testing in texture mapping a model from an image, such as the texture mapping in the following two papers. --Jianxiong Xiao http://mit.edu/jxiao/ Citation: [1] J. Xiao, T. Fang, P. Zhao, M. Lhuillier, and L. Quan Image-based Street-side City Modeling ACM Transaction on Graphics (TOG), Volume 28, Number 5 Proceedings of ACM SIGGRAPH Asia 2009 [2] J. Xiao, T. Fang, P. Tan, P. Zhao, E. Ofek, and L. Quan Image-based Facade Modeling ACM Transaction on Graphics (TOG), Volume 27, Number 5 Proceedings of ACM SIGGRAPH Asia 2008 */ #include #include #include #include #include "Mesh.h" #include "RenderMe.h" // need to install libosmesa6-dev or newer version of osmesa using namespace std; int main(int argc, char** argv){ cout<<"%% RenderMe: Give a mesh + a camera + a resolution, output a rendering of face ID map."<>render.m_width; fin>>render.m_height; for(int i=0;i<3;++i){ for(int j=0;j<4;++j){ fin>>render.projection[i][j]; } } fin.close(); unsigned int* result = render.render(); cout<<"result = ["<