| 294 | } |
| 295 | |
| 296 | void mouseButton(const int button, const int state, const int x, const int y) |
| 297 | { |
| 298 | |
| 299 | if (button == 3 || button == 4) //mouse wheel |
| 300 | { |
| 301 | if (button == 3) //zoom in |
| 302 | gGViewDistance += 10 * gScaleForMouseMotion; |
| 303 | else //zoom out |
| 304 | gGViewDistance -= 10 * gScaleForMouseMotion; |
| 305 | if (LOG_VERBOSE_3D_RENDERER) |
| 306 | opLog("gGViewDistance: " + std::to_string(gGViewDistance)); |
| 307 | } |
| 308 | else |
| 309 | { |
| 310 | if (button == GLUT_LEFT_BUTTON) |
| 311 | { |
| 312 | gBButton1Down = (state == GLUT_DOWN) ? 1 : 0; |
| 313 | gXClick = (float)x; |
| 314 | gYClick = (float)y; |
| 315 | |
| 316 | if (glutGetModifiers() == GLUT_ACTIVE_SHIFT) |
| 317 | gCameraMode = CameraMode::CAM_PAN; |
| 318 | else |
| 319 | gCameraMode = CameraMode::CAM_ROTATE; |
| 320 | } |
| 321 | if (LOG_VERBOSE_3D_RENDERER) |
| 322 | opLog("Clicked: [" + std::to_string(gXClick) + "," + std::to_string(gYClick) + "]"); |
| 323 | } |
| 324 | glutPostRedisplay(); |
| 325 | } |
| 326 | |
| 327 | void mouseMotion(const int x, const int y) |
| 328 | { |