Commit Graph

80 Commits

Author SHA1 Message Date
bjorn d1dc2f3199 rm pico;
Notes:

- We can actually use a single Activity.java file for oculus/pico now
- We can unconditionally compile os_android.c on Android
- No need for including extra jars in build system
- Headset rendering is guaranteed synchronous now, no need to ref L
- Add an "android flavor" build setting to differentiate between oculus
  and pico devices, since they both use OpenXR.
- Update the pico manifest to reflect their OpenXR sample
- Remove some OpenGL hacks that aren't necessary anymore
2022-03-22 16:03:21 -07:00
bjorn f1cc668298 rm vrapi; 2022-03-22 16:02:45 -07:00
bjorn 4f39f4f68f rm oculus; 2022-03-22 16:02:45 -07:00
bjorn b9889ca97a rm openvr; 2022-03-22 16:02:45 -07:00
bjorn 0c17046847 Add eye/gaze device;
This provides an accurate pose for what the user is looking at, instead
of the poses of the individual eyes.  Supported on some OpenXR
implementations.
2022-03-21 15:05:23 -07:00
bjorn fdfcb5539f Merge branch 'master' into dev 2022-03-14 13:19:59 -07:00
bjorn 54154a643a Thumbrest support; 2022-03-06 17:43:04 -08:00
Josip Miskovic 2e5c529faf Return nil if device doesn't have that button
Functions `lh.isDown()` and `isTouched()` should return nil if device
doesn't have the queried button.
2022-03-06 17:41:33 -08:00
bjorn b22dbd8f0c Add luax_checku32 and luax_optu32;
These functions read an unsigned 32 bit integer from the Lua stack
and error if the value is negative or too big.  Currently converting
Lua numbers to integers will silently wrap or invoke undefined behavior
when they are outside of the acceptable range.

For projects that don't want the overhead of type/bounds checks, the
supercharge build option (LOVR_UNCHECKED) can now be used to skip all
type/bounds checks.
2022-02-21 14:19:24 -08:00
bjorn 6f3e46d8cf Fix some pointer formatting; 2022-02-02 12:01:38 -08:00
bjorn 7ed47e946b Fix problem when requiring audio/graphics/headset in threads;
These modules access the conf table, which isn't available on threads.
2022-01-16 12:13:46 -08:00
bjorn 88000579ff Don't call start on tracking drivers;
Start is mainly used for setting up graphics-related stuff, since it
was created to perform setup after the window/graphics module is
initialized.  Since the display driver is the only one doing rendering,
it makes sense to only call start on the display driver.

...also fixes a bug where start is getting called twice.
2021-06-16 16:15:08 -06:00
bjorn 92400df89d lovr.headset.init -> lovr.headset.start;
- We need some headset initialization to happen upfront
- But we still want some delayed initialization for when graphics is ready
- Go back to headset initialization happening when module is required
- Add lovr.headset.start that can be used for post-graphics init
2021-06-10 17:26:15 -06:00
Jakob Bornecrantz 70ef04e595 Add overlay parameter to headset init 2021-04-16 14:20:05 -06:00
bjorn e63099ba6a Flatten api.h; 2021-03-15 18:54:27 -06:00
bjorn 6d92d54079 Try having arr_t in util; 2021-02-08 18:25:05 -07:00
bjorn bc4cde1653 Adjust lovrRelease signature; 2021-02-08 17:52:26 -07:00
bjorn 3ded60948f rm core/ref; rm lovrAlloc; util does refcounting; 2021-02-08 17:26:44 -07:00
bjorn 709a41a352 Do more rendering work when lovr.draw is missing;
- The lovr.headset.renderTo callback can now be nil, causing an empty frame to be submitted to the compositor.
- lovr.mirror will still be called if lovr.draw is nil.  This means the window will be (correctly?) cleared to the background color now if lovr.draw is nil.

This prevents runtimes from thinking the app is missing/unresponsive when lovr.draw is absent.  To get the old behavior, just don't call lovr.headset.renderTo.
2021-02-05 15:03:06 -07:00
Bjorn 1513191660
Merge pull request #335 from bjornbytes/trackers
Support Vive Trackers;
2020-12-10 21:49:26 -07:00
Nevyn Bengtsson dfacb6408b on lodr restart, make sure lovr.headset is nil'd if none is available
In boot.lua, it assumes that lovr.headset.init will assert if no driver
is available. This was previously only true on the first call to it,
since after it's initialized, it'll just return early and won't assert.
This will later crash since your lua code will now see a lovr.headset
being available, but calling anything in it will crash since
lovrHeadsetDisplayDriver is NULL

After this fix, initialized becomes false before boot sets up the
headset module again, so that the assertion fires correctly.
2020-11-20 10:04:01 +01:00
bjorn ad42609b1d Support Vive Trackers; 2020-11-19 00:39:38 -07:00
bjorn 0388213be4 Reset camera after lovr.headset.renderTo; 2020-10-02 19:50:00 -06:00
bjorn 51f470cf85 Easier enums; 2020-09-27 17:13:00 -07:00
bjorn caca0ef71c t.headset.supersample;
Can be used to change the size of the headset texture that gets
submitted to the VR runtime.  It can be a boolean or a number.
2020-09-25 15:41:30 -07:00
bjorn 7617da0ec1 Move headset initialization to lovr.headset.init;
OpenXR basically has a hard requirement that a graphics API is available
before its session can be created.  Currently the graphics module isn't
always around when headset initialization takes place.  Polling the
graphics availability in update/renderTo has some consequences for calls
made to the headset module in lovr.load or during the first few frames.

So instead we're going to delay headset initialization to a special
function that is called after modules are required.  It can also be
called manually if the window creation is delayed.
2020-08-26 13:42:42 -06:00
bjorn 3cb291c866 rm leap motion driver;
Planning on using the new Ultraleap OpenXR API layer.  It's possible
that this will be added back if that doesn't work out.
2020-08-22 14:05:40 -06:00
bjorn 6cadcea65d WebXR updates;
- Make the renderloop synchronous by hijacking the RAF to run on the
  XRSession when active.
- Convert os_web to use emscripten's native HTML5 interface instead
  of going through GLFW.
- Stop using preinitialized GL context -- lovrPlatformCreateWindow
  now creates the context.
- GLES2/3 emulation is not necessary.
- Remove inline sessions.  The VR simulator is used to render to the
  Canvas instead.  webxr_attach and webxr_detach are used to replace
  replace the active headset driver with the webxr driver when an
  immersive session starts.
- Add noop desktop_getSkeleton.
2020-08-20 13:28:07 -06:00
bjorn ec257b179f Support Lua 5.2, 5.3, 5.4; 2020-08-19 13:12:57 -06:00
bjorn 65470f1e0e Update webxr driver; rm webvr; 2020-08-16 00:31:20 -06:00
bjorn 1b5e7b2203 vrapi_getSkeleton; 2020-08-12 15:47:10 -06:00
bjorn 7e941cd22f lovr.headset.animate; Animated OpenVR controller models;
- lovr.headset.newModel accepts an optional options table as the
  second argument.  There is currently a single option named
  'animated' that can be used to request an animatable model.
  Currently it isn't clear if this should be a hint or not.
- lovr.headset.animate (name pending) can be called with a device
  and a model (usually with an animated model from headset.newModel,
  but this is not required).  The function attempts to animate the
  Model to match the pose of the device in an opaque driver-specific
  way, and returns whether or not this was successful.
- OpenVR has models for controllers with a system called "components"
  that can be used to animate the individual buttons.  Now the OpenVR
  headset driver implements the 'animate' function to make use of the
  controller components, to easily load and render animated controllers.
2020-08-05 15:05:59 -06:00
bjorn f1b447662d Fix lovr.headset.getDriver when passed a Device; 2020-08-04 12:19:22 -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 b0b9e38da6 Pico: add pico jar and missing DRIVER_PICO enumerant; 2020-07-27 14:25:57 -06:00
bjorn 9777306b70 rm oculus mobile; 2020-07-02 10:46:10 -06:00
bjorn a1aa3c8ae8 Finish vrapi driver; 2020-06-09 18:02:03 -06:00
bjorn 0be36da334 Add beacon devices;
There are 4 new devices: beacon/1 through beacon/4.  They represent
tracking reference like StemaVR base stations or Oculus cameras.
There are 4 because that's how many base stations you can have in
a single tracking setup.

Right now only OpenVR exposes poses for them.
2020-05-07 17:11:25 -06:00
bjorn 6f6de92d19 Add preliminary WebXR backend; 2020-03-04 22:47:24 -08:00
bjorn 18dcb07b98 Convert stuff over to use new enum system; 2020-02-16 18:31:02 -08:00
bjorn d2f4628791 Add pointer devices; 2020-02-14 19:10:37 -08:00
bjorn e218733ee2 Make splay axis 1D; 2020-02-13 15:18:12 -08:00
bjorn 5197d30b94 Add getSkeleton; 2020-02-13 15:08:59 -08:00
bjorn 0e4c42c8b0 Add pinch axis; 2020-02-13 15:08:58 -08:00
bjorn 71e63ddac2 openvr: add curl/splay axes for finger devices; 2020-02-13 15:08:58 -08:00
bjorn d448bdc95c Finger devices/axes; OpenVR finger poses; 2020-02-13 15:08:58 -08:00
bjorn 7edb562732 Add lovr.headset.getTime;
Unlike lovr.timer.getTime, this is the predicted time at which the
current frame will be displayed.  It can be used in place of
lovr.timer.getTime for smoother animations.  It's unclear if this
could be used for a suitable replacement for dt though.
2020-02-09 11:26:23 -08:00
bjorn f89998b21f Add eye/left and eye/right devices;
Currently nobody returns data for them, though headset drivers could
start to provide poses estimated from the head pose and IPD info.

This also makes it easier to integrate eye tracking later.
2020-01-29 17:53:03 -08:00
bjorn 0aa724116e Headset views;
- lovr.headset.getViewCount
- lovr.headset.getViewPose
- lovr.headset.getViewAngles
2020-01-27 22:11:58 -08:00
bjorn 7ca23bc58a lovr.headset.getDisplayFrequency; 2020-01-24 23:06:30 -08:00