- if (moving) {\r
- angle = angle + (x - startx);\r
- angle2 = angle2 + (y - starty);\r
- startx = x;\r
- starty = y;\r
- glutPostRedisplay();\r
- }\r
- if (lightMoving) {\r
- lightAngle += (x - lightStartX)/40.0;\r
- lightHeight += (lightStartY - y)/20.0;\r
- lightStartX = x;\r
- lightStartY = y;\r
- glutPostRedisplay();\r
+ if ( buttonSelected == -1 ) return; // No button selected, no action\r
+\r
+ switch ( manipulateState ) {\r
+ case STATE_CAMERA_ROTATE_MOVE:\r
+ rotate += (x - startx);\r
+\r
+ if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
+ // w: rotate, h: zoom\r
+ zoom += (y - starty);\r
+ printf("zoom is %f\n", zoom);\r
+ } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
+ // w: rotate, h: tilt\r
+ camAngle += (y - starty);\r
+ }\r
+\r
+ starty = y;\r
+ startx = x;\r
+\r
+ break;\r
+\r
+ case STATE_OBJECT_POSITION_SCALE:\r
+ //SceneObject co = sceneObjs[curObject];\r
+\r
+ if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
+ // w: left/right, h: near/far\r
+ \r
+ } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
+ // w: big/small, h: up/down\r
+ }\r
+ break;\r
+\r
+ case STATE_OBJECT_ROTATION_TEXTURE_SCALE:\r
+ if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
+ // w: rotate on width, h: rotate on h\r
+ } else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
+ // w & h, rotate on h\r
+ }\r
+ break;\r
+\r