//Deals with normal keydowns void processNormalKeys(unsigned char key, int x, int y) { //escape, q, spacebar quit string name; switch(key) { case 32: case 27: case 'q': quitProgram(); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': name = "pic"; name += key; name += ".png"; imageWriter.fileName = name; imageWriter.init(viewport.w, viewport.h); break; case 's': if(scene->smoothShading) { glShadeModel(GL_FLAT); } else { glShadeModel(GL_SMOOTH); } scene->smoothShading = !scene->smoothShading; break; case 'w': scene->wireframe = !scene->wireframe; break; case '-': case '_': scene->translating[2] = -TRANSPEED; break; case '=': case '+': scene->translating[2] = TRANSPEED; break; case 'a': patch = (patch + 1) % scene->meshes.size(); break; } }
void processArgs(int argc, char* argv[]) { if (argc < 3) { Usage(); } int i=1; string filename = argv[i++]; string p = argv[i++]; if (DEBUG) cout << "Parsing scene " << filename << endl; if (DEBUG) cout << "Parameter: " << atof(p.c_str()) << endl; bool adaptive = false; string arg; if (argc >= 4) { for ( ; i<argc; i++) { arg = argv[i]; if (arg.compare("-a") == 0) { adaptive = true; //scene->build(filename, atof(p.c_str())); if (DEBUG) cout << "Using adaptive subdivision." << endl; } else if (arg.compare("-pr")==0) { imageWriter.init(viewport.w, viewport.h); imageWriter.glOn = false; imageWriter.fileName = argv[++i]; } else if (arg.compare("-px")==0) { int width = atoi(argv[++i]); int height = atoi(argv[++i]); viewport.w = width; viewport.h = height; imageWriter.setSize(width, height); } } } scene = new Scene(filename, atof(p.c_str()), adaptive); }