Commit Graph

377 Commits

Author SHA1 Message Date
bjorn 0d81745282 Fix error screen; 2019-02-05 13:15:27 -08:00
bjorn 3aec7f7767 Fix struct definition in UBO;
You can't define a new struct in an interface block.
2019-01-29 19:57:18 -08:00
bjorn 1bd58d6cef Rebuild boot.lua; 2019-01-29 02:07:34 -08:00
bjorn b37fc5dbbe Remove fixed-function mirroring code from headset drivers; 2019-01-28 18:29:50 -08:00
bjorn f2cb7e7e3d Reset color to white after drawing nogame screen; 2019-01-28 18:21:46 -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
mcc 95fcc3eb0b Attempt to make a lovr.mirror() for Window purposes as discussed in chat.
Adds lovr.graphics.hasWindow()
2019-01-28 15:03:58 -08:00
bjorn 7338c82d7f Add resizable vector pools;
It seems too dangerous/annoying to have pools error when they run
out of memory.  Instead, we'll make it so you can choose to make
a pool resizable, where it enlarges its memory if it runs out. By
default Pools aren't resizable, but the default math pool is.

Also, reduce the size of the default pool from 640k to 4k.
2019-01-10 14:10:04 -08:00
bjorn ea3a77a73a Many batching improvements; Refactoring; 2019-01-04 18:01:01 -08:00
bjorn e6b7c41860 Improve lovrDrawData uniform names; 2018-12-14 16:02:25 -08:00
bjorn 3972ddc2ad rm Cabin; 2018-12-14 10:58:03 -08:00
bjorn 099cf4cb22 Add VarelaRound; 2018-12-14 10:58:03 -08:00
bjorn c531852932 Refactor rendering; 2018-12-10 23:05:02 -08:00
bjorn 40454d1380 Use ShaderBlock for transforms/colors; 2018-12-07 18:19:03 -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
bjorn ba192374dc Start math types; 2018-12-02 12:08:07 -08:00
mcc 778b654f1d Move lovr.android.getApplicationId() to lovr.filesystem.getApplicationId(). Kill Android module
This requires adding an application id function to platform and adding a mini definition to sds into platform.h. All platforms except Android return NULL (no application id)
2018-11-27 15:02:25 -08:00
mcc 961bf859f6 Android lua module
Currently provides only a lovr.android.getApplicationId(). This returns an Android-specific identifier that doesn't cleanly map to anything specific in other OSes.
2018-11-27 15:02:25 -08:00
mcc 8e8091ccbc Fixes to error handling in boot.lua
- The pcalls to run conf were triggering their error very late, and were detecting error based on the second return value of pcall being non-nil. In fact the second return value of pcall is often non-nil in the case of *success*. We should check the first parameter, success/failure, instead.

- It is possible in principle to call error() with a non-string value, so errhand should sanitize its values with tostring.

- There is a check in the main boot.lua loop whether xpcall returned a string, which is the sign luajit hit an error in an error handler. This check was occurring in the wrong place (my fault; merge error when preparing PR) so if lovr.load() hit this case we were falling back to the horrible “could not call a string” error.
2018-11-24 18:48:29 -08:00
bjorn 465e5c2010 Controller:getVelocity; Controller:getAngularVelocity; 2018-11-19 09:24:10 -08:00
bjorn 217a2f6354 Fix problems not caught by MSVC; 2018-11-16 07:19:29 -08:00
bjorn 5c3280ba2a boot.lua: Improve errors when loading modules fails;
Remove hardcoded list of modules as well.
2018-11-16 02:27:34 -08:00
bjorn ab232571d0 Make sure error messages get printed; 2018-11-15 07:51:21 -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
bjorn a06734ae97 Use alpha to coverage and alpha test for text; 2018-11-08 11:58:43 -08:00
mcc 8301bd7dd8 Remerge oculus-mobile branch with master 2018-11-02 18:10:08 -04: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 5ad8fdd3e3 Fixes as far as running without crashes, no display yet 2018-10-24 23:40:11 -04:00
bjorn 4f542902a1 mv lovr.js webvr.js;
To allow for webxr.js and lovr.js to be used for...other things.
2018-10-21 08:56:57 -07:00
bjorn 518d26aad8 getDisplayDimensions: Use unsigned ints;
Fixes a warning.
2018-10-21 08:40:57 -07:00
bjorn e1d980a2d6 Re-add lovr.headset.getBoundsGeometry;
Looks like more runtimes are starting to support it.
2018-10-09 17:51:05 -07:00
bjorn a1d365fc25 Plumb new mirror settings through WebVR; 2018-09-30 18:58:51 -07:00
bjorn 816fda2177 Fix everything and merge; 2018-09-27 18:38:44 -07:00
bjorn 92e6ad93cb Dynamically load modules; 2018-09-27 18:38:44 -07:00
bjorn 5a9cd5187c Make CMakeLists more modular;
- Enable/disable individual modules, including enet/json
- Enable/disable different "backends" (audio/headset)
- Choose to use system vs. source versions of different libraries
2018-09-21 19:25:48 -07:00
bjorn 72158f103a Update for stereo rendering and new headset API; 2018-09-11 15:30:31 -07:00
bjorn 8b7bfec9d3 Add emscripten shell file;
To make it easier to build and test WebVR.
2018-09-06 16:05:39 -07:00
bjorn 1b3e8c9766 Flip cubemap x texture coordinate; 2018-09-04 06:42:04 -07:00
bjorn 4e1757210e Load cubemap images better; 2018-09-03 20:59:12 -07:00
bjorn b959c30424 lovrPoseMatrix; 2018-09-01 02:52:02 -07:00
bjorn c584354c92 lovrInstanceID; 2018-09-01 02:09:59 -07:00
bjorn 8b9e9eba9e Use GLSL 430 when available; 2018-09-01 01:57:38 -07:00
bjorn 4e61d2ea3b Really icky conditional shader compilation;
But I can't think of another way to do it.
2018-08-31 19:52:03 -07:00
bjorn 7b9a0ba048 Organize uniforms better; 2018-08-31 16:45:05 -07:00
bjorn a5256aaa27 Happy little graphics refactors; 2018-08-31 06:03:35 -07:00
bjorn 0ce6e046a6 lovrViewportCount; Multiply vertex divisors; 2018-08-31 02:41:50 -07:00
bjorn b7faeb8c44 Add precision for ints; 2018-08-30 21:37:45 -07:00
bjorn 04e119e413 Reduce size of default font;
It only supports the ISO8859-1 character set now.
2018-08-30 18:13:47 -07:00
bjorn 7c21d77a6e rm singlepass conf flag; Viewports; getSupported.singlepass; 2018-08-30 04:02:58 -07:00
bjorn 5ab15e36a8 Declare extension before in; 2018-08-30 03:43:41 -07:00
bjorn 4631d2dacc Test shader extension fallback; 2018-08-30 03:38:31 -07:00
bjorn e6a7a4f922 Redo singlepass; 2018-08-30 00:52:38 -07:00
bjorn a97c8e2266 Fix skybox texture mapping; 2018-08-30 00:06:29 -07:00
bjorn 26f411f43f Other headset drivers use stereo display dimensions; 2018-08-29 21:20:01 -07:00
bjorn 87c1429778 Rebuild boot.lua.h; 2018-08-23 12:53:05 -07:00
bjorn 7569b7934f conf flag for singlepass; Shader fixes; 2018-08-23 12:52:18 -07:00
bjorn c03ca73fba Use ifdefs for nvidia glsl extensions;
I think they still work if I do this.
2018-08-13 17:03:39 -07:00
bjorn a1f200cb61 Use GLSL version 430 for compute shaders; 2018-08-11 00:08:34 -07:00
bjorn 94b15c40c2 line 0 in compute prefix; 2018-08-11 00:08:34 -07:00
bjorn b891a930bf shaders.c: consistent ordering in header and implementation; 2018-08-11 00:08:34 -07:00
bjorn e371359193 Compute shader glsl prefix; 2018-08-11 00:08:33 -07:00
bjorn 2cb6de47f2 Compute shader creation; 2018-08-11 00:08:33 -07:00
bjorn 8f529d3a37 Fix potential infinite loop in error handler; 2018-08-06 13:26:17 -07:00
bjorn a713a3d14f Use 4 for default msaa instead of max;
Turns out msaa of 32 is really really slow
2018-08-04 18:44:36 -07:00
bjorn 87ff99108d Update boot.lua; 2018-07-28 18:41:51 -07:00
bjorn 785913fd45 Add conf.headset.msaa config;
For separate window/headset msaa settings.  Currently only applies
to OpenVR since the other drivers render directly to the window.
2018-07-28 18:12:57 -07:00
bjorn d79afb44d2 Make gl_ViewportIndex work in fragment shaders; 2018-07-25 00:01:22 -07:00
bjorn 2dc79a48a8 Use single pass stereo rendering when supported; 2018-07-21 05:30:13 -07:00
bjorn c6a97a9a23 Fix issue where nogame's conf was ignored; 2018-07-19 01:08:50 -07:00
bjorn 8cc795aa9d Material:getTransform; Material:setTransform; 2018-07-18 01:17:16 -07:00
bjorn 889144cc45 Add VERTEX and PIXEL/FRAGMENT defines to shader header; 2018-07-06 01:38:15 -07:00
bjorn fb3eed5518 Fix skybox shaders for WebGL; 2018-06-09 23:18:02 -07:00
bjorn 183f6003e9 rm mapped buffers mostly; 2018-06-03 19:00:31 -07:00
bjorn 6ff7292333 Mostly remove instanced stereo rendering; 2018-06-03 17:18:42 -07:00
bjornbytes c68d65441c Draw the rest of the fucking owl; 2018-05-27 19:05:10 -07:00
bjorn df876bf3b2 Static display; 2018-05-27 19:05:10 -07:00
bjorn 8bc7802246 Controller events; 2018-05-27 19:05:10 -07:00
bjorn b51e8694ac Add lovrQuit; 2018-05-27 19:05:10 -07:00
bjorn 8c2e9df1b4 Fix error handler when graphics module is disabled; 2018-05-27 19:05:10 -07:00
bjorn f4ecdb074b WebVR isMounted I guess; 2018-05-27 19:05:10 -07:00
bjorn a3a59f01a3 WebVR controller input;
No events yet.
2018-05-27 19:05:10 -07:00
bjornbytes 389a95c9ce WebVR; 2018-05-27 19:05:10 -07:00
bjorn be217a9b63 Some basic WebVR Controller functions; 2018-05-27 19:05:10 -07:00
bjorn 1b0f1acaf1 Simplify C defines; 2018-05-27 19:05:10 -07:00
bjorn 7ffd3fc25d Use more primitive getControllers signature; 2018-05-27 19:05:10 -07:00
bjorn 32668fc231 Fix C defines; 2018-05-27 19:05:10 -07:00
bjorn fd5ae4d124 webvrGetEyePose; 2018-05-27 19:05:10 -07:00
bjorn ab2594b204 WebVR velocity functions; 2018-05-27 19:05:10 -07:00
bjorn 065a5aa0dd Finish webvrGetPose; 2018-05-27 19:05:10 -07:00
bjorn 498a1843ad Work on WebVR pose input; 2018-05-27 19:05:10 -07:00
bjorn 859251d020 Start WebVR rewrite; 2018-05-27 19:05:10 -07:00
bjorn 93e082c8cc WebVR;
- Add FORCE_FILESYSTEM
- Handle THREAD_ERROR event with noop case
- Remove hopefully redundant lovr.graphics.clear in errhand
- Finally use correct type signature for assimpFileTell
2018-05-27 19:05:10 -07:00
bjorn 8702d7422f Rewrite boot.lua, main.c, and exception handling;
There are breaking changes:

- lovr.step is removed.
- lovr.run is expected to return a main loop wrapped in a function.  The
  returned function is run as a coroutine to facilitate a cooperative
  main loop.
- lovr.errhand should return a loop function instead of while true-ing.
2018-05-27 19:05:10 -07:00
bjorn 7e5be11f74 Fix default shader; 2018-05-27 19:05:10 -07:00
bjorn a3a50e5ca7 Ensure arg gets passed to lovr.load; 2018-03-30 18:48:20 -07:00
bjorn 95da07d165 Stereo canvases;
Canvases can be created with the "stereo" flag to make it a stereo
Canvas.  If a Canvas is stereo, everything rendered to it will be
rendered to the left and right halves of it, using left/right
view and projection matrices.  Headset drivers will use stereo
Canvases to improve performance.
2018-03-22 09:57:44 -07:00
bjorn be699aa132 Normal matrix is an array; 2018-03-22 09:57:44 -07:00
bjorn 988d8c7d23 Rename blit to fill; 2018-03-22 09:57:44 -07:00
bjorn 3ed16a0a68 Work around driver bug to fix error screen; 2018-03-22 09:57:44 -07:00
bjorn 20983c860b Send lovrEye to fragment shaders; 2018-03-22 09:57:44 -07:00
bjorn 8b201838b6 Add lovr.graphics.blit for fullscreen quads; 2018-03-22 09:57:44 -07:00
bjorn 4915ca41cc Make skyboxes really cool; 2018-03-22 09:57:44 -07:00
bjorn 8e0519058d Use quad for cube skyboxes; 2018-03-22 09:57:44 -07:00
bjorn 221015677f Nogame screen align; 2018-03-22 09:57:44 -07:00
bjorn ddb22aef0e Refactor headset offset; 2018-03-22 09:57:44 -07:00
bjorn 1f1232505e Uniform buffer objects for matrices;
Still hacky.
2018-03-22 09:57:44 -07:00
bjorn 3064eff017 Hack everything but it mostly works; 2018-03-22 09:57:44 -07:00
bjorn 5a74b8765b Change default window size; 2018-03-22 09:57:44 -07:00
bjorn fdb3a29a05 Add separate x/y scale to lovr.graphics.plane; 2018-03-19 13:09:03 -07:00
bjorn 8be201c040 Add default lovr.threaderror callback; 2018-03-12 10:37:45 -07:00
bjorn 4463bd00c8 Load tangents from models; 2018-02-26 02:54:35 -08:00
bjorn cb7b99f9a6 Optimize skybox rendering;
- Fix winding order of skybox cubemaps.
- Fix skybox image ordering in lovr.graphics.newTexture.
- Change skybox shader to allow rendering cubemap skyboxes last for
  early z rejection.
- Remove overriding of depth write and depth test state for cubemap
  skyboxes.
2018-02-26 02:10:53 -08:00
bjorn 3a36bcceae lovr.mount; lovr.headset.isMounted; isPresent changes;
Remove lovr.headset.isPresent.
Replace Controller:isPresent with Controller:isConnected.
Add lovr.headset.isMounted and lovr.mount callback.
2018-02-25 16:42:31 -08:00
bjorn 4cca193fcb lovr.threaderror callback; 2018-02-23 18:38:52 -08:00
bjorn f010a0ffc2 Basic module setup; 2018-02-23 18:38:33 -08:00
bjorn f75530b9e1 Add support for 2d array textures; Improve mipmaps;
lovr.graphics.newTexture has been changed.
2018-02-20 17:15:47 -08:00
bjorn 5493a980ff Move Blob to lovr.data;
Keep lovr.filesystem.newBlob though...
2018-02-19 21:04:53 -08:00
bjorn 7cecc1489e getCanvas; setCanvas; MRT; MULTICANVAS define; 2018-02-15 19:58:35 -08:00
bjorn cca1f32d10 PBR material properties; 2018-02-11 19:16:40 -08:00
bjorn a14f5734d5 Add lovr.data module; 2018-01-15 23:13:26 -08:00
bjorn f634e17e5c Avoid resetting clock after boot.lua;
Fixes an issue where the initial dt was negative.
2018-01-13 16:00:47 -08:00
bjorn e2c27fb74c Fix lovr.draw arguments; 2018-01-08 18:33:51 -08:00
bjorn aef6345606 Prevent loading of conf.lua outside project directory; 2018-01-05 23:04:47 -08:00
bjorn 662572c4e0 Add boot.lua back; 2017-12-18 16:01:12 -08:00
bjorn 4a2cc56fef Move shaders into resources; 2017-12-10 12:41:43 -08:00
bjorn 2d2a4cf038 Rename data to resources; 2017-12-10 12:41:43 -08:00