refactoring vr code
This commit is contained in:
@@ -601,10 +601,6 @@ static int engine_init_display(struct engine* engine) {
|
|||||||
//LOG("PROP: %s", os_props[""].c_str());
|
//LOG("PROP: %s", os_props[""].c_str());
|
||||||
//LOG("PROP: %s", os_props[""].c_str());
|
//LOG("PROP: %s", os_props[""].c_str());
|
||||||
|
|
||||||
#ifdef __QUEST__
|
|
||||||
oculus_init_vr(display, context, engine->app->window);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialize GL state.
|
// Initialize GL state.
|
||||||
|
|
||||||
android_async_lock(engine);
|
android_async_lock(engine);
|
||||||
@@ -628,7 +624,14 @@ static int engine_init_display(struct engine* engine) {
|
|||||||
App::I.height = h;
|
App::I.height = h;
|
||||||
App::I.redraw = true;
|
App::I.redraw = true;
|
||||||
App::I.init();
|
App::I.init();
|
||||||
|
|
||||||
|
#ifdef __QUEST__
|
||||||
App::I.resize(w, h);
|
App::I.resize(w, h);
|
||||||
|
oculus_init_vr(display, context, engine->app->window);
|
||||||
|
App::I.vr_active = true;
|
||||||
|
App::I.has_vr = true;
|
||||||
|
App::I.vr_only = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG("All ready");
|
LOG("All ready");
|
||||||
engine->animating = 1;
|
engine->animating = 1;
|
||||||
@@ -669,35 +672,20 @@ static void engine_draw_frame(struct engine* engine) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
rendered_frames++;
|
rendered_frames++;
|
||||||
elapsed = 0;
|
|
||||||
|
|
||||||
#ifdef __QUEST__
|
#ifdef __QUEST__
|
||||||
App::I.vr_draw_ui();
|
App::I.update(elapsed);
|
||||||
oculus_draw();
|
oculus_draw();
|
||||||
#else
|
#else
|
||||||
/*
|
|
||||||
int w, h;
|
|
||||||
eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
|
|
||||||
eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);
|
|
||||||
|
|
||||||
if (w != engine->width || h != engine->height) {
|
|
||||||
engine->width = w;
|
|
||||||
engine->height = h;
|
|
||||||
App::I.resize(w, h);
|
|
||||||
App::I.redraw = true;
|
|
||||||
LOG("resize window to %d %d", w, h);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!(App::I.redraw || App::I.animate))
|
if (!(App::I.redraw || App::I.animate))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
App::I.clear();
|
App::I.clear();
|
||||||
App::I.update(elapsed);
|
App::I.update(elapsed);
|
||||||
elapsed = 0;
|
|
||||||
|
|
||||||
eglSwapBuffers(engine->display, engine->surface);
|
eglSwapBuffers(engine->display, engine->surface);
|
||||||
#endif
|
#endif
|
||||||
|
elapsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
43
src/app.cpp
43
src/app.cpp
@@ -110,7 +110,6 @@ bool App::request_close()
|
|||||||
void App::clear()
|
void App::clear()
|
||||||
{
|
{
|
||||||
glClearColor(.1f, .1f, .1f, 1.f);
|
glClearColor(.1f, .1f, .1f, 1.f);
|
||||||
glViewport(off_x, off_y, (GLsizei)width, (GLsizei)height);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,11 +587,6 @@ void App::update(float dt)
|
|||||||
if (!(redraw || animate))
|
if (!(redraw || animate))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//glClearColor(.1f, .1f, .1f, 1.f);
|
|
||||||
//glViewport(0, 0, (GLsizei)width, (GLsizei)height);
|
|
||||||
//glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
|
|
||||||
//if (!canvas->m_mouse_captured)
|
|
||||||
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
|
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
|
||||||
reload_timer += dt;
|
reload_timer += dt;
|
||||||
if (reload_timer > 1.0)
|
if (reload_timer > 1.0)
|
||||||
@@ -634,6 +628,7 @@ void App::update(float dt)
|
|||||||
{
|
{
|
||||||
uirtt.bindFramebuffer();
|
uirtt.bindFramebuffer();
|
||||||
uirtt.clear();
|
uirtt.clear();
|
||||||
|
glViewport(0, 0, uirtt.getWidth(), uirtt.getHeight());
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
for (int i = 1; i < layout[main_id]->m_children.size(); i++)
|
for (int i = 1; i < layout[main_id]->m_children.size(); i++)
|
||||||
layout[main_id]->m_children[i]->watch(observer);
|
layout[main_id]->m_children[i]->watch(observer);
|
||||||
@@ -641,29 +636,21 @@ void App::update(float dt)
|
|||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
uirtt.unbindFramebuffer();
|
uirtt.unbindFramebuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
|
||||||
[ios_view->glview bindDrawable];
|
|
||||||
#else
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
||||||
#endif
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
for (int i = 0; i < layout[main_id]->m_children.size(); i++)
|
|
||||||
layout[main_id]->m_children[i]->watch(observer);
|
|
||||||
//msgbox->watch(observer);
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
|
|
||||||
//canvas->watch(observer);
|
if (!vr_only)
|
||||||
//glEnable(GL_BLEND);
|
{
|
||||||
//sampler.bind(0);
|
#if __IOS__
|
||||||
//ShaderManager::use(kShader::Texture);
|
[ios_view->glview bindDrawable];
|
||||||
//ShaderManager::u_int(kShaderUniform::Tex, 0);
|
#else
|
||||||
//ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-1.f, 1.f, -1.f, 1.f));
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
//glActiveTexture(GL_TEXTURE0);
|
#endif
|
||||||
//uirtt.bindTexture();
|
glViewport(off_x, off_y, (GLsizei)width, (GLsizei)height);
|
||||||
//m_face_plane.draw_fill();
|
glEnable(GL_SCISSOR_TEST);
|
||||||
//uirtt.unbindTexture();
|
for (int i = 0; i < layout[main_id]->m_children.size(); i++)
|
||||||
//glDisable(GL_BLEND);
|
layout[main_id]->m_children[i]->watch(observer);
|
||||||
|
//msgbox->watch(observer);
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
if (rec_running)
|
if (rec_running)
|
||||||
{
|
{
|
||||||
|
|||||||
27
src/app.h
27
src/app.h
@@ -34,6 +34,29 @@
|
|||||||
#include "node_panel_grid.h"
|
#include "node_panel_grid.h"
|
||||||
#include "node_panel_quick.h"
|
#include "node_panel_quick.h"
|
||||||
|
|
||||||
|
struct VRController
|
||||||
|
{
|
||||||
|
enum class kButton : uint8_t
|
||||||
|
{
|
||||||
|
Pad,
|
||||||
|
Trigger,
|
||||||
|
Menu,
|
||||||
|
Grip,
|
||||||
|
COUNT,
|
||||||
|
};
|
||||||
|
enum class kAction
|
||||||
|
{
|
||||||
|
Press,
|
||||||
|
Release,
|
||||||
|
};
|
||||||
|
std::array<bool, (int)kButton::COUNT> m_buttons;
|
||||||
|
std::array<bool, (int)kButton::COUNT> m_analog_buttons;
|
||||||
|
glm::mat4 m_mat;
|
||||||
|
bool m_valid = false;
|
||||||
|
virtual float get_trigger_value() { return 1.f; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class App
|
class App
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -90,6 +113,7 @@ public:
|
|||||||
bool ui_visible = true;
|
bool ui_visible = true;
|
||||||
bool ui_rtl = false;
|
bool ui_rtl = false;
|
||||||
bool vr_active = false;
|
bool vr_active = false;
|
||||||
|
bool vr_only = false;
|
||||||
glm::mat4 vr_controller;
|
glm::mat4 vr_controller;
|
||||||
glm::vec3 vr_controller_pos;
|
glm::vec3 vr_controller_pos;
|
||||||
float vr_pressure = 1.f;
|
float vr_pressure = 1.f;
|
||||||
@@ -140,7 +164,10 @@ public:
|
|||||||
bool update_ui_observer(Node* n);
|
bool update_ui_observer(Node* n);
|
||||||
bool vr_start();
|
bool vr_start();
|
||||||
void vr_stop();
|
void vr_stop();
|
||||||
|
void vr_update(float dt);
|
||||||
void vr_draw(const glm::mat4& proj, const glm::mat4& view, const glm::mat4& pose);
|
void vr_draw(const glm::mat4& proj, const glm::mat4& view, const glm::mat4& pose);
|
||||||
|
void vr_analog(const VRController& c, VRController::kButton b, VRController::kAction a, glm::vec2 force);
|
||||||
|
void vr_digital(const VRController& c, VRController::kButton b, VRController::kAction a, glm::vec2 axis);
|
||||||
void vr_draw_ui();
|
void vr_draw_ui();
|
||||||
void async_start();
|
void async_start();
|
||||||
void async_update();
|
void async_update();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool win32_vr_start();
|
bool win32_vr_start();
|
||||||
@@ -40,6 +41,72 @@ void App::vr_draw_ui()
|
|||||||
uirtt.unbindFramebuffer();
|
uirtt.unbindFramebuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool trigger_down = false;
|
||||||
|
cbuffer<glm::vec3> controller_points(10);
|
||||||
|
glm::vec3 controller_last_point;
|
||||||
|
void App::vr_update(float dt)
|
||||||
|
{
|
||||||
|
glm::vec3 hit;
|
||||||
|
glm::vec2 hit_fb_pos;
|
||||||
|
float t;
|
||||||
|
if (ray_intersect({ 0, 0, 0 }, glm::normalize(vr_controller_pos), { 0, 0, -1 }, { 0, 0, 1 }, { 1, 0, 0 }, hit, t))
|
||||||
|
{
|
||||||
|
glm::mat4 plane_camera = glm::lookAt(glm::vec3(0, 0, -1), { 0, 0, 1 }, { 0, 1, 0 });
|
||||||
|
glm::vec4 plane_local = plane_camera * glm::vec4(hit, 1);
|
||||||
|
hit_fb_pos.x = -(plane_local.x * 0.5f - 0.5f) * width;
|
||||||
|
hit_fb_pos.y = (plane_local.y * 0.5f + 0.5f) * height;
|
||||||
|
LOG("cursor %f %f", hit_fb_pos.x, hit_fb_pos.y);
|
||||||
|
mouse_move(hit_fb_pos.x, height - hit_fb_pos.y - 1, 1.f, kEventSource::Mouse, false);
|
||||||
|
}
|
||||||
|
if (trigger_down)
|
||||||
|
{
|
||||||
|
controller_points.add(App::I.vr_controller_pos * 800.f);
|
||||||
|
auto p = controller_points.average();
|
||||||
|
if (glm::distance(p, controller_last_point) > 10)
|
||||||
|
{
|
||||||
|
async_start();
|
||||||
|
Canvas::I->stroke_update(p, 1.f);
|
||||||
|
async_end();
|
||||||
|
controller_last_point = p;
|
||||||
|
App::I.redraw = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::vr_analog(const VRController& c, VRController::kButton b, VRController::kAction a, glm::vec2 force)
|
||||||
|
{
|
||||||
|
if (b == VRController::kButton::Trigger)
|
||||||
|
{
|
||||||
|
if (a == VRController::kAction::Press)
|
||||||
|
{
|
||||||
|
glm::vec3 pos = vr_controller_pos * 800.f;
|
||||||
|
async_start();
|
||||||
|
Canvas::I->stroke_start(pos, force.x);
|
||||||
|
async_end();
|
||||||
|
controller_last_point = pos;
|
||||||
|
controller_points.clear();
|
||||||
|
trigger_down = true;
|
||||||
|
}
|
||||||
|
if (a == VRController::kAction::Release)
|
||||||
|
{
|
||||||
|
trigger_down = false;
|
||||||
|
async_start();
|
||||||
|
Canvas::I->stroke_end();
|
||||||
|
async_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::vr_digital(const VRController& c, VRController::kButton b, VRController::kAction a, glm::vec2 axis)
|
||||||
|
{
|
||||||
|
if (b == VRController::kButton::Pad && a == VRController::kAction::Press)
|
||||||
|
{
|
||||||
|
if (glm::length(axis) < 0.5f)
|
||||||
|
App::I.toggle_ui();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat4& pose)
|
void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat4& pose)
|
||||||
{
|
{
|
||||||
//glm::mat4 ortho_proj = glm::ortho(0.f, box.z, 0.f, box.w, -1000.f, 1000.f);
|
//glm::mat4 ortho_proj = glm::ortho(0.f, box.z, 0.f, box.w, -1000.f, 1000.f);
|
||||||
@@ -220,7 +287,7 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
|||||||
if (ui_visible && mode)
|
if (ui_visible && mode)
|
||||||
{
|
{
|
||||||
auto pos = mode->m_resizing ? mode->m_size_pos_start : mode->m_cur_pos;
|
auto pos = mode->m_resizing ? mode->m_size_pos_start : mode->m_cur_pos;
|
||||||
if (App::I.keys[(int)kKey::KeyAlt] && !mode->m_resizing)
|
if (keys[(int)kKey::KeyAlt] && !mode->m_resizing)
|
||||||
pos.x = pos.x - canvas->m_canvas->m_current_brush->m_tip_size * 500;
|
pos.x = pos.x - canvas->m_canvas->m_current_brush->m_tip_size * 500;
|
||||||
auto cur = (glm::vec2(pos.x / width, 1.f - pos.y / height) - 0.5f) * 2.f;
|
auto cur = (glm::vec2(pos.x / width, 1.f - pos.y / height) - 0.5f) * 2.f;
|
||||||
|
|
||||||
@@ -235,7 +302,7 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
|||||||
glm::scale(glm::vec3(100)) *
|
glm::scale(glm::vec3(100)) *
|
||||||
glm::transpose(canvas->m_canvas->m_cam_rot) *
|
glm::transpose(canvas->m_canvas->m_cam_rot) *
|
||||||
glm::translate(glm::vec3(cur * glm::vec2(aspect * tan_fov), -1)) *
|
glm::translate(glm::vec3(cur * glm::vec2(aspect * tan_fov), -1)) *
|
||||||
glm::scale(glm::vec3(canvas->m_canvas->m_current_brush->m_tip_size / App::I.height)) *
|
glm::scale(glm::vec3(canvas->m_canvas->m_current_brush->m_tip_size / height)) *
|
||||||
glm::eulerAngleZ(canvas->m_canvas->m_current_brush->m_tip_angle * (float)(M_PI * 2.0))
|
glm::eulerAngleZ(canvas->m_canvas->m_current_brush->m_tip_angle * (float)(M_PI * 2.0))
|
||||||
);
|
);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@@ -305,7 +372,7 @@ void App::vr_draw(const glm::mat4& proj, const glm::mat4& camera, const glm::mat
|
|||||||
ShaderManager::u_mat4(kShaderUniform::MVP,
|
ShaderManager::u_mat4(kShaderUniform::MVP,
|
||||||
proj * camera * pos *
|
proj * camera * pos *
|
||||||
glm::inverse(glm::lookAt({ 0, 0, 0 }, vr_controller_pos, { 0, 1, 0 })) *
|
glm::inverse(glm::lookAt({ 0, 0, 0 }, vr_controller_pos, { 0, 1, 0 })) *
|
||||||
glm::scale(glm::vec3(canvas->m_canvas->m_current_brush->m_tip_size * 100.f / App::I.height)) *
|
glm::scale(glm::vec3(canvas->m_canvas->m_current_brush->m_tip_size * 100.f / height)) *
|
||||||
glm::eulerAngleZ(canvas->m_canvas->m_current_brush->m_tip_angle * (float)(M_PI * 2.0))
|
glm::eulerAngleZ(canvas->m_canvas->m_current_brush->m_tip_angle * (float)(M_PI * 2.0))
|
||||||
);
|
);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|||||||
31
src/hmd.h
31
src/hmd.h
@@ -1,16 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "rtt.h"
|
#include "rtt.h"
|
||||||
|
#include "app.h"
|
||||||
|
|
||||||
struct ViveController
|
struct ViveController : public VRController
|
||||||
{
|
{
|
||||||
enum class kButton : uint8_t
|
|
||||||
{
|
|
||||||
Pad,
|
|
||||||
Trigger,
|
|
||||||
Menu,
|
|
||||||
Grip,
|
|
||||||
COUNT,
|
|
||||||
};
|
|
||||||
enum class kButtonMask : uint64_t
|
enum class kButtonMask : uint64_t
|
||||||
{
|
{
|
||||||
TriggerBit = 0x200000000,
|
TriggerBit = 0x200000000,
|
||||||
@@ -18,20 +11,20 @@ struct ViveController
|
|||||||
MenuBit = 0x000000002,
|
MenuBit = 0x000000002,
|
||||||
GripBit = 0x000000004,
|
GripBit = 0x000000004,
|
||||||
};
|
};
|
||||||
enum class kAction
|
|
||||||
{
|
|
||||||
Press,
|
|
||||||
Release,
|
|
||||||
};
|
|
||||||
static std::map<kButton, kButtonMask> m_mask;
|
static std::map<kButton, kButtonMask> m_mask;
|
||||||
std::array<bool, (int)kButton::COUNT> m_buttons;
|
|
||||||
std::array<bool, (int)kButton::COUNT> m_analog_buttons;
|
|
||||||
glm::mat4 m_mat;
|
|
||||||
vr::VRControllerState_t m_state{ 0 };
|
vr::VRControllerState_t m_state{ 0 };
|
||||||
bool m_valid = false;
|
|
||||||
glm::vec2 axis(kButton button) const {
|
glm::vec2 axis(kButton button) const
|
||||||
|
{
|
||||||
return { m_state.rAxis[(int)button].x, m_state.rAxis[(int)button].y };
|
return { m_state.rAxis[(int)button].x, m_state.rAxis[(int)button].y };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual float get_trigger_value() override
|
||||||
|
{
|
||||||
|
return axis(VRController::kButton::Trigger).x;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Vive
|
struct Vive
|
||||||
|
|||||||
51
src/main.cpp
51
src/main.cpp
@@ -513,38 +513,10 @@ bool win32_vr_start()
|
|||||||
App::I.has_vr = true;
|
App::I.has_vr = true;
|
||||||
vr_running = true;
|
vr_running = true;
|
||||||
|
|
||||||
bool trigger_down = false;
|
vive->on_analog_button = std::bind(&App::vr_analog, &App::I, std::placeholders::_1,
|
||||||
cbuffer<glm::vec3> controller_points(10);
|
std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
|
||||||
glm::vec3 controller_last_point;
|
vive->on_button = std::bind(&App::vr_digital, &App::I, std::placeholders::_1,
|
||||||
vive->on_analog_button = [&](const ViveController& c, ViveController::kButton b, ViveController::kAction a, glm::vec2 force) {
|
std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
|
||||||
if (b == ViveController::kButton::Trigger)
|
|
||||||
{
|
|
||||||
if (a == ViveController::kAction::Press)
|
|
||||||
{
|
|
||||||
glm::vec3 pos = glm::normalize(xyz(vive->m_controllers[0].m_mat[3])) * 800.f;
|
|
||||||
async_lock();
|
|
||||||
Canvas::I->stroke_start(pos, force.x);
|
|
||||||
async_unlock();
|
|
||||||
controller_last_point = pos;
|
|
||||||
controller_points.clear();
|
|
||||||
trigger_down = true;
|
|
||||||
}
|
|
||||||
if (a == ViveController::kAction::Release)
|
|
||||||
{
|
|
||||||
trigger_down = false;
|
|
||||||
async_lock();
|
|
||||||
Canvas::I->stroke_end();
|
|
||||||
async_unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
vive->on_button = [&](const ViveController& c, ViveController::kButton b, ViveController::kAction a, glm::vec2 axis) {
|
|
||||||
if (b == ViveController::kButton::Pad && a == ViveController::kAction::Press)
|
|
||||||
{
|
|
||||||
if (glm::length(axis) < 0.5f)
|
|
||||||
App::I.toggle_ui();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const float target_tick_rate = 90;
|
const float target_tick_rate = 90;
|
||||||
auto t0 = GetTickCount64();
|
auto t0 = GetTickCount64();
|
||||||
@@ -569,21 +541,8 @@ bool win32_vr_start()
|
|||||||
App::I.vr_active = vive->m_active;
|
App::I.vr_active = vive->m_active;
|
||||||
App::I.vr_controller = vive->m_controllers[0].m_mat;
|
App::I.vr_controller = vive->m_controllers[0].m_mat;
|
||||||
App::I.vr_controller_pos = glm::normalize(xyz(vive->m_controllers[0].m_mat[3]));
|
App::I.vr_controller_pos = glm::normalize(xyz(vive->m_controllers[0].m_mat[3]));
|
||||||
|
App::I.vr_update(dt);
|
||||||
|
|
||||||
if (trigger_down)
|
|
||||||
{
|
|
||||||
controller_points.add(App::I.vr_controller_pos * 800.f);
|
|
||||||
auto p = controller_points.average();
|
|
||||||
if (glm::distance(p, controller_last_point) > 10)
|
|
||||||
{
|
|
||||||
async_lock();
|
|
||||||
Canvas::I->stroke_update(p, vive->m_controllers[0].axis(ViveController::kButton::Trigger).x);
|
|
||||||
async_unlock();
|
|
||||||
controller_last_point = p;
|
|
||||||
App::I.redraw = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vr_running && vive->m_active)
|
if (vr_running && vive->m_active)
|
||||||
{
|
{
|
||||||
async_lock();
|
async_lock();
|
||||||
|
|||||||
Reference in New Issue
Block a user