#include #include #include #include #include #include // Mesh Eigen::MatrixXd V; Eigen::MatrixXi F; Eigen::VectorXd AO; // It allows to change the degree of the field when a number is pressed bool key_down(igl::opengl::glfw::Viewer& viewer, unsigned char key, int modifier) { using namespace Eigen; using namespace std; const RowVector3d color(0.9,0.85,0.9); switch(key) { case '1': // Show the mesh without the ambient occlusion factor viewer.data().set_colors(color); break; case '2': { // Show the mesh with the ambient occlusion factor MatrixXd C = color.replicate(V.rows(),1); for (unsigned i=0; i(AO(i)+0.2,1); viewer.data().set_colors(C); break; } case '.': viewer.core().lighting_factor += 0.1; break; case ',': viewer.core().lighting_factor -= 0.1; break; default: break; } viewer.core().lighting_factor = std::min(std::max(viewer.core().lighting_factor,0.f),1.f); return false; } int main(int argc, char *argv[]) { using namespace std; using namespace Eigen; cout<< "Press 1 to turn off Ambient Occlusion"<