Skip to content

Commit 3b20644

Browse files
authored
correct OpenVR view bounds calculation (#227)
1 parent 9074c01 commit 3b20644

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/mods/vr/runtimes/OpenVR.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ VRRuntime::Error OpenVR::consume_events(std::function<void(void*)> callback) {
170170
} break;
171171

172172
default:
173-
spdlog::info("VR: Unknown event: {}", (uint32_t)event.eventType);
173+
// don't spam logs with SVR events that we won't handle here
174174
break;
175175
}
176176
}
@@ -225,8 +225,9 @@ VRRuntime::Error OpenVR::update_matrices(float nearz, float farz) {
225225
}
226226
view_bounds[eye][0] = 0.5f + 0.5f * this->raw_projections[eye][0] / tan_half_fov[0];
227227
view_bounds[eye][1] = 0.5f - 0.5f * this->raw_projections[eye][1] / tan_half_fov[1];
228-
view_bounds[eye][2] = 0.5f + 0.5f * this->raw_projections[eye][2] / tan_half_fov[2];
229-
view_bounds[eye][3] = 0.5f - 0.5f * this->raw_projections[eye][3] / tan_half_fov[3];
228+
// note the swapped up / down indices from the raw projection values:
229+
view_bounds[eye][2] = 0.5f + 0.5f * this->raw_projections[eye][3] / tan_half_fov[3];
230+
view_bounds[eye][3] = 0.5f - 0.5f * this->raw_projections[eye][2] / tan_half_fov[2];
230231

231232
// if we've derived the right eye, we have up to date view bounds for both so adjust the render target if necessary
232233
if (eye == 1) {

0 commit comments

Comments
 (0)