mirror of https://github.com/bjornbytes/lovr.git
Oculus mobile formatting;
This commit is contained in:
parent
0927df8246
commit
9e6ead30e7
|
@ -35,10 +35,11 @@ static bool oculusMobileInit(float _offset, int msaa) {
|
|||
}
|
||||
|
||||
static void oculusMobileDestroy() {
|
||||
//
|
||||
}
|
||||
|
||||
static HeadsetType oculusMobileGetType() {
|
||||
return (HeadsetType)(int)bridgeLovrMobileData.deviceType;
|
||||
return (HeadsetType) bridgeLovrMobileData.deviceType;
|
||||
}
|
||||
|
||||
static HeadsetOrigin oculusMobileGetOriginType() {
|
||||
|
@ -46,7 +47,7 @@ static HeadsetOrigin oculusMobileGetOriginType() {
|
|||
}
|
||||
|
||||
static bool oculusMobileIsMounted() {
|
||||
return true; // ???
|
||||
return true;
|
||||
}
|
||||
|
||||
static void oculusMobileGetDisplayDimensions(uint32_t* width, uint32_t* height) {
|
||||
|
@ -63,8 +64,8 @@ static void oculusMobileSetClipDistance(float clipNear, float clipFar) {
|
|||
}
|
||||
|
||||
static void oculusMobileGetBoundsDimensions(float* width, float* depth) {
|
||||
*width = 0;
|
||||
*depth = 0;
|
||||
*width = 0.f;
|
||||
*depth = 0.f;
|
||||
}
|
||||
|
||||
static const float* oculusMobileGetBoundsGeometry(int* count) {
|
||||
|
@ -142,26 +143,22 @@ static void oculusMobileControllerGetAngularVelocity(Controller* controller, flo
|
|||
static float oculusMobileControllerGetAxis(Controller* controller, ControllerAxis axis) {
|
||||
switch (axis) {
|
||||
case CONTROLLER_AXIS_TOUCHPAD_X:
|
||||
return (bridgeLovrMobileData.updateData.goTrackpad.x-160)/160.0;
|
||||
return (bridgeLovrMobileData.updateData.goTrackpad.x - 160.f) / 160.f;
|
||||
case CONTROLLER_AXIS_TOUCHPAD_Y:
|
||||
return (bridgeLovrMobileData.updateData.goTrackpad.y-160)/160.0;
|
||||
return (bridgeLovrMobileData.updateData.goTrackpad.y - 160.f) / 160.f;
|
||||
case CONTROLLER_AXIS_TRIGGER:
|
||||
return bridgeLovrMobileData.updateData.goButtonDown ? 1.0 : 0.0;
|
||||
return bridgeLovrMobileData.updateData.goButtonDown ? 1.f : 0.f;
|
||||
default:
|
||||
return 0;
|
||||
return 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
static bool buttonCheck(BridgeLovrButton field, ControllerButton button) {
|
||||
switch (button) {
|
||||
case CONTROLLER_BUTTON_MENU:
|
||||
return field & BRIDGE_LOVR_BUTTON_MENU;
|
||||
case CONTROLLER_BUTTON_TRIGGER:
|
||||
return field & BRIDGE_LOVR_BUTTON_SHOULDER;
|
||||
case CONTROLLER_BUTTON_TOUCHPAD:
|
||||
return field & BRIDGE_LOVR_BUTTON_TOUCHPAD;
|
||||
default:
|
||||
return false;
|
||||
case CONTROLLER_BUTTON_MENU: return field & BRIDGE_LOVR_BUTTON_MENU;
|
||||
case CONTROLLER_BUTTON_TRIGGER: return field & BRIDGE_LOVR_BUTTON_SHOULDER;
|
||||
case CONTROLLER_BUTTON_TOUCHPAD: return field & BRIDGE_LOVR_BUTTON_TOUCHPAD;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,6 +171,7 @@ static bool oculusMobileControllerIsTouched(Controller* controller, ControllerBu
|
|||
}
|
||||
|
||||
static void oculusMobileControllerVibrate(Controller* controller, float duration, float power) {
|
||||
//
|
||||
}
|
||||
|
||||
static ModelData* oculusMobileControllerNewModelData(Controller* controller) {
|
||||
|
@ -186,9 +184,6 @@ static void oculusMobileRenderTo(void (*callback)(void*), void* userdata) {
|
|||
renderUserdata = userdata;
|
||||
}
|
||||
|
||||
static void oculusMobileUpdate(float dt) {
|
||||
}
|
||||
|
||||
HeadsetInterface lovrHeadsetOculusMobileDriver = {
|
||||
DRIVER_OCULUS_MOBILE,
|
||||
oculusMobileInit,
|
||||
|
@ -216,8 +211,8 @@ HeadsetInterface lovrHeadsetOculusMobileDriver = {
|
|||
oculusMobileControllerVibrate,
|
||||
oculusMobileControllerNewModelData,
|
||||
oculusMobileRenderTo,
|
||||
NULL, // No mirror texture
|
||||
oculusMobileUpdate
|
||||
.getMirrorTexture = NULL,
|
||||
.update = NULL
|
||||
};
|
||||
|
||||
// Oculus-specific platform functions
|
||||
|
|
|
@ -10,66 +10,75 @@
|
|||
// happens through the functions and data structures in this file.
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int width;
|
||||
int height;
|
||||
} BridgeLovrDimensions;
|
||||
|
||||
typedef struct {
|
||||
float x; float y; float z; float q[4];
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float q[4];
|
||||
} BridgeLovrPose;
|
||||
|
||||
typedef struct {
|
||||
float x; float y; float z; float ax; float ay; float az;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float ax;
|
||||
float ay;
|
||||
float az;
|
||||
} BridgeLovrVel;
|
||||
|
||||
typedef struct {
|
||||
float x; float y;
|
||||
float x;
|
||||
float y;
|
||||
} BridgeLovrTrackpad;
|
||||
|
||||
// Bit identical with VrApi_Input.h ovrButton
|
||||
typedef enum
|
||||
{
|
||||
BRIDGE_LOVR_BUTTON_NONE = 0,
|
||||
BRIDGE_LOVR_BUTTON_NONE = 0,
|
||||
|
||||
BRIDGE_LOVR_BUTTON_SHOULDER = 0x00000001, // "Set for trigger pulled on the Gear VR and Go Controllers"
|
||||
BRIDGE_LOVR_BUTTON_TOUCHPAD = 0x00100000, // "Set for touchpad click on the Gear VR and Go Controllers"
|
||||
BRIDGE_LOVR_BUTTON_MENU = 0x00200000, // "Back button on the headset or Gear VR Controller (only set when a short press comes up)"
|
||||
BRIDGE_LOVR_BUTTON_SHOULDER = 0x00000001, // "Set for trigger pulled on the Gear VR and Go Controllers"
|
||||
BRIDGE_LOVR_BUTTON_TOUCHPAD = 0x00100000, // "Set for touchpad click on the Gear VR and Go Controllers"
|
||||
BRIDGE_LOVR_BUTTON_MENU = 0x00200000, // "Back button on the headset or Gear VR Controller (only set when a short press comes up)"
|
||||
} BridgeLovrButton;
|
||||
|
||||
// Values identical with headset.h HeadsetType
|
||||
typedef enum
|
||||
{
|
||||
BRIDGE_LOVR_DEVICE_UNKNOWN,
|
||||
BRIDGE_LOVR_DEVICE_GEAR = 3,
|
||||
BRIDGE_LOVR_DEVICE_GO = 4
|
||||
BRIDGE_LOVR_DEVICE_UNKNOWN,
|
||||
BRIDGE_LOVR_DEVICE_GEAR = 3,
|
||||
BRIDGE_LOVR_DEVICE_GO = 4
|
||||
} BridgeLovrDevice;
|
||||
|
||||
// Data passed from Lovr_NativeActivity to BridgeLovr at update time
|
||||
typedef struct {
|
||||
double displayTime; // Projected
|
||||
double displayTime; // Projected
|
||||
|
||||
BridgeLovrPose lastHeadPose;
|
||||
BridgeLovrVel lastHeadVelocity;
|
||||
float eyeViewMatrix[2][16];
|
||||
float projectionMatrix[2][16];
|
||||
BridgeLovrPose lastHeadPose;
|
||||
BridgeLovrVel lastHeadVelocity;
|
||||
float eyeViewMatrix[2][16];
|
||||
float projectionMatrix[2][16];
|
||||
|
||||
// TODO: Controller object
|
||||
bool goPresent;
|
||||
BridgeLovrPose goPose;
|
||||
BridgeLovrVel goVelocity;
|
||||
BridgeLovrTrackpad goTrackpad;
|
||||
bool goTrackpadTouch;
|
||||
BridgeLovrButton goButtonDown;
|
||||
BridgeLovrButton goButtonTouch;
|
||||
// TODO: Controller object
|
||||
bool goPresent;
|
||||
BridgeLovrPose goPose;
|
||||
BridgeLovrVel goVelocity;
|
||||
BridgeLovrTrackpad goTrackpad;
|
||||
bool goTrackpadTouch;
|
||||
BridgeLovrButton goButtonDown;
|
||||
BridgeLovrButton goButtonTouch;
|
||||
} BridgeLovrUpdateData;
|
||||
|
||||
// Data passed from Lovr_NativeActivity to BridgeLovr at init time
|
||||
typedef struct {
|
||||
const char *writablePath;
|
||||
const char *apkPath;
|
||||
BridgeLovrDimensions suggestedEyeTexture;
|
||||
double zeroDisplayTime;
|
||||
BridgeLovrDevice deviceType;
|
||||
const char *writablePath;
|
||||
const char *apkPath;
|
||||
BridgeLovrDimensions suggestedEyeTexture;
|
||||
double zeroDisplayTime;
|
||||
BridgeLovrDevice deviceType;
|
||||
} BridgeLovrInitData;
|
||||
|
||||
void bridgeLovrInit(BridgeLovrInitData *initData);
|
||||
|
@ -77,8 +86,8 @@ void bridgeLovrInit(BridgeLovrInitData *initData);
|
|||
void bridgeLovrUpdate(BridgeLovrUpdateData *updateData);
|
||||
|
||||
typedef struct {
|
||||
int eye;
|
||||
int framebuffer;
|
||||
int eye;
|
||||
int framebuffer;
|
||||
} BridgeLovrDrawData;
|
||||
|
||||
void bridgeLovrDraw(BridgeLovrDrawData *drawData);
|
||||
|
|
Loading…
Reference in New Issue