refactoring vr code
This commit is contained in:
27
src/app.h
27
src/app.h
@@ -34,6 +34,29 @@
|
||||
#include "node_panel_grid.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
|
||||
{
|
||||
public:
|
||||
@@ -90,6 +113,7 @@ public:
|
||||
bool ui_visible = true;
|
||||
bool ui_rtl = false;
|
||||
bool vr_active = false;
|
||||
bool vr_only = false;
|
||||
glm::mat4 vr_controller;
|
||||
glm::vec3 vr_controller_pos;
|
||||
float vr_pressure = 1.f;
|
||||
@@ -140,7 +164,10 @@ public:
|
||||
bool update_ui_observer(Node* n);
|
||||
bool vr_start();
|
||||
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_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 async_start();
|
||||
void async_update();
|
||||
|
||||
Reference in New Issue
Block a user