2017-03-11 10:19:33 +00:00
|
|
|
#include "lib/vec/vec.h"
|
2019-04-05 12:08:03 +00:00
|
|
|
#include "types.h"
|
2017-10-31 08:14:09 +00:00
|
|
|
#include <stdbool.h>
|
2019-04-05 12:08:03 +00:00
|
|
|
#include <stdint.h>
|
2016-12-01 04:32:14 +00:00
|
|
|
|
2017-01-26 10:20:30 +00:00
|
|
|
#pragma once
|
2016-11-15 00:20:56 +00:00
|
|
|
|
2019-04-05 12:08:03 +00:00
|
|
|
struct ModelData;
|
|
|
|
struct Texture;
|
|
|
|
|
2017-08-04 05:21:49 +00:00
|
|
|
typedef enum {
|
|
|
|
ORIGIN_HEAD,
|
|
|
|
ORIGIN_FLOOR
|
|
|
|
} HeadsetOrigin;
|
|
|
|
|
2017-11-25 21:01:56 +00:00
|
|
|
typedef enum {
|
2019-03-07 07:02:03 +00:00
|
|
|
DRIVER_DESKTOP,
|
2019-04-09 19:38:55 +00:00
|
|
|
DRIVER_LEAP_MOTION,
|
2018-09-09 17:58:20 +00:00
|
|
|
DRIVER_OCULUS,
|
2018-10-25 03:40:11 +00:00
|
|
|
DRIVER_OCULUS_MOBILE,
|
2017-11-25 21:01:56 +00:00
|
|
|
DRIVER_OPENVR,
|
2018-10-25 03:40:11 +00:00
|
|
|
DRIVER_WEBVR
|
2017-11-25 21:01:56 +00:00
|
|
|
} HeadsetDriver;
|
|
|
|
|
2019-03-20 00:21:16 +00:00
|
|
|
typedef struct HeadsetInterface {
|
|
|
|
struct HeadsetInterface* next;
|
2017-11-25 21:01:56 +00:00
|
|
|
HeadsetDriver driverType;
|
2018-07-29 01:12:57 +00:00
|
|
|
bool (*init)(float offset, int msaa);
|
2019-02-17 22:39:51 +00:00
|
|
|
void (*destroy)(void);
|
2019-04-19 04:03:38 +00:00
|
|
|
bool (*getName)(char* name, size_t length);
|
2019-02-17 22:39:51 +00:00
|
|
|
HeadsetOrigin (*getOriginType)(void);
|
2018-10-21 15:40:57 +00:00
|
|
|
void (*getDisplayDimensions)(uint32_t* width, uint32_t* height);
|
2019-04-09 19:38:55 +00:00
|
|
|
double (*getDisplayTime)();
|
2017-11-25 21:01:56 +00:00
|
|
|
void (*getClipDistance)(float* clipNear, float* clipFar);
|
|
|
|
void (*setClipDistance)(float clipNear, float clipFar);
|
2018-04-29 21:38:08 +00:00
|
|
|
void (*getBoundsDimensions)(float* width, float* depth);
|
2018-10-10 00:51:05 +00:00
|
|
|
const float* (*getBoundsGeometry)(int* count);
|
2019-04-20 00:33:40 +00:00
|
|
|
bool (*getPose)(const char* path, float* x, float* y, float* z, float* angle, float* ax, float* ay, float* az);
|
|
|
|
bool (*getVelocity)(const char* path, float* vx, float* vy, float* vz, float* vax, float* vay, float* vaz);
|
|
|
|
bool (*isDown)(const char* path, bool* down);
|
|
|
|
bool (*isTouched)(const char* path, bool* touched);
|
|
|
|
int (*getAxis)(const char* path, float* x, float* y, float* z);
|
|
|
|
bool (*vibrate)(const char* path, float strength, float duration, float frequency);
|
|
|
|
struct ModelData* (*newModelData)(const char* path);
|
2018-03-11 07:42:33 +00:00
|
|
|
void (*renderTo)(void (*callback)(void*), void* userdata);
|
2019-04-05 12:08:03 +00:00
|
|
|
struct Texture* (*getMirrorTexture)(void);
|
2017-11-25 21:01:56 +00:00
|
|
|
void (*update)(float dt);
|
2017-10-22 23:44:26 +00:00
|
|
|
} HeadsetInterface;
|
2017-10-20 20:32:46 +00:00
|
|
|
|
2018-04-28 23:59:53 +00:00
|
|
|
// Available drivers
|
2018-09-09 17:58:20 +00:00
|
|
|
extern HeadsetInterface lovrHeadsetOculusDriver;
|
2017-10-22 23:44:26 +00:00
|
|
|
extern HeadsetInterface lovrHeadsetOpenVRDriver;
|
2017-11-23 22:19:20 +00:00
|
|
|
extern HeadsetInterface lovrHeadsetWebVRDriver;
|
2019-03-07 07:02:03 +00:00
|
|
|
extern HeadsetInterface lovrHeadsetDesktopDriver;
|
2018-10-25 03:40:11 +00:00
|
|
|
extern HeadsetInterface lovrHeadsetOculusMobileDriver;
|
2019-04-09 19:38:55 +00:00
|
|
|
extern HeadsetInterface lovrHeadsetLeapMotionDriver;
|
2017-10-21 09:39:33 +00:00
|
|
|
|
2019-03-20 00:21:16 +00:00
|
|
|
// Active drivers
|
2018-04-28 23:59:53 +00:00
|
|
|
extern HeadsetInterface* lovrHeadsetDriver;
|
2019-03-20 00:21:16 +00:00
|
|
|
extern HeadsetInterface* lovrHeadsetTrackingDrivers;
|
|
|
|
|
|
|
|
#define FOREACH_TRACKING_DRIVER(i)\
|
|
|
|
for (HeadsetInterface* i = lovrHeadsetTrackingDrivers; i != NULL; i = i->next)
|
2016-12-01 07:03:58 +00:00
|
|
|
|
2018-11-19 16:08:56 +00:00
|
|
|
bool lovrHeadsetInit(HeadsetDriver* drivers, int count, float offset, int msaa);
|
2019-02-17 22:39:51 +00:00
|
|
|
void lovrHeadsetDestroy(void);
|