From 7229a93f1190ac211d0907ee3b87ff6bd2c8e51d Mon Sep 17 00:00:00 2001 From: Josip Miskovic Date: Wed, 14 Feb 2024 19:00:33 +0100 Subject: [PATCH] Headset simulator supersampling --- src/modules/headset/headset_simulator.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/headset/headset_simulator.c b/src/modules/headset/headset_simulator.c index e9347abd..6554cc59 100644 --- a/src/modules/headset/headset_simulator.c +++ b/src/modules/headset/headset_simulator.c @@ -136,6 +136,8 @@ static bool simulator_isSeated(void) { static void simulator_getDisplayDimensions(uint32_t* width, uint32_t* height) { float density = os_window_get_pixel_density(); os_window_get_size(width, height); + *width *= state.config.supersample; + *height *= state.config.supersample; *width *= density; *height *= density; } @@ -438,8 +440,8 @@ static double simulator_update(void) { state.pitch = CLAMP(state.pitch - (state.my - myprev) * TURNSPEED, -(float) M_PI / 2.f, (float) M_PI / 2.f); state.yaw -= (state.mx - mxprev) * TURNSPEED; } else { - state.mxHand = state.mx; - state.myHand = state.my; + state.mxHand = state.mx * state.config.supersample; + state.myHand = state.my * state.config.supersample; } // Head @@ -480,6 +482,8 @@ static double simulator_update(void) { float ray[3]; uint32_t width, height; os_window_get_size(&width, &height); + width *= state.config.supersample; + height *= state.config.supersample; vec3_set(ray, state.mxHand / width * 2.f - 1.f, state.myHand / height * 2.f - 1.f, 1.f); mat4_mulPoint(inverseProjection, ray);