Split Apple platform target and move platform state ownership
This commit is contained in:
@@ -128,6 +128,8 @@ void App::vr_update(float dt)
|
||||
{
|
||||
if (!vr_controllers_enabled)
|
||||
return;
|
||||
|
||||
const auto vr_session = vr_session_snapshot();
|
||||
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 };
|
||||
@@ -142,8 +144,8 @@ void App::vr_update(float dt)
|
||||
auto r = glm::normalize(glm::vec3(glm::vec4(1, 0, 0, 0) * mm));
|
||||
auto n = glm::normalize(glm::vec3(glm::vec4(0, 0, 1, 0) * mm));
|
||||
auto u = glm::normalize(glm::vec3(glm::vec4(0, 1, 0, 0) * mm));
|
||||
auto co = vr_controllers[0].get_pos();
|
||||
auto cd = glm::mat3(vr_controllers[0].m_mat) * glm::mat3(glm::eulerAngleX(glm::radians(-30.f))) * glm::vec3(0, 0, -1);
|
||||
auto co = vr_session.vr_controllers[0].get_pos();
|
||||
auto cd = glm::mat3(vr_session.vr_controllers[0].m_mat) * glm::mat3(glm::eulerAngleX(glm::radians(-30.f))) * glm::vec3(0, 0, -1);
|
||||
ui_inside = false;
|
||||
glm::vec3 hit;
|
||||
float t;
|
||||
@@ -167,7 +169,7 @@ void App::vr_update(float dt)
|
||||
|
||||
if (down_controller)
|
||||
{
|
||||
glm::vec3 head_position = vr_head[3];
|
||||
glm::vec3 head_position = vr_session.vr_head[3];
|
||||
glm::vec3 c_pos = glm::normalize(down_controller->get_pos() - head_position) * 800.f;
|
||||
controller_points.add(c_pos);
|
||||
auto p = controller_points.average();
|
||||
@@ -210,7 +212,7 @@ void App::vr_analog(const VRController& c, VRController::kButton b, VRController
|
||||
{
|
||||
if (a == VRController::kAction::Press)
|
||||
{
|
||||
glm::vec3 head_position = vr_head[3];
|
||||
glm::vec3 head_position = vr_session_snapshot().vr_head[3];
|
||||
glm::vec3 c_pos = glm::normalize(c.get_pos() - head_position) * 800.f;
|
||||
render_task_async([=] {
|
||||
Canvas::I->stroke_start(c_pos, force.x);
|
||||
@@ -517,7 +519,8 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
||||
// draw the motion controller sphere
|
||||
if (vr_controllers_enabled && ui_visible && ui_inside)
|
||||
{
|
||||
auto mvp = proj * camera * vr_controllers[0].m_mat * glm::eulerAngleX(glm::radians(-30.f));
|
||||
const auto vr_session = vr_session_snapshot();
|
||||
auto mvp = proj * camera * vr_session.vr_controllers[0].m_mat * glm::eulerAngleX(glm::radians(-30.f));
|
||||
pp::panopainter::setup_legacy_vr_color_shader(
|
||||
pp::panopainter::LegacyVrColorUniforms {
|
||||
.color = { 1, 0, 1, 1 },
|
||||
@@ -530,7 +533,8 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
||||
// draw the motion controller brush
|
||||
if (vr_controllers_enabled && (!ui_visible || !ui_inside))
|
||||
{
|
||||
glm::vec3 cpos = vr_controllers[0].get_pos() - xyz(pose[3]);
|
||||
const auto vr_session = vr_session_snapshot();
|
||||
glm::vec3 cpos = vr_session.vr_controllers[0].get_pos() - xyz(pose[3]);
|
||||
auto pos = glm::translate(glm::normalize(cpos) * 100.f);
|
||||
auto tip_color = glm::vec4(glm::vec3(canvas->m_canvas->m_current_brush->m_tip_color), 1);
|
||||
pp::panopainter::setup_legacy_vr_stroke_preview_shader(
|
||||
|
||||
Reference in New Issue
Block a user