2016-11-19 09:28:01 +00:00
|
|
|
#include "headset/headset.h"
|
2016-11-26 01:13:26 +00:00
|
|
|
#include "loaders/model.h"
|
2016-11-19 09:28:01 +00:00
|
|
|
#include "glfw.h"
|
2016-11-25 00:23:13 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#ifndef _WIN32
|
|
|
|
#define __stdcall
|
|
|
|
#endif
|
|
|
|
#include <openvr_capi.h>
|
2016-11-18 09:28:40 +00:00
|
|
|
|
|
|
|
#ifndef LOVR_VIVE_TYPES
|
|
|
|
#define LOVR_VIVE_TYPES
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
struct VR_IVRSystem_FnTable* vrSystem;
|
|
|
|
struct VR_IVRCompositor_FnTable* vrCompositor;
|
|
|
|
struct VR_IVRChaperone_FnTable* vrChaperone;
|
2016-11-25 11:18:53 +00:00
|
|
|
struct VR_IVRRenderModels_FnTable* vrRenderModels;
|
2016-11-18 09:28:40 +00:00
|
|
|
|
|
|
|
unsigned int headsetIndex;
|
|
|
|
unsigned int controllerIndex[CONTROLLER_HAND_RIGHT + 1];
|
|
|
|
|
2016-11-25 00:23:13 +00:00
|
|
|
int isRendering;
|
|
|
|
TrackedDevicePose_t renderPoses[16];
|
|
|
|
|
2016-11-18 09:28:40 +00:00
|
|
|
Controller* controllers[CONTROLLER_HAND_RIGHT + 1];
|
|
|
|
|
|
|
|
float clipNear;
|
|
|
|
float clipFar;
|
|
|
|
|
|
|
|
uint32_t renderWidth;
|
|
|
|
uint32_t renderHeight;
|
|
|
|
|
|
|
|
GLuint framebuffer;
|
|
|
|
GLuint depthbuffer;
|
|
|
|
GLuint texture;
|
|
|
|
GLuint resolveFramebuffer;
|
|
|
|
GLuint resolveTexture;
|
|
|
|
} ViveState;
|
|
|
|
|
|
|
|
#endif
|
2016-09-17 04:37:30 +00:00
|
|
|
|
|
|
|
Headset* viveInit();
|
2016-11-18 09:28:40 +00:00
|
|
|
void viveDestroy(void* headset);
|
2016-10-03 18:40:20 +00:00
|
|
|
char viveIsPresent(void* headset);
|
2016-10-01 21:12:55 +00:00
|
|
|
const char* viveGetType(void* headset);
|
2016-10-24 23:03:29 +00:00
|
|
|
void viveGetDisplayDimensions(void* headset, int* width, int* height);
|
2016-09-27 06:48:09 +00:00
|
|
|
void viveGetClipDistance(void* headset, float* near, float* far);
|
2016-10-01 21:12:55 +00:00
|
|
|
void viveSetClipDistance(void* headset, float near, float far);
|
2016-11-24 04:54:04 +00:00
|
|
|
float viveGetBoundsWidth(void* headset);
|
|
|
|
float viveGetBoundsDepth(void* headset);
|
|
|
|
void viveGetBoundsGeometry(void* headset, float* geometry);
|
2016-10-01 22:11:45 +00:00
|
|
|
char viveIsBoundsVisible(void* headset);
|
|
|
|
void viveSetBoundsVisible(void* headset, char visible);
|
2016-09-17 21:25:08 +00:00
|
|
|
void viveGetPosition(void* headset, float* x, float* y, float* z);
|
2016-10-01 21:12:55 +00:00
|
|
|
void viveGetOrientation(void* headset, float* x, float* y, float* z, float* w);
|
2016-09-17 04:37:30 +00:00
|
|
|
void viveGetVelocity(void* headset, float* x, float* y, float* z);
|
2016-10-01 21:12:55 +00:00
|
|
|
void viveGetAngularVelocity(void* headset, float* x, float* y, float* z);
|
2016-10-03 01:09:33 +00:00
|
|
|
Controller* viveGetController(void* headset, ControllerHand hand);
|
2016-11-15 03:47:24 +00:00
|
|
|
char viveControllerIsPresent(void* headset, Controller* controller);
|
|
|
|
void viveControllerGetPosition(void* headset, Controller* controller, float* x, float* y, float* z);
|
|
|
|
void viveControllerGetOrientation(void* headset, Controller* controller, float* w, float* x, float* y, float* z);
|
|
|
|
float viveControllerGetAxis(void* headset, Controller* controller, ControllerAxis axis);
|
2016-11-15 03:57:23 +00:00
|
|
|
int viveControllerIsDown(void* headset, Controller* controller, ControllerButton button);
|
2016-11-15 03:47:24 +00:00
|
|
|
ControllerHand viveControllerGetHand(void* headset, Controller* controller);
|
2016-11-15 03:33:42 +00:00
|
|
|
void viveControllerVibrate(void* headset, Controller* controller, float duration);
|
2016-11-25 09:12:36 +00:00
|
|
|
ModelData* viveControllerNewModelData(void* headset, Controller* controller);
|
2016-09-17 04:37:30 +00:00
|
|
|
void viveRenderTo(void* headset, headsetRenderCallback callback, void* userdata);
|