#include "opt.h"
#include "post.h"
#include "renderer.h"
+#include "vrinput.h"
#include "exman.h"
#include "blob_exhibit.h"
static float mouse_speed = 0.5f;
static bool show_walk_mesh, noclip = false;
-static bool have_headtracking, should_swap;
-static bool have_handtracking;
-
-static struct {
- Vec3 pos;
- Quat rot;
- bool valid;
-} hand[2];
+static bool have_headtracking, have_handtracking, should_swap;
static int prev_mx, prev_my;
static bool bnstate[8];
glClearColor(1, 1, 1, 1);
+ if(!init_vrhands()) {
+ return false;
+ }
+
mscn = new MetaScene;
if(!mscn->load(opt.scenefile ? opt.scenefile : "data/museum.scene")) {
return false;
if(opt.vr) {
goatvr_shutdown();
}
+ destroy_vrhands();
delete rend;
mouse_view_matrix.pre_rotate_y(deg_to_rad(cam_theta));
mouse_view_matrix.pre_translate(-cam_pos.x, -cam_pos.y, -cam_pos.z);
+ // update hand-tracking
if(have_handtracking) {
- for(int i=0; i<2; i++) {
- if(goatvr_hand_active(i)) {
- goatvr_hand_position(i, &hand[i].pos.x);
- goatvr_hand_orientation(i, &hand[i].rot.x);
- hand[i].valid = true;
- } else {
- hand[i].valid = false;
- }
- }
+ update_vrhands();
}
}
glLoadMatrixf(view_matrix[0]);
draw_scene();
+ if(have_handtracking) {
+ draw_vrhands();
+ }
}
goatvr_draw_done();
blobs->draw();
}
+ /*
if(have_handtracking) {
Mat4 head_xform = inverse(mouse_view_matrix);//goatvr_head_matrix();
Mat4 head_dir_xform = head_xform.upper3x3();
glEnd();
glPopAttrib();
}
+ */
if(show_walk_mesh && mscn->walk_mesh) {
glPushAttrib(GL_ENABLE_BIT);