/* * Process mouse movement */ void processMouseMotion(int x, int y) { float angle; // HACK: Don't process the next mouse motion // The next motion callback is caused by repositioning the // mouse to the middle of the screen g_bProcessMouse = !g_bProcessMouse; if(g_bProcessMouse == FALSE) { if( !g_bPause ) { // Calculate mouse offset angle = (x - (g_iWindowCenterX - 4)) / 4; if( camera_getFreelook() == TRUE ) { // In freelook rotate the camera directly camera_rotate(angle); } else { // In normal mode rotate the cockpit, // the camera will follow automatically player_rotateCockpit(angle); } } SetCursorPos(g_iWindowCenterX, g_iWindowCenterY); } }
void ViewBase::set_camera_position(float3 angles, float distance) { cam_pos.z = 0; camera_zoom(distance); camera_rotate(angles, true); }
void ViewBase::camera_rotate(int3 pixels) { camera_rotate(make_float3(pixels.y * pixel_ratio_rotation, pixels.x * pixel_ratio_rotation, pixels.z * pixel_ratio_rotation)); }