Commits

Anonymous committed 803c0dc

Adding zoom in/out capability

Comments (0)

Files changed (3)

NPR/Report.docx

Binary file modified.

NPR/Trackball.cpp

 	rotatedVec[2] = tmpVec[2] + point[2];
 }
 
-void zoomIn(double val, double* eye, double* lookAt, double* newEye) {
+void zoomOut(double val, double* eye, double* lookAt, double* newEye) {
 	double tmp[3] = { eye[0] - lookAt[0], eye[1] - lookAt[1], eye[2] - lookAt[2] };
 
 	tmp[0] *= val;
 	newEye[2] = tmp[2] + lookAt[2];
 }
 
-void zoomOut(double val, double* eye, double* lookAt, double* newEye) {
+void zoomIn(double val, double* eye, double* lookAt, double* newEye) {
 	double tmp[3] = { eye[0] - lookAt[0], eye[1] - lookAt[1], eye[2] - lookAt[2] };
 
 	tmp[0] /= val;
 		}
 	} else if (key>='0' && key <='4') {
 		changeLightDirection(key - '0');
+	} else if (key == '+' || key == '=') {
+		zoomIn(1.2, eye, lookAt, eye);
+	} else if (key == '-' || key == '_') {
+		zoomOut(1.2, eye, lookAt, eye);
 	} else if (key=='q' || key == 'Q') {
 		exit(0);
 	}