fix vr controllers interfering with screen drawing
This commit is contained in:
@@ -49,6 +49,8 @@ void App::vr_draw_ui()
|
||||
|
||||
void App::vr_update(float dt)
|
||||
{
|
||||
if (!vr_controllers_enabled)
|
||||
return;
|
||||
canvas->m_canvas->m_cam_fov = 60;
|
||||
float tan_fov = glm::tan(glm::radians(canvas->m_canvas->m_cam_fov / 2.f));
|
||||
glm::vec3 aspect = { (float)uirtt.getWidth() / (float)uirtt.getHeight(), 1.f, 1.f };
|
||||
@@ -106,6 +108,8 @@ void App::vr_update(float dt)
|
||||
|
||||
void App::vr_analog(const VRController& c, VRController::kButton b, VRController::kAction a, glm::vec2 force)
|
||||
{
|
||||
if (!vr_controllers_enabled)
|
||||
return;
|
||||
if (b == VRController::kButton::Trigger)
|
||||
{
|
||||
if (!down_controller && (ui_inside || ui_capture) && ui_visible)
|
||||
@@ -151,7 +155,9 @@ void App::vr_analog(const VRController& c, VRController::kButton b, VRController
|
||||
|
||||
void App::vr_digital(const VRController& c, VRController::kButton b, VRController::kAction a, glm::vec2 axis)
|
||||
{
|
||||
if ((b == VRController::kButton::A || b == VRController::kButton::Menu || b == VRController::kButton::Pad)
|
||||
if (!vr_controllers_enabled)
|
||||
return;
|
||||
if ((b == VRController::kButton::A || b == VRController::kButton::Menu || b == VRController::kButton::Pad)
|
||||
&& a == VRController::kAction::Press)
|
||||
{
|
||||
if (glm::length(axis) < 0.5f)
|
||||
@@ -400,7 +406,7 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
||||
}
|
||||
|
||||
// draw the cursor
|
||||
if (ui_visible && ui_inside)
|
||||
if (ui_visible /*&& ui_inside*/)
|
||||
{
|
||||
auto cur = (glm::vec2(cursor.x / width * zoom, 1.f - cursor.y / height * zoom) - 0.5f) * 2.f;
|
||||
auto mvp = proj * camera *
|
||||
@@ -418,7 +424,7 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
||||
|
||||
|
||||
// draw the motion controller sphere
|
||||
if (ui_visible && ui_inside)
|
||||
if (vr_controllers_enabled && ui_visible && ui_inside)
|
||||
{
|
||||
auto mvp = proj * camera * vr_controllers[0].m_mat;
|
||||
ShaderManager::use(kShader::Color);
|
||||
@@ -429,7 +435,7 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
||||
|
||||
|
||||
// draw the motion controller brush
|
||||
if (!ui_visible || !ui_inside)
|
||||
if (vr_controllers_enabled && (!ui_visible || !ui_inside))
|
||||
{
|
||||
glm::vec3 cpos = vr_controllers[0].get_pos() - xyz(pose[3]);
|
||||
auto pos = glm::translate(glm::normalize(cpos) * 100.f);
|
||||
|
||||
Reference in New Issue
Block a user