Correct usage of conf "offset" and getOriginType in Oculus Mobile
Also whitespace cleanup
static void (*renderCallback)(void*);
static void* renderUserdata;
+static float offset;
+
void lovrOculusMobileDraw(int framebuffer, int width, int height, float *eyeViewMatrix, float *projectionMatrix) {
lovrGpuDirtyTexture();
@@ -17,6 +19,8 @@ void lovrOculusMobileDraw(int framebuffer, int width, int height, float *eyeView
Camera camera = { .canvas = canvas, .stereo = false };
memcpy(camera.viewMatrix[0], eyeViewMatrix, sizeof(camera.viewMatrix[0]));
+ mat4_translate(camera.viewMatrix[0], 0, -offset, 0);
+
memcpy(camera.projection[0], projectionMatrix, sizeof(camera.projection[0]));
lovrGraphicsSetCamera(&camera, true);
@@ -33,7 +37,8 @@ void lovrHeadsetUpdate(float dt) {
// Headset driver object
-static bool oculusMobileInit(float offset, int msaa) {
+static bool oculusMobileInit(float _offset, int msaa) {
+ offset = _offset;
return true;
}
@@ -45,7 +50,7 @@ static HeadsetType oculusMobileGetType() {
}
static HeadsetOrigin oculusMobileGetOriginType() {
- return ORIGIN_FLOOR;
+ return ORIGIN_HEAD;
}
static bool oculusMobileIsMounted() {
@@ -202,7 +207,6 @@ void glfwSetTime(double time) {
}
double glfwGetTime(void) {
-
}
static GLFWerrorfun lastErrFun;
