1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-02 12:33:52 +00:00
Commit graph

373 commits

Author SHA1 Message Date
bjorn a24d7e5447 Bugfixes during testing; 2019-02-13 15:10:52 -08:00
bjorn 0add9526ad OpenVR Controller Models; 2019-02-13 15:10:52 -08:00
bjorn 6b323e3476 Start parsing glTF; 2019-02-13 15:10:52 -08:00
bjorn f34e6f86ea Fix DepthFormat constant in oculus backend; 2019-02-08 10:57:35 -08:00
bjorn b37fc5dbbe Remove fixed-function mirroring code from headset drivers; 2019-01-28 18:29:50 -08:00
mcc b09c3adeec Fixes to lovr.mirror() requested in PR 2019-01-28 15:03:58 -08:00
mcc aab1bda92d Implementation of getMirrorTexture() 2019-01-28 15:03:58 -08:00
bjorn 6fd4b9ef4c Header cleanup; 2019-01-24 17:43:25 -08:00
bjorn cb9f166234 Revert "Replace sprintf with stb version;"
This reverts commit 8f9d24c51f.
2019-01-24 17:39:27 -08:00
bjorn bf19fd5c15 Avoid more implicit float-double conversions; 2019-01-24 17:00:41 -08:00
bjorn 8f9d24c51f Replace sprintf with stb version; 2019-01-18 08:55:29 -08:00
bjorn fae7786c8d Simplify Pipeline; 2019-01-04 18:01:01 -08:00
bjorn fbcee9ac9c rm lovrTextureGetId; 2019-01-04 18:01:01 -08:00
bjorn 086f7f4e47 lovrRelease frees objects instead of destructor;
That way objects allocated on the stack can be destroyed.
2018-12-19 01:41:01 -08:00
bjorn 9803e9916f Use naming convention for destructor; 2018-12-19 01:04:42 -08:00
bjorn 155a0c1449 lovr*Create -> lovr*Init; lovr*Create macro; 2018-12-19 01:04:42 -08:00
bjorn 1fb2d6be02 Always use pushliteral when possible; 2018-12-15 21:45:32 -08:00
bjorn 762cc64e09 Fix OpenVR events;
There was a problem where we were relying on module initialization ordering.  Now that modules are initialized in an arbitrary order, we can't guarantee that event will be loaded before headset.
2018-12-14 14:42:35 -08:00
bjorn 3a774354e8 Remove lovrHeadsetGetEyePose;
A lot of drivers didn't bother to support it, it's not used very often,
and there are better ways to expose it that will soon be implemented.
2018-12-02 13:27:55 -08:00
mcc 264db37ce6 Fix lovr.event.quit("restart") on Android 2018-11-27 15:02:25 -08:00
mcc 99026af5ca Fix Android compile 2018-11-27 15:02:25 -08:00
bjorn 0e99d47394 Fix module destruction;
There is a problem when a Thread stops: it destroys all of the modules
that it required.  This is because we unconditionally call luax_atexit
when modules are required, and when the thread lua_State dies it takes
all of the modules with it.  To fix this, lovr<Module>Init will return
whether or not initialization successfully happened, which provides us
with enough info to know if we should place the luax_atexit destructor
2018-11-19 09:24:28 -08:00
bjorn 465e5c2010 Controller:getVelocity; Controller:getAngularVelocity; 2018-11-19 09:24:10 -08:00
bjorn 6168ec243f Add platform/glfw.h;
Platforms that want to use glfw for most of their platform code can
include "glfw.h" for common functions, in a single-file-lib fashion.

All glfw code is in this file.
2018-11-16 07:24:20 -08:00
bjorn ba253a0716 oculus_mobile: lovrPlatform instead of glfw;
please don't break!
2018-11-16 04:44:20 -08:00
bjorn b7deda3758 lovrPlatform: Keyboard/mouse;
Update fake.c
2018-11-16 03:18:08 -08:00
bjorn da92cce634 Fix wasm build; 2018-11-15 08:21:26 -08:00
bjorn 005d4b93f2 Move math helpers into lib;
They aren't really part of the math module since they are shared
across several modules, more "util"-y.
2018-11-15 08:03:51 -08:00
bjorn 2238f51338 Use lovrLog functions in oculus_mobile.c;
Question: Are we okay to simplify log levels to DEBUG/WARN?  If not,
maybe we add a LOVR_LOG_LEVEL thing...
2018-11-15 07:51:21 -08:00
bjorn 81451eb99d rm trailing whitespace; 2018-11-15 07:51:21 -08:00
bjorn 0b78e238b3 luax_traceback;
Simplifies traceback code by adding a polyfill for Lua 5.2's
luaL_traceback function that can be used by the panic helper and
luax_getstack.
2018-11-15 07:51:21 -08:00
bjorn c6126bed59 Move print_override to luax;
It makes more sense for it to live there since it's a Lua override.
I misunderstood something when communicating about this initially.
2018-11-15 07:51:21 -08:00
bjorn 784d61ef4a Modify module loading;
Dynamically loading things was cool but is causing more pain than
pleasure because it just barely doesn't work everywhere.  Instead,
find a better way to load modules.  Use a data driven luaL_Reg array
to define the module mapping and luaL_register to smoosh it into
package.preload at boot time.  Benefits:

- LOVR_ENABLE_<x> defines are respected and only require a single #if
- Module list is data driven and defined in one place
- It's faster (luax_preloadmodule did a global lookup every invocation)
- It works everywhere

Oh also threads were totally broken and this (mostly) fixes them.
2018-11-15 07:51:21 -08:00
mcc 64b187ef3f Manual merge args-and-physfs PR branch with master 2018-11-13 22:09:47 -05:00
mcc 91daeae634 Style/functional fixes to args for PR. --inside is now --root 2018-11-13 22:07:19 -05:00
mcc 96eed2786c Amend oculus_mobile error handling so headset.c renderHelper drives
Back out lovrHeadsetExtractRenderFn, don't let oculus_mobile.c pcall the render function, instead fit the render error saving inside renderHelper (emscripten/oculusmobile path). The render error is now saved in the environment at _lovrHeadsetRenderError. For this to work, luax now keeps track of a global variable for the current "main" environment.

This does means the render error path now works on emscripten (this has not been tested).
2018-11-13 16:50:31 -08:00
mcc 684fd77316 Various changes around error reporting to support Oculus Mobile
General changes:

- Amended the boot.lua error handling so when an error occurs in the error handler, the inner error is printed before quitting
- Silent quit instead of crash if a user implements lovr.errhand but it doesn't return a function

Oculus Mobile changes:

- The lovr.errhand screen is now correctly invoked for errors that occur inside lovr.draw. Multiple changes were needed to make this work:
    - Instead of calling renderHelper, which uses lua_call (unsafe as Oculus Mobile does not call renderHelper) the oculus driver gets hold of the Lua ref and lua_pcalls itself. A new lovrHeadsetExtractRenderFn is added to make this possible.
    - A mechanism is added where if the coroutine resume in boot.lua returns a value, boot.lua treats this as the string returned from luax_getstack and invokes lovr.errhand.
- Added a custom atpanic that routes through lovrThrow (since stderr gets eaten). With the draw() changes this should never be encountered, but it's good just in case. In current testing the tracebacks this prints don't seem to be right.
- Fix major bug in android_vthrow that meant % codes didn't work in lovrThrow on Android
- Nothing to do with errors, but fix getAxis("trigger")
2018-11-13 16:50:31 -08:00
mcc 2213b3bcfd Allow the mountpoint to be set "inside" a zip file, using an --inside parameter.
This is used in the oculus mobile driver, allowing replacement of the (dubious) recursive-copy-from-zip code.

In order for this to work, the argument parsing must be beefed up a bit and also PhysFS must be updated to the newest master in order to get a new PHYSFS_setRoot. The github submodule source has been changed to one which updates more frequently to get this.
2018-11-13 15:20:04 -05:00
mcc 26af794e3c Adjust the lovr command line construction to follow the lua/love standards. This is a BC-breaking change.
Source for lua standard: https://en.wikibooks.org/wiki/Lua_Programming/command_line_parameter
2018-11-13 16:28:56 -05:00
bjorn 7e1527ddca (Ab)use calloc for OpenVR controller models;
Avoids a potential invalid call to free on destroy.
2018-11-12 19:00:17 -08:00
mcc a46b4afbb8 Split out the "oculus mobile" headset type into GEAR and GO. 2018-11-07 14:34:51 -05:00
mcc 2675b51013 Make oculus mobile build self-contained
The initial version of the oculus mobile driver incorporated two files, BridgeLovr.cpp and BridgeLovr.h, which were assumed to be outside of the Lovr repo in the repo for a separate Android app. The Android app now is wholly separated and communicates with the Lovr shared object via the interface in oculus_mobile_bridge.h.

A file print_override.c now contains a drop-in replacement for Lua print() which prints to lovrLog. This is useful for Android or for other future platforms where stdout/stderr aren't usable.
2018-11-07 10:24:44 -05:00
mcc d8de87d789 Fix headset and controller poses 2018-11-06 15:56:27 -05:00
mcc bf7fd349e2 Fix math bug in glfwSetTime 2018-11-06 11:28:45 -05:00
mcc 8301bd7dd8 Remerge oculus-mobile branch with master 2018-11-02 18:10:08 -04:00
mcc 428995b54b Controller support (orientation wrong currently) and time/dt support 2018-11-02 17:35:24 -04:00
bjorn f8011f7bf7 Initial platform.h; 2018-10-29 14:00:16 -07:00
bjorn 5f990d8c9f Attempt to fix state.offset;
The goal is to ensure that (for 3DOF devices) all poses are reported
to include the state.offset vertical transform applied to them.  Previously,
only rendering was using state.offset.

This is important to fix spatial audio.

Is doing this in every driver problematic?  What if we did it in the
Lua bindings?  That way it could be handled in one place.
2018-10-29 10:36:58 -07:00
mcc 79b0c19254 Oculus mobile: First round of fixes requested in PR review
Formatting, back out bad change to Win32 build, support getOs()
2018-10-28 22:55:37 -04:00
mcc 9328542ff5 Correct usage of conf "offset" and getOriginType in Oculus Mobile
Also whitespace cleanup
2018-10-28 17:16:48 -04:00