Commit Graph

377 Commits

Author SHA1 Message Date
bjorn d4f88f3d8d lovr.log: strip trailing newline in default implementation;
GL debug messages sometimes have newlines...
2020-07-29 14:24:57 -06:00
bjorn e3aa4c7d5d t.graphics.debug flag; 2020-07-28 16:12:15 -06:00
bjorn 55f66f217e Adjust pico SDK version to 27; 2020-07-27 17:09:16 -06:00
bjorn ac58a1aeba Pico: Draw the rest of the owl;
Add entrypoints, headset backend code, fill in the Activity, and
add various special cases to account for the asynchronous render loop,
lack of sRGB support, and OpenGL state resets.
2020-07-27 14:56:21 -06:00
bjorn e7d4e6cf7b Start pico headset backend; 2020-07-27 13:58:52 -06:00
bjorn d25e20fb9d mv AndroidManifest.xml AndroidManifest_vrapi.xml; 2020-07-27 13:47:32 -06:00
bjorn 87b979f51c mv Activity.java Activity_vrapi.java; 2020-07-27 12:50:27 -06:00
bjorn 9abed055d8 lovr.log;
lovr.log is a new callback that is invoked whenever LÖVR wants to
send the project a message.  For example, this could be a performance
warning from the graphics module, an error message from one of the
headset backends, or an API deprecation notice.

The callback's signature is (message, level, tag).  The message is a
string containing the message to log, level is a string that is currently
one of "debug", "info", "warn", "error", and tag is an optional string
that is used to indicate the source of the message for grouping purposes.

The default implementation of the callback just prints the message,
but the callback can be overridden to do things like filter messages,
write them to a file, or even render them in VR.  Projects can also
invoke the callback directly to log their own messages.
2020-07-06 16:20:55 -06:00
bjorn a9aaedae61 rm oculusmobile from t.headset.drivers;
Replaced by vrapi
2020-07-02 20:17:09 -06:00
bjorn 27b04b2bde vrapi: Add support for focus awareness; 2020-06-25 15:00:12 -06:00
bjorn 8b281d56e3 Android: Organize tup rules; Fix manifest; 2020-06-25 13:27:18 -06:00
Josip Miskovic 66d7e887c7 Config parameter for save directory precedence 2020-06-21 18:02:36 +03:00
bjorn a1aa3c8ae8 Finish vrapi driver; 2020-06-09 18:02:03 -06:00
bjorn b34c03bcc8 Tup build system for android; 2020-06-09 18:02:03 -06:00
bjorn 680dc00b5b rm menu button from oculus touch bindings;
Saw an error about this in logs, let's see if it fixes touch controllers.
2020-05-11 18:04:37 -06:00
bjorn 9ba814fe3f omg; 2020-05-04 17:30:41 -06:00
mcc b5e72d8bd9 Restart cookie minor changes for PR review 2020-04-16 10:57:13 -04:00
mcc fbcce7fc59 Reworked quit/restart events (compatibility break)
Based on Slack conversation, the following changes:
- lovr.event.quit("restart") no longer supported
- lovr.event.quit no longer takes restart "cookie"
- When lovr.event.restart() called, lovr.quit() is not called, instead lovr.restart() is called
- Value returned from lovr.restart(), when called, becomes the cookie
- lovr.event.quit takes the lovr.event.quit() return code as an argument

lovr.run() is unchanged, it still returns (exit code | "restart", cookie).
2020-04-16 00:32:54 -04:00
bjorn aed0499c5f Add oculus_touch to action manifest; 2020-04-02 22:47:36 -06:00
bjorn 6f6de92d19 Add preliminary WebXR backend; 2020-03-04 22:47:24 -08:00
bjorn 90b605f012 Add restart cookie; lovr.event.restart; arg.restart; 2020-02-26 14:40:40 -08:00
Bjorn 2f78c29c07
Merge pull request #128 from mcclure/jun28-upside-down-mirror
Y-flip mirror texture on Oculus
2020-02-17 18:02:37 -08:00
mcc 6536216aa2 Fix lovr.graphics.skybox() 2020-02-17 18:19:05 -05:00
bjorn 7f205d2fb1 WebGL shader fix; 2020-02-16 01:32:07 -08:00
bjorn d2f4628791 Add pointer devices; 2020-02-14 19:10:37 -08:00
bjorn 155718d161 shaders: Change abstract parameters to named parameters; 2020-02-11 16:17:54 -08:00
bjorn c502f5b62a Add highp shader flag that sets default fragment precision to highp;
Also, precision qualifier is required to work on desktop GL, so
we don't need ifdefs for it!
2020-02-07 19:44:51 -08:00
bjorn cae8bba522 Remove lovrMain macro;
We want lovrMain to be the entrypoint but we can't figure out how
to do this in a way that wouldn't break things, on all platforms.
2020-02-07 19:25:55 -08:00
Cassie Jones 9845fee2b6 Use different compute #version with OpenGL ES
GLES doesn't like #version 430 for compute, it wants #version 310 es.
We can conditionally compile that.
2020-01-31 06:24:08 -05:00
bjorn a1a53b4bed sampler2DMultiview; textureMultiview; 2020-01-30 17:48:15 -08:00
bjorn 0aa724116e Headset views;
- lovr.headset.getViewCount
- lovr.headset.getViewPose
- lovr.headset.getViewAngles
2020-01-27 22:11:58 -08:00
bjorn 4f7bb9e53e lovr.headset.wasPressed; lovr.headset.wasReleased; 2020-01-24 22:48:36 -08:00
bjorn c7f5406ce2 Make clipping planes consistent across most headset drivers;
The default far clipping plane was changed from 30 to 100 for openvr
and oculus.  oculus_mobile clipping planes can't be changed easily.
2020-01-23 11:25:38 -08:00
bjorn d228dc95d7 Automatically convert binary resources;
- Teach CMake how to compile binary resources to C headers, like xxd.
- Note: tup is already using xxd to do this.
- gitignore binary resource headers to reduce git noise and avoid problematic
  interactions between git and build systems.
2019-12-29 11:25:30 -08:00
bjorn a5db2d6c5c mv appveyor config to resources folder; 2019-12-28 20:13:19 -08:00
mcc c563787f7d Android fixes. Major change is lovrMain() {} is now lovrMain {}
The oculus drivers choke on #define lovrMain()
2019-12-17 20:20:09 -05:00
bjorn 6f24da9f7f Rework Tupfiles;
- One toplevel Tupfile that makes it more clear what happens.
- Add config flags for -Werror, -fsanitize, and separate debug/optimize flags.
- Automatically integrate with libs built by CMake (build folder, rpath, libs folder).
- Disabling modules actually works, only the stuff that's needed is built.
2019-12-13 06:52:57 -08:00
bjorn 488c125c5f Draw the rest of the owl; 2019-12-10 12:19:50 -08:00
bjorn 898a3f9f35 rm double underscores from glsl;
This naming pattern is reserved.
2019-11-28 15:25:19 -08:00
bjorn b69a5ba1a3 Update conf.version;
opps
2019-11-27 20:48:58 -08:00
bjorn 6ad2d8ccef Add lovrMain macro to shaders (no breaking change); 2019-11-18 23:20:08 -08:00
bjorn e32c3ea2df v0.13.0; 2019-10-14 18:21:07 -07:00
bjorn f6cd8120ad Add macOS bundle resources; 2019-10-14 15:23:46 -07:00
bjorn 8c0ae3fbb3 More WebVR (controller) fixes; 2019-10-09 14:54:07 -07:00
bjorn 17dda66b69 boot.lua works without headset module; 2019-10-02 16:20:50 -07:00
bjorn f82bcb703b Finalize skeletal input API; 2019-09-18 16:12:08 -07:00
mcc 38f4204661 Make lovrViewID signed on Oculus Mobile
The "mask" example was failing on Oculus Mobile on the line of glsl:
if (lovrViewID == 1) {
because lovrViewID was unsigned and 1 was signed. One way to fix this would be to replace 1 with 1u as that is unsigned, but this would be the wrong fix because lovrViewID is in fact signed on all platforms other than Oculus Mobile. lovrViewID was depending on platform defined to either gl_ViewportIndex (signed), a signed uniform, or gl_ViewID_OVR (unsigned). The solution is to place an explicit cast in the multiview definition of lovrViewID so that it is signed on all platforms.
2019-09-11 18:22:06 -04:00
bjorn 5ed132635a Fix error screen when headset module is disabled; 2019-09-03 15:34:41 -07:00
bjorn 39376a10d5 normalTexture -> normalMap; 2019-08-31 05:31:20 -07:00
bjorn 9ea785d210 Fix normal matrix;
Now that lighting is in world space.
2019-08-31 03:00:54 -07:00
bjorn 00412e2e79 Add a conf.lua flag for making the window resizable; 2019-08-28 00:59:03 -07:00
bjorn a073206c20 Standard shader: Fix some precision issues in GLES; 2019-08-22 21:57:59 -07:00
bjorn f91eed3834 Rebuild boot.lua.h; 2019-08-20 00:54:36 -07:00
bjorn e6c9fd1a6e rm error screen buttons; 2019-08-19 14:52:56 -07:00
bjorn 2f7743583f Rebuild actions.json.h; 2019-08-19 14:16:37 -07:00
bjorn 584261e21f rm ffi vectors; 2019-08-19 14:13:36 -07:00
bjorn e6bedba0bc Fix OpenVR head pose; 2019-08-17 22:50:35 -07:00
bjorn d3bf51daef Add alphaCutoff shader flag; 2019-08-12 17:38:03 -07:00
bjorn c3af8c14c1 Add uniformScale shader flag;
Used to switch to a faster version of lovrNormalMatrix, can be used
with all shader types.
2019-08-12 17:33:32 -07:00
bjorn 8821ecd340 Standard shader: Tonemap by default; 2019-08-12 02:36:23 -07:00
bjorn 4eb768b13b Fix GLSL type cast; 2019-08-11 18:47:12 -07:00
bjorn 265931e474 Standard shader: Multiply with graphics color;
I guess.
2019-08-11 18:34:16 -07:00
bjorn 51b4064801 Standard shader: Refactoring; 2019-08-11 18:15:43 -07:00
bjorn 3d8313a7f1 Add analytical approximation for specular BRDF lookup; 2019-08-11 17:22:09 -07:00
bjorn 93f076acc9 Fix default uniform values;
Not supported in GLES.
2019-08-09 17:36:14 -07:00
bjorn b8cb53e021 Standard shader: Refactoring; 2019-08-09 17:31:30 -07:00
bjorn 83b2f8d745 Add uniform for controlling light color and intensity; 2019-08-09 00:27:17 -07:00
bjorn 851f5f27ec Add more default headset drivers; 2019-08-09 00:00:42 -07:00
bjorn 30ea8995d2 Fix view vector; 2019-08-07 17:53:38 -07:00
bjorn 2c115ce66e Automatically detect mipmap count for IBL; 2019-08-07 15:56:52 -07:00
bjorn fe939213be Initial standard shader flags;
- normalTexture = true
- indirectLighting = true (requires uniform setup!)
- occlusion = true (only affects indirect lighting)
- emissive = true
- tonemap = true
2019-08-06 14:39:14 -07:00
bjorn b08d9d0b30 Standard shader: Add tonemapping;
ACES.
2019-08-05 15:34:21 -07:00
bjorn 96c47d590c rm lovrEnvironmentTexture from Material; 2019-08-05 15:20:17 -07:00
bjorn e4ab5aa85a Standard shader: Add image-based lighting;
Very WIP, still need to add the BRDF lookup table.
2019-08-05 14:49:09 -07:00
bjorn bff9399308 Rename skinned flag to animated; 2019-08-04 15:08:21 -07:00
bjorn 06fb8b2503 Simplify fill;
lovr.graphics.fill renders a fullscreen quad, it's convenient because
you don't need to set up a mesh and toggle all the pipeline states.

However, if you are dealing with copying/rendering between stereo
textures, you have to write your own shader for that.  For now.
2019-08-03 16:03:13 -07:00
bjorn db57592646 Attempt to display SOME relevant message for 'error occurred while displaying another error' in the luajit-only nonstandard crash path 2019-08-02 20:29:28 -07:00
bjorn e9fd052fc6 Start fixing lovr.graphics.fill; 2019-08-02 15:48:35 -07:00
bjorn aab987dbef Fix WebGL gamma correction;
Ugh, WebGL doesn't have sRGB backbuffers.
2019-08-01 13:26:45 -07:00
bjorn 15cdc78c6b Rebuild xxd files;
xxd on windows is different or something.
2019-08-01 13:01:47 -07:00
bjorn ecac39c08b Add experimental buttons to default error screen; 2019-08-01 00:14:37 -07:00
bjorn 9e8fcc01af Knuckles: Use force sensor as grip axis; 2019-07-31 16:54:56 -07:00
bjorn 78f2060405 rm lovr.headset.getAcceleration, getAngularAcceleration;
Because OpenXR did...
2019-07-30 20:22:08 -07:00
bjorn 9712f4765c lovr.headset.hands is CURSED; 2019-07-30 20:17:38 -07:00
bjorn 4b9e6849c8 Better boolean shader flags; Multicanvas flag;
Instead of boolean shader flags turning into actual booleans defines
in the shader source, for GLSL they turn into defines.  This lets you
use ifdef, which is the more common intended usage.

Also MULTICANVAS is now a boolean shader flag.  The old MULTICANVAS
define is deprecated.
2019-07-28 18:08:23 -07:00
bjorn f564444641 Fix some WebGL issues; 2019-07-28 17:28:18 -07:00
mcc d391a4750f Use base diffuse color from materials in Standard shader 2019-07-25 15:08:53 -07:00
bjorn 2b19c64aca rm primary DeviceButton and DeviceAxis;
It is confusing and doesn't really solve the intended problem very well.

For now we will all just suffer with our tedious device-specific Lua code.
2019-07-17 17:33:21 -07:00
bjorn a5326d530a LuaJIT: Fix quaternion __newindex; 2019-07-16 22:52:34 -07:00
bjorn db519f7f53 mat4:scale: Allow for a single argument in LuaJIT; 2019-07-16 22:02:18 -07:00
bjorn 122143b13a vec4; 2019-07-16 20:30:51 -07:00
bjorn 9156fa2cbf Vector rework; 2019-07-16 20:30:51 -07:00
bjorn 348798b86c Make shader in nogame screen more correct; 2019-07-02 20:12:24 -07:00
mcc dc98846169 Fix error screen on Android
As discussed in slack, lovr.errhand appears to predate lovr.graphics.hasWindow() and does not use it. This resulted in a crash on Oculus Go
2019-07-02 18:45:08 -07:00
bjorn d3f08fd1f0 rm logo.png; 2019-06-29 18:28:20 -07:00
bjorn b2df3e9816 Update nogame screen;
- Slightly dim background color (may change).
- Use a shader for the logo (it's centered now, not quite 100% like the image).
- Adjust text optical weight (I hate it).
2019-06-29 18:27:55 -07:00
bjorn e82ba030a6 lovr.headset.getDisplayTime;
Returns the predicted display time, which is the estimated time at which
the photons of the next frame will hit the eyeballs of a person in the HMD.

This should be used instead of lovr.timer.getTime when used for rendering
something that is time-dependent.  Updating simulations, logic, or access
to high frequency times should still use lovr.timer.getTime.
2019-06-29 17:36:36 -07:00
bjorn 8faff22f38 Regenerate math.lua.h; 2019-06-28 22:07:31 -07:00
mcc c604149428 Y-flip mirror texture on Oculus
Oculus gives us the mirror texture "upside down" compared to every other driver, so flip it rightside up before drawing in boot.lua.
2019-06-28 22:46:23 -04:00
bjorn d87fc56b63 lovr.headset.getDisplayMask; 2019-06-28 00:13:45 -07:00
bjorn 4222be88b5 Use UBO for Camera matrices;
Ugh I don't like the "Camera" concept anymore, but I can't figure
out how to easily get rid of it.  Maybe wait till displays are a thing.
2019-06-27 22:17:50 -07:00
bjorn 928ccee5f1 Multiview; 2019-06-25 01:21:59 -07:00
bjorn 807c519397 Fix typo; 2019-06-20 21:36:07 -07:00
bjorn b6d65922af Standard shader: spherical harmonics irradiance; 2019-06-20 21:17:32 -07:00
bjorn 286cb711e4 Standard shader: emissive; 2019-06-20 18:22:49 -07:00
bjorn a9241e781b Standard shader: emissive; 2019-06-20 18:20:07 -07:00
bjorn 179071023f Standard shader: diffuse, specular, normal mapping;
No shader flags yet.  Still need occlusion, emissive, configurable
lighting, IBL.
2019-06-20 17:46:22 -07:00
bjorn 4611b1c9a3 Add no-op standard shader; 2019-06-20 14:21:35 -07:00
bjorn 612f699aa4 Rename default shader to unlit; 2019-06-20 14:09:55 -07:00
bjorn f8f6d98df4 Use better default for identity quat; 2019-06-14 15:04:17 -07:00
bjorn 9e42fe295a math.lua: Fix vec3:sub; 2019-06-14 13:30:07 -07:00
bjorn de6d3dab5b Add tup build system;
It's still a rough draft and likely only works on my machine, but can be
improved over time.

Rough explanation:

- tup.config contains high-level build configuration defaults.
- Tuprules.tup contains mostly compiler flags (generated from the
  tup.config) and declares some macros used to compile code.
- Tupfile takes all generated object files and links them into the
  lovr executable.
- src/Tupdefault defines the default build steps for src and all
  subdirectories, which is to compile all .c files to .o files and put
  them in the <objects> bucket for linking by the toplevel Tupfile.

It's possible to have multiple configs active at once for different
platforms, projects, etc.  To do this, create a folder for each build
variant you want, and place a tup.config in each folder (it can be a
symlink, which is helpful).  Then, invoking `tup` will build all your
variants, or you can build a specific one by doing `tup <foldername>`.
2019-06-10 04:06:22 -07:00
bjorn e9853ed3c7 t.math.ffi conf flag; 2019-06-10 00:11:20 -07:00
bjorn 0b5c609264 Add OpenVR touch bindings;
Untested.
2019-06-06 01:10:50 -07:00
bjorn 06c6b172de vec3 has 4 elements; 2019-06-03 07:20:03 -07:00
bjorn 31e086edaf Inline all the maf functions; 2019-06-03 07:19:25 -07:00
Bjorn Swenson 68c1b6a201
Merge pull request #122 from bjornbytes/hand-updates
Hand updates
2019-06-03 00:14:45 -07:00
bjorn 575552a147 Restart hotkey works on default error screen; 2019-06-02 03:29:34 -07:00
bjorn 374492c586 Add experimental hotkeys flag;
- Add t.hotkeys flag to conf.lua, which defaults to true.
- If t.hotkeys is truthy, the following hotkeys will be enabled:
  - Escape: Quit the experience
  - F5: Restart the experience
2019-06-02 03:00:12 -07:00
bjorn 84bd50379d Add primary button/axis;
It's called "primary".
2019-05-31 12:00:15 -07:00
bjorn af0678f9e9 rm DEVICE_HAND;
If we expose both unhanded hands and handed hands, people need to
deal with handling (haha) both cases in their apps.  It's simpler
to always deal with left and right hands, even though it is a bit
less general.  Still, this is congruent with the current state of
OpenVR and OpenXR, and I think there are still open questions about
the more uncommon cases where there are more than two hands.
2019-05-31 10:41:40 -07:00
bjorn 06e3ef702c Add built-in ShaderFlag for skinning vertices;
Now you can pass in the { skinned = true } flag when creating a Shader
to get skinning behavior without needing to write it yourself.  The
default is still false.

Need to profile to make sure the if is getting optimized out.
2019-05-28 03:43:54 -07:00
bjorn b26e29cb7b Fix more LuaJIT math casts; 2019-05-24 20:54:38 -07:00
bjorn 831ebda303 Fix LuaJIT Pool integration; 2019-05-24 20:39:05 -07:00
bjorn 1335ab55ae Warnings/cleanup; 2019-05-20 03:41:12 -07:00
bjorn 4a47afca38 Organize api folder; 2019-05-19 00:31:42 -07:00
bjorn 6134abe866 Handle vsync better;
- Add vsync flag to t.window and lovr.graphics.createWindow.
- vsync is 1 by default.
- Some headset drivers override vsync if they have special timing requirements.
2019-05-14 00:18:22 -07:00
bjorn 51ce0c1418 rm compat; 2019-05-12 22:28:02 -07:00
bjorn 7c2a119324 SteamVR Input 2019-05-12 22:23:28 -07:00
bjorn 6ff35420bd More leap fixes;
Also reduce branching in headset accessors.
2019-05-12 22:23:28 -07:00
bjorn 26c1859531 Update WebVR; 2019-05-12 22:23:28 -07:00
bjorn 9382afb94d Put controller models back on nogame screen; 2019-05-12 22:23:08 -07:00
bjorn 89ccf750ba Start compat system; 2019-05-12 22:23:02 -07:00
bjorn da6fd4d07c Remove Controllers; 2019-05-12 22:22:29 -07:00
bjorn 8208238df7 Support multiple tracking drivers;
Now the lovr.headset module initializes one display driver (the
first one in the list) and multiple tracking drivers.  Only drivers
that implement 'renderTo' will be considered for display driver.

Tracking drivers are stored in a linked list, and retrieving pose
information involves trying all of the tracking drivers until the
pose is found.
2019-05-12 22:21:06 -07:00
bjorn c9775c84ac Remove t.gammacorrect flag;
Gamma correct rendering is core in all supported OpenGL versions,
and it's usually a good idea to enable it.
2019-05-03 17:53:33 -07:00
bjorn ed92c4e6db font:setFlipEnabled(false) in lovr.errhand;
To prevent text from being upside down if you flipped the default font.
2019-04-13 15:40:47 -07:00
bjorn 59e4a5bb8e Oops, re-enable graphics module in boot.lua;
Also change format of message.
2019-04-08 05:18:28 -07:00
bjorn 0f6bcad90b Nogame screen works without the graphics module; 2019-04-08 03:25:45 -07:00
bjorn a28b333899 Split draw data stream into two streams;
Also the max number of draws can be hardcoded to 256 now.
2019-04-05 00:49:50 -07:00
bjorn 94ac64e7f4 Add std140 layout qualifier to DrawData block; 2019-03-13 09:20:33 -07:00
bjorn cf5ad64deb WebVR: Use new dynCall syntax for function pointers; 2019-03-09 03:00:50 -08:00
bjorn d45e56146a Rename fake to desktop; 2019-03-06 23:02:47 -08:00
bjorn 0cba1ba28d lovr.audio.getPose; lovr.audio.setPose; 2019-02-17 18:26:56 -08:00
bjorn 1d3b05a515 Make bone IDs unsigned for WebGL; 2019-02-14 09:49:31 -08:00
bjorn 7c6accf856 Rebuild boot.lua; 2019-02-13 23:48:50 -08:00
bjorn a081ab8aed Update lovr.headset in the error screen; 2019-02-13 20:37:06 -08:00
bjorn 6b323e3476 Start parsing glTF; 2019-02-13 15:10:52 -08:00
bjorn f53f64933c WebGL fixes; 2019-02-08 10:32:05 -08:00
bjorn 4a25a0120f Vector rework; 2019-02-08 08:13:47 -08:00