diff --git a/MUNGA_L4/L4VIDRND.cpp b/MUNGA_L4/L4VIDRND.cpp index 66dcb7e..7cd0ce0 100644 --- a/MUNGA_L4/L4VIDRND.cpp +++ b/MUNGA_L4/L4VIDRND.cpp @@ -1159,11 +1159,68 @@ void static Scalar fraction_sum = 0.0f; static int pinned_high = 0; static int pinned_low = 0; + static Point3D last_pod(0.0f, 0.0f, 0.0f); + static Point3D last_eye(0.0f, 0.0f, 0.0f); + static Logical have_pod = False; + static Scalar last_pod_step = 0.0f; + static Scalar last_eye_step = 0.0f; + static Scalar eye_travel = 0.0f; + static int pod_stalls = 0; + static int eye_stalls = 0; Vector3D dir; dir.Divide(to_pod, range); ++frames; + // + // Split the pod's motion from the camera's. + // + // The angle above is measured BETWEEN the two, so a + // hitch in the pan and a hitch in the pod are the same + // reading - and the symptom is specifically a pod moving + // past, which is when the pan rate peaks. Measuring each + // on its own says which one to go and fix. + // + // Same ratio test as the angle, and for the same reason: + // consecutive frames of smooth motion are near equal + // whatever the speed. + // + Point3D pod_now; + pod_now.x = renderToWorld(3,0); + pod_now.y = renderToWorld(3,1); + pod_now.z = renderToWorld(3,2); + + if (have_pod) + { + Vector3D pod_moved; + pod_moved.Subtract(pod_now, last_pod); + + Vector3D eye_moved; + eye_moved.x = gEyeWorld.x - last_eye.x; + eye_moved.y = gEyeWorld.y - last_eye.y; + eye_moved.z = gEyeWorld.z - last_eye.z; + + Scalar pod_step = pod_moved.Length(); + Scalar eye_step = eye_moved.Length(); + + if (last_pod_step > 0.0001f && pod_step < last_pod_step * 0.4f) + { + ++pod_stalls; + } + if (last_eye_step > 0.0001f && eye_step < last_eye_step * 0.4f) + { + ++eye_stalls; + } + last_pod_step = pod_step; + last_eye_step = eye_step; + eye_travel += eye_step; + } + last_pod = pod_now; + last_eye.x = gEyeWorld.x; + last_eye.y = gEyeWorld.y; + last_eye.z = gEyeWorld.z; + have_pod = True; + // // How far through the physics step this frame is being // drawn. This is the number the interpolation actually @@ -1265,6 +1322,17 @@ void ? "simulation is behind, interpolation degenerate" : "sweeping normally") << ")\n" << std::flush; + + DEBUG_STREAM << "CamLog: motion split - pod " + << pod_stalls << " stall(s), eye " + << eye_stalls << " stall(s), eye travelled " + << eye_travel << "m, verdict " + << ((pod_stalls > eye_stalls * 2) + ? "the pod" + : ((eye_stalls > pod_stalls * 2) + ? "the camera" + : "both, or neither")) + << "\n" << std::flush; } next_say = ((Scalar) Now()) + 5.0f; frames = 0; @@ -1277,6 +1345,9 @@ void fraction_sum = 0.0f; pinned_high = 0; pinned_low = 0; + pod_stalls = 0; + eye_stalls = 0; + eye_travel = 0.0f; } } }