2016-08-11 04:17:14 +00:00
|
|
|
#include "headset.h"
|
2016-09-17 04:39:20 +00:00
|
|
|
#include "vive.h"
|
2016-08-11 04:17:14 +00:00
|
|
|
|
2016-09-17 04:37:30 +00:00
|
|
|
static Headset* headset;
|
2016-08-11 04:17:14 +00:00
|
|
|
|
|
|
|
void lovrHeadsetInit() {
|
2016-09-17 04:37:30 +00:00
|
|
|
headset = viveInit();
|
2016-08-11 04:17:14 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 18:40:20 +00:00
|
|
|
char lovrHeadsetIsPresent() {
|
2016-10-24 20:43:07 +00:00
|
|
|
if (!headset) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-01 21:12:55 +00:00
|
|
|
return headset->interface->isPresent(headset);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* lovrHeadsetGetType() {
|
|
|
|
return headset->interface->getType(headset);
|
2016-09-27 06:48:09 +00:00
|
|
|
}
|
|
|
|
|
2016-10-24 23:03:29 +00:00
|
|
|
void lovrHeadsetGetDisplayDimensions(int* width, int* height) {
|
|
|
|
headset->interface->getDisplayDimensions(headset, width, height);
|
|
|
|
}
|
|
|
|
|
2016-09-27 06:48:09 +00:00
|
|
|
void lovrHeadsetGetClipDistance(float* near, float* far) {
|
|
|
|
headset->interface->getClipDistance(headset, near, far);
|
2016-08-11 04:17:14 +00:00
|
|
|
}
|
|
|
|
|
2016-10-01 21:12:55 +00:00
|
|
|
void lovrHeadsetSetClipDistance(float near, float far) {
|
|
|
|
headset->interface->setClipDistance(headset, near, far);
|
2016-09-16 06:57:01 +00:00
|
|
|
}
|
|
|
|
|
2016-10-01 21:17:26 +00:00
|
|
|
void lovrHeadsetGetTrackingSize(float* width, float* depth) {
|
|
|
|
headset->interface->getTrackingSize(headset, width, depth);
|
|
|
|
}
|
|
|
|
|
2016-10-01 22:11:45 +00:00
|
|
|
char lovrHeadsetIsBoundsVisible() {
|
|
|
|
return headset->interface->isBoundsVisible(headset);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lovrHeadsetSetBoundsVisible(char visible) {
|
|
|
|
headset->interface->setBoundsVisible(headset, visible);
|
|
|
|
}
|
|
|
|
|
2016-09-27 06:48:09 +00:00
|
|
|
void lovrHeadsetGetPosition(float* x, float* y, float* z) {
|
|
|
|
headset->interface->getPosition(headset, x, y, z);
|
2016-09-17 02:43:43 +00:00
|
|
|
}
|
2016-09-16 06:57:01 +00:00
|
|
|
|
2016-10-04 00:02:01 +00:00
|
|
|
void lovrHeadsetGetOrientation(float* w, float* x, float* y, float* z) {
|
|
|
|
headset->interface->getOrientation(headset, w, x, y, z);
|
2016-10-01 21:12:55 +00:00
|
|
|
}
|
|
|
|
|
2016-09-27 06:48:09 +00:00
|
|
|
void lovrHeadsetGetVelocity(float* x, float* y, float* z) {
|
|
|
|
headset->interface->getVelocity(headset, x, y, z);
|
2016-09-17 02:43:43 +00:00
|
|
|
}
|
2016-09-16 06:57:01 +00:00
|
|
|
|
2016-10-01 21:12:55 +00:00
|
|
|
void lovrHeadsetGetAngularVelocity(float* x, float* y, float* z) {
|
|
|
|
headset->interface->getAngularVelocity(headset, x, y, z);
|
2016-09-16 06:57:01 +00:00
|
|
|
}
|
|
|
|
|
2016-10-03 01:09:33 +00:00
|
|
|
Controller* lovrHeadsetGetController(ControllerHand hand) {
|
|
|
|
return headset->interface->getController(headset, hand);
|
|
|
|
}
|
|
|
|
|
2016-11-15 03:47:24 +00:00
|
|
|
char lovrHeadsetControllerIsPresent(Controller* controller) {
|
|
|
|
return headset->interface->controllerIsPresent(headset, controller);
|
2016-10-03 18:12:06 +00:00
|
|
|
}
|
|
|
|
|
2016-11-15 03:47:24 +00:00
|
|
|
void lovrHeadsetControllerGetPosition(Controller* controller, float* x, float* y, float* z) {
|
|
|
|
headset->interface->controllerGetPosition(headset, controller, x, y, z);
|
2016-10-03 18:12:21 +00:00
|
|
|
}
|
|
|
|
|
2016-11-15 03:47:24 +00:00
|
|
|
void lovrHeadsetControllerGetOrientation(Controller* controller, float* w, float* x, float* y, float* z) {
|
|
|
|
headset->interface->controllerGetOrientation(headset, controller, w, x, y, z);
|
2016-10-03 18:16:48 +00:00
|
|
|
}
|
|
|
|
|
2016-11-15 03:47:24 +00:00
|
|
|
float lovrHeadsetControllerGetAxis(Controller* controller, ControllerAxis axis) {
|
|
|
|
return headset->interface->controllerGetAxis(headset, controller, axis);
|
2016-11-12 11:44:33 +00:00
|
|
|
}
|
|
|
|
|
2016-11-15 03:57:23 +00:00
|
|
|
int lovrHeadsetControllerIsDown(Controller* controller, ControllerButton button) {
|
|
|
|
return headset->interface->controllerIsDown(headset, controller, button);
|
|
|
|
}
|
|
|
|
|
2016-11-15 03:47:24 +00:00
|
|
|
ControllerHand lovrHeadsetControllerGetHand(Controller* controller) {
|
|
|
|
return headset->interface->controllerGetHand(headset, controller);
|
2016-10-24 22:52:16 +00:00
|
|
|
}
|
|
|
|
|
2016-11-15 03:33:42 +00:00
|
|
|
void lovrHeadsetControllerVibrate(Controller* controller, float duration) {
|
|
|
|
headset->interface->controllerVibrate(headset, controller, duration);
|
|
|
|
}
|
|
|
|
|
2016-08-11 04:17:14 +00:00
|
|
|
void lovrHeadsetRenderTo(headsetRenderCallback callback, void* userdata) {
|
2016-09-17 04:37:30 +00:00
|
|
|
headset->interface->renderTo(headset, callback, userdata);
|
2016-08-11 04:17:14 +00:00
|
|
|
}
|