X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fvrinput.cc;h=2d0646a852a4e28b2a656eaed63db62f65848204;hp=2a25f537ca09a078f685d4981d20474741020c4a;hb=5dd1387e90808441e8748c33f0550a93e72ff203;hpb=c22f7c9b89f295140c523d85829062de21af29a0 diff --git a/src/vrinput.cc b/src/vrinput.cc index 2a25f53..2d0646a 100644 --- a/src/vrinput.cc +++ b/src/vrinput.cc @@ -2,39 +2,56 @@ #include #include "vrinput.h" #include "scene.h" +#include "shader.h" VRHand vrhand[2]; -static Scene *scn; +//static Scene *scn; bool init_vrhands() { - scn = new Scene; + /*scn = new Scene; 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; } void destroy_vrhands() { - delete scn; - scn = 0; + //delete scn; + //scn = 0; } -void update_vrhands() +void update_vrhands(const Avatar *avatar) { + Quat qbodyrot; + qbodyrot.set_rotation(Vec3(0, 1, 0), -deg_to_rad(avatar->get_body_rotation())); + Vec3 pos = avatar->get_position(); + for(int i=0; i<2; i++) { if(goatvr_hand_active(i)) { goatvr_hand_position(i, &vrhand[i].pos.x); goatvr_hand_orientation(i, &vrhand[i].rot.x); + + vrhand[i].pos = rotate(vrhand[i].pos, qbodyrot) + pos; + vrhand[i].rot = qbodyrot * vrhand[i].rot; + vrhand[i].valid = true; } else { vrhand[i].valid = false; } } + + //scn->update(0); } void draw_vrhands() { + //bind_shader(0); + //scn->draw(); }