diff --git a/src/api/event.c b/src/api/event.c index 16ba9201..7db725de 100644 --- a/src/api/event.c +++ b/src/api/event.c @@ -12,7 +12,7 @@ static int nextEvent(lua_State* L) { return 0; } - luax_pushenum(L, &EventTypes, event.type, "event type"); + luax_pushenum(L, &EventTypes, event.type); switch (event.type) { case EVENT_QUIT: diff --git a/src/data/modelData.c b/src/data/modelData.c index 94a8859d..7ecc1b94 100644 --- a/src/data/modelData.c +++ b/src/data/modelData.c @@ -200,7 +200,7 @@ static aiReturn assimpFileSeek(struct aiFile* assimpFile, size_t position, enum return lovrFileSeek(file, position) ? aiReturn_FAILURE : aiReturn_SUCCESS; } -static unsigned int assimpFileTell(struct aiFile* assimpFile) { +static unsigned long assimpFileTell(struct aiFile* assimpFile) { File* file = (File*) assimpFile->UserData; return lovrFileTell(file); } diff --git a/src/graphics/model.c b/src/graphics/model.c index 0c6e3a80..defbb5e6 100644 --- a/src/graphics/model.c +++ b/src/graphics/model.c @@ -70,7 +70,7 @@ Model* lovrModelCreate(ModelData* modelData) { model->textures = malloc(modelData->textures.length * sizeof(Texture*)); for (int i = 0; i < modelData->textures.length; i++) { if (modelData->textures.data[i]) { - model->textures[i] = lovrTextureCreate(TEXTURE_2D, (TextureData**) &modelData->textures.data[i], 1, true, true); + model->textures[i] = lovrTextureCreate(TEXTURE_2D, (TextureData**) &modelData->textures.data[i], 1, i == 2, true); } else { model->textures[i] = NULL; } diff --git a/src/headset/fake.c b/src/headset/fake.c index 28e1ee23..5925b7a0 100644 --- a/src/headset/fake.c +++ b/src/headset/fake.c @@ -40,8 +40,6 @@ typedef struct { static FakeHeadsetState state; -static void fakePoll(); - /* * callback handlers */ @@ -214,7 +212,7 @@ static void fakeSetMirrored(bool mirror) { static void fakeGetDisplayDimensions(int* width, int* height) { GLFWwindow* window = glfwGetCurrentContext(); if (window) { - glfwGetWindowSize(window,width,height); + glfwGetFramebufferSize(window, width, height); } } @@ -313,12 +311,12 @@ static ModelData* fakeControllerNewModelData(Controller* controller) { static void fakeRenderTo(headsetRenderCallback callback, void* userdata) { GLFWwindow* window = glfwGetCurrentContext(); - if(!window) { + if (!window) { return; } int w, h; - glfwGetWindowSize(window, &w, &h); + glfwGetFramebufferSize(window, &w, &h); mat4_perspective(state.projection, state.clipNear, state.clipFar, 67 * M_PI / 180.0, (float) w / h); float transform[16]; diff --git a/src/headset/openvr.c b/src/headset/openvr.c index ff1267ad..26abf3ea 100644 --- a/src/headset/openvr.c +++ b/src/headset/openvr.c @@ -208,12 +208,13 @@ static void openvrPoll() { } case EVREventType_VREvent_InputFocusCaptured: - case EVREventType_VREvent_InputFocusReleased: + case EVREventType_VREvent_InputFocusReleased: { bool isFocused = vrEvent.eventType == EVREventType_VREvent_InputFocusReleased; EventData data = { .focus = { isFocused } }; Event event = { .type = EVENT_FOCUS, .data = data }; lovrEventPush(event); break; + } default: break; @@ -248,7 +249,7 @@ static void ensureCanvas() { state.canvas = lovrCanvasCreate(state.renderWidth, state.renderHeight, FORMAT_RGB, msaa, true, true); } -static void openvrInit() { +static bool openvrInit() { if (state.initialized) return true; if (!VR_IsHmdPresent() || !VR_IsRuntimeInstalled()) { @@ -770,5 +771,6 @@ HeadsetInterface lovrHeadsetOpenVRDriver = { openvrControllerIsTouched, openvrControllerVibrate, openvrControllerNewModelData, - openvrRenderTo + openvrRenderTo, + NULL }; diff --git a/src/util.h b/src/util.h index b9f412e4..e5694312 100644 --- a/src/util.h +++ b/src/util.h @@ -20,8 +20,8 @@ typedef struct { float r, g, b, a; } Color; -_Thread_local extern char lovrErrorMessage[]; -_Thread_local extern jmp_buf* lovrCatch; +extern _Thread_local char lovrErrorMessage[]; +extern _Thread_local jmp_buf* lovrCatch; void lovrThrow(const char* format, ...); void lovrSleep(double seconds);