mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-04 21:43:34 +00:00
Merge pull request #743 from jmiskovic/simulator-supersampling
Headset simulator supersampling
This commit is contained in:
commit
2770ab270a
|
@ -136,6 +136,8 @@ static bool simulator_isSeated(void) {
|
||||||
static void simulator_getDisplayDimensions(uint32_t* width, uint32_t* height) {
|
static void simulator_getDisplayDimensions(uint32_t* width, uint32_t* height) {
|
||||||
float density = os_window_get_pixel_density();
|
float density = os_window_get_pixel_density();
|
||||||
os_window_get_size(width, height);
|
os_window_get_size(width, height);
|
||||||
|
*width *= state.config.supersample;
|
||||||
|
*height *= state.config.supersample;
|
||||||
*width *= density;
|
*width *= density;
|
||||||
*height *= 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.pitch = CLAMP(state.pitch - (state.my - myprev) * TURNSPEED, -(float) M_PI / 2.f, (float) M_PI / 2.f);
|
||||||
state.yaw -= (state.mx - mxprev) * TURNSPEED;
|
state.yaw -= (state.mx - mxprev) * TURNSPEED;
|
||||||
} else {
|
} else {
|
||||||
state.mxHand = state.mx;
|
state.mxHand = state.mx * state.config.supersample;
|
||||||
state.myHand = state.my;
|
state.myHand = state.my * state.config.supersample;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Head
|
// Head
|
||||||
|
@ -480,6 +482,8 @@ static double simulator_update(void) {
|
||||||
float ray[3];
|
float ray[3];
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
os_window_get_size(&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);
|
vec3_set(ray, state.mxHand / width * 2.f - 1.f, state.myHand / height * 2.f - 1.f, 1.f);
|
||||||
|
|
||||||
mat4_mulPoint(inverseProjection, ray);
|
mat4_mulPoint(inverseProjection, ray);
|
||||||
|
|
Loading…
Reference in a new issue