X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fvrinput.cc;h=d5692b8d94ca1bebe4acc45d9087f5ebef2ef33b;hp=e488c74d364c144f57c065544391ed6461ed3bd8;hb=2c648dbdf80ad77015e3283beb028cd389c2d2fa;hpb=b6285d483c8b55a52b6965271a3d3163b2e2f8fa diff --git a/src/vrinput.cc b/src/vrinput.cc index e488c74..d5692b8 100644 --- a/src/vrinput.cc +++ b/src/vrinput.cc @@ -1,6 +1,8 @@ #include +#include #include "vrinput.h" #include "scene.h" +#include "shader.h" VRHand vrhand[2]; @@ -12,6 +14,9 @@ bool init_vrhands() if(!(scn->load("data/vrhands.obj"))) { return false; } + scn->objects[0]->node->set_position(Vec3(0, 150, 0)); + scn->objects[1]->node->set_position(Vec3(0, 250, 0)); + scn->update(0); return true; } @@ -21,21 +26,23 @@ void destroy_vrhands() scn = 0; } -void update_vrhands() +void update_vrhands(const Avatar *avatar) { for(int i=0; i<2; i++) { - if(!(vrhand[i].src = goatvr_get_hand_tracker(i))) { + if(goatvr_hand_active(i)) { + goatvr_hand_position(i, &vrhand[i].pos.x); + goatvr_hand_orientation(i, &vrhand[i].rot.x); + vrhand[i].valid = true; + } else { vrhand[i].valid = false; - continue; } - goatvr_source_position(vrhand[i].src, &vrhand[i].pos.x); - goatvr_source_orientation(vrhand[i].src, &vrhand[i].rot.x); - float *mat = goatvr_source_matrix(vrhand[i].src); - memcpy(vrhand[i].xform[0], mat, 16 * sizeof(float)); - vrhand[i].valid = true; } + + scn->update(0); } void draw_vrhands() { + bind_shader(0); + scn->draw(); }