e488c74d364c144f57c065544391ed6461ed3bd8
[laserbrain_demo] / src / vrinput.cc
1 #include <string.h>
2 #include "vrinput.h"
3 #include "scene.h"
4
5 VRHand vrhand[2];
6
7 static Scene *scn;
8
9 bool init_vrhands()
10 {
11         scn = new Scene;
12         if(!(scn->load("data/vrhands.obj"))) {
13                 return false;
14         }
15         return true;
16 }
17
18 void destroy_vrhands()
19 {
20         delete scn;
21         scn = 0;
22 }
23
24 void update_vrhands()
25 {
26         for(int i=0; i<2; i++) {
27                 if(!(vrhand[i].src = goatvr_get_hand_tracker(i))) {
28                         vrhand[i].valid = false;
29                         continue;
30                 }
31                 goatvr_source_position(vrhand[i].src, &vrhand[i].pos.x);
32                 goatvr_source_orientation(vrhand[i].src, &vrhand[i].rot.x);
33                 float *mat = goatvr_source_matrix(vrhand[i].src);
34                 memcpy(vrhand[i].xform[0], mat, 16 * sizeof(float));
35                 vrhand[i].valid = true;
36         }
37 }
38
39 void draw_vrhands()
40 {
41 }