tracker-native: restrict capture to 4:3 resolutions; 4:3 preview window (Kinect is native 4:3)

This commit is contained in:
kinect-bot committed 2026-11-25 23:50:07 -05:00
1 parent ba5a4df676
commit 0dfeedb2a0
1 file changed
+21 -2
+21 -2
View File
@@ -217,7 +217,19 @@ void PopulateResolutions() {
SendMessage(g_app.res_combo, CB_RESETCONTENT, 0, 0);
const int sel = static_cast<int>(SendMessage(g_app.device_combo, CB_GETCURSEL, 0, 0));
if (sel < 0 || sel >= static_cast<int>(g_app.devices.size())) return;
g_app.resolutions = enumerate_resolutions(g_app.devices[sel].symbolic_link);
// Only expose 4:3 resolutions: the emulated Kinect is natively 4:3, so a 16:9
// source would have to be stretched or letterboxed into the 4:3 depth/color
// frame, which misaligns the silhouette and skeleton in the game.
const auto all = enumerate_resolutions(g_app.devices[sel].symbolic_link);
g_app.resolutions.clear();
for (const auto& r : all) {
if (r.height > 0 && r.width * 3 == r.height * 4) {
g_app.resolutions.push_back(r);
}
}
if (g_app.resolutions.empty()) {
g_app.resolutions = all; // camera offers no 4:3 mode; show all rather than nothing
}
for (const auto& r : g_app.resolutions) {
wchar_t buf[64];
wsprintfW(buf, L"%d x %d", r.width, r.height);
@@ -411,8 +423,15 @@ int WINAPI wWinMain(HINSTANCE inst, HINSTANCE, PWSTR, int show) {
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
RegisterClassW(&wc);
// Size the client so the preview area (below the 44px control strip) is a
// 4:3 box: with 4:3-only capture the image fills it edge to edge, no bars.
const int kStripH = 44;
const int kPreviewW = 820;
RECT wr{0, 0, kPreviewW, kStripH + kPreviewW * 3 / 4};
AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
g_app.main = CreateWindowW(L"KinectTrackerWnd", L"Kinect Tracker (native)",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 860, 560,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
wr.right - wr.left, wr.bottom - wr.top,
nullptr, nullptr, inst, nullptr);
ShowWindow(g_app.main, show);
UpdateWindow(g_app.main);