Commit Graph

1792 Commits

Author SHA1 Message Date
bjorn 1ce7e49df5 Update CMakeLists; 2018-11-15 08:18:30 -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 ab232571d0 Make sure error messages get printed; 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
bjorn 0cf52a2ce8 Attempt to use macros for android logging;
Does this work?  It seems like it should.  If it doesn't, let's use
functions consistently for logging on all platforms.
2018-11-15 07:51:21 -08:00
bjorn 7ff12740b8 rm trailing whitespace; 2018-11-15 07:51:21 -08:00
Bjorn Swenson 5ec3f7ccc0
Merge pull request #71 from mcclure/args-and-physfs
"Fix" arg standard and allow mounting inside a zip file
2018-11-13 20:04:39 -08:00
mcc 50a110ee79 Fix Android build (add additional target_link_libraries for GLES3) 2018-11-13 22:20:19 -05: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 a1237029de lovr.graphics.translate: Arguments default to 0; 2018-11-12 19:28:41 -08: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
bjorn e42d51e384 Update .appveyor.yml; 2018-11-11 18:36:36 -08:00
bjorn 4188fd53ec Handle tabs in fonts; 2018-11-11 18:28:51 -08:00
bjorn 185bb8438e Set error handler context to correct Lua state; 2018-11-11 17:33:16 -08:00
bjorn 112d775635 Font:hasGlyphs; 2018-11-11 17:29:41 -08:00
bjorn 20ddad4a9e Improve error message when glyph is not found; 2018-11-11 17:17:42 -08:00
bjorn 8b2f0eb0ba Add newline to glfw.h; 2018-11-08 14:13:39 -08:00
bjorn 1cc1a978a9 rm build folder again;
This was nice to remove a step from the compilation instructions,
but it means that we can't wipe the build directory without causing
git changes.
2018-11-08 12:58:47 -08:00
bjorn 76c2dc757a Curve:getTangent; 2018-11-08 12:56:45 -08:00
bjorn 2703192f1d Make a constructor; 2018-11-08 12:56:45 -08:00
bjorn 0f0485d9e8 Update CMakeLists; 2018-11-08 12:56:45 -08:00
bjorn 2acf49fb34 Curve; 2018-11-08 12:56:45 -08:00
bjorn 01bed22050 Update README; 2018-11-08 12:49:45 -08:00
bjorn a06734ae97 Use alpha to coverage and alpha test for text; 2018-11-08 11:58:43 -08:00
bjorn bfeb3d2d51 lovr.graphics.discard; 2018-11-08 11:58:31 -08:00
Bjorn Swenson ee3d9cf235
Update README; 2018-11-07 22:54:06 -08:00
bjorn 13eed435af Update CONTRIBUTING; 2018-11-07 22:49:03 -08:00
bjorn eadebe7f54 Update LICENSE; 2018-11-07 22:45:53 -08:00
Bjorn Swenson 9b8cd92fd6
Merge pull request #69 from mcclure/oculus-mobile
Oculus Mobile support
2018-11-07 22:44:40 -08:00
mcc b01a349275 Merge Windows build fixes for SDS library, from https://github.com/LynnKirby/sds fork commit 1ea0479693a8fd85351b75a6d41cef40a8e3e67c 2018-11-07 17:03:31 -05: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 b146ad422f Add SDS string library from commit 8dc8d6fb373bdc08eb82a72904841998d30b7cf2 2018-11-06 18:39:12 -05:00
mcc 141ebfb0e9 Switch BridgeLovr to C 2018-11-06 18:37:28 -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 0945702d27 Update CMakeLists for new platform layer; 2018-10-29 17:13:53 -07:00
bjorn 105953e743 Use a folder; 2018-10-29 14:00:16 -07:00
bjorn f8011f7bf7 Initial platform.h; 2018-10-29 14:00:16 -07:00