//--------------------------------------------------------------
void planetEtchApp::keyPressed(int key){
	if(key == 's'){
		capture = true;
	}
    else if( key == ' ' )
        toggleDisplayMode();
}
Example #2
0
void myKeyHandler(unsigned char ch, int x, int y) {
    switch(ch) {
        case 'w':
            setup3DModel();
            break;
            
        case 'e':
            toggleDisplayMode();
            break;
            
        case 'r':
            toggleControlPoints();
            
            break;
            
        case 'a':
            subdivideVertical();
            break;
            
        case 'b':
            subdivideHorizontal(true);
            break;
            
        case 'd':
            toggleShadingMode();
            break;
            
        case 's':
            if (!drawing3D()) {
                return;
            } // if
            
            cout << "Changing shininess." << endl;
            
            shininessValue++;
            
            if (shininessValue > HIGH_SHINY) {
                shininessValue = LOW_SHINY;
            } // if
            break;
            
        case 'z':
            toggle3D();
            resetCamera();
            break;
            
        case 'p':
            if (!drawing3D()) {
                return;
            } // if
            
            cout << "[NYI] Changing to the ";
            
            extraFeatureMode++;
            
            if (extraFeatureMode > PROFILE_MODE) {
                extraFeatureMode = AVERAGE_MODE;
            } // if
            
            if (extraFeatureMode == AVERAGE_MODE) {
                cout << "average of the normal of all of the polygons";
            } // if
            
            else if (extraFeatureMode == PROFILE_MODE) {
                cout << "normal from the profile curve.";
            } // else if
            
            cout << endl;
            break;
            
        case 'c':
            resetCamera();
            cout << "Camera reset." << endl;
            break;
            
        case '=':
            zoomCamera(0.1);
            break;
            
        case 'C':
            removeAllPoints();
            resetCamera();
            cout << "Removing all points." << endl;
            break;
            
        case 'q':
                endSubdiv(0);
                break;
        default:
                /* Unrecognized keypress */
        return;
	}

	glutPostRedisplay();

	return;
}