Commit Graph

152 Commits

Author SHA1 Message Date
bjorn d448bdc95c Finger devices/axes; OpenVR finger poses; 2020-02-13 15:08:58 -08:00
Nevyn Bengtsson f2d5824a2b desktop: fix wasPressed/wasReleased 2020-02-13 18:28:02 +01:00
bjorn 443376efde ModelData: Use union for transform fields;
Nodes can have either a transform matrix, or decomposed transform
properties, but never both.  Using a union means we can store both
of those variants in the same piece of memory, using the existing
matrix boolean to figure out which one to use.

This reduces the size of the struct by 48 bytes (152 -> 104), which
ends up speeding up some model operations, I'm guessing due to the
CPU cache.
2020-02-11 16:38:31 -08:00
bjorn c1e231e756 oculus_mobile: Expose bounds dimensions; 2020-02-08 03:32:50 -08:00
bjorn adcbe6d707 oculus_mobile: Expose button changed states; 2020-02-07 23:01:01 -08:00
bjorn 8d22935c60 oculus_mobile: lovr.headset.getDisplayFrequency; 2020-02-07 22:21:32 -08:00
bjorn 02a73f333e oculus_mobile: respect t.headset.msaa; 2020-02-07 22:09:47 -08:00
bjorn 723f5684cf Fix mat4_fov and desktop driver projection;
OpenVR may need updating now, but at least we know what the correct
approach is now.
2020-02-06 17:32:44 -08:00
bjorn d971749b85 oculus_mobile: Fix vrapi_getView* signatures; 2020-01-30 17:09:06 -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 9ea76fac7b rm placeholder getFov code; 2020-01-29 17:09:23 -08:00
bjorn 0aa724116e Headset views;
- lovr.headset.getViewCount
- lovr.headset.getViewPose
- lovr.headset.getViewAngles
2020-01-27 22:11:58 -08:00
bjorn b19a391c32 desktop: emit focus events; 2020-01-27 21:10:27 -08:00
bjorn 7ca23bc58a lovr.headset.getDisplayFrequency; 2020-01-24 23:06:30 -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 8c429e89ac Fix -Wshadow; 2020-01-23 11:18:04 -08:00
Nevyn Bengtsson 95edb43654 TextureData: holds Blob instead of being Blob, just like SoundData
also replaces TextureData:getPointer with TextureData;getBlob
2020-01-19 22:59:44 +01:00
bjorn da88766e5a oculus_mobile: Discard depth/stencil buffers after rendering;
This was present in lovr-oculus-mobile.
2020-01-14 18:46:00 -08:00
bjorn 541400e0fe oculus_mobile: Create framebuffers from bridged swapchain textures;
This is a change that shifts the responsibility regarding the creation
of OpenGL framebuffers from vrapi-provided swapchain texture handles.
Previously, the LovrApp component of lovr-oculus-mobile was creating
framebuffers and passing native framebuffer IDs to lovr.  With this
change, lovr-oculus-mobile passes vrapi's swapchain textures to lovr
unmodified.  This allows lovr to create canvases using its conventional
method and also means that the properties of the canvases are no longer
hardcoded, so things like resolution and multisampling can be
customized.

There were also some issues with multiview canvases in LÖVR due to some
misconceptions about how multisampled multiview rendering works.  These
issues have also been fixed in this commit.
2020-01-14 18:26:01 -08:00
Jason Dogariu 163367a3ba rm pragma pack to fix OpenVR on Linux and Mac 2020-01-01 17:34:45 -05:00
bjorn 12fcaffc3b Slight update to lovrDirSep;
Macro instead of global variable.
2019-12-29 10:30:26 -08:00
bjorn 79fd5ad7d8 Name boot.lua chunk properly;
This makes error messages nicer.
2019-12-28 23:18:03 -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 e2d8f8c645 platform -> os;
The function names are staying the same for now.
2019-12-13 19:55:46 -08: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 2f9400a5f7 Adjust includes; 2019-12-10 13:01:28 -08:00
bjorn b518a4c983 rm misc physfs; 2019-12-10 12:38:06 -08:00
bjorn bc948e7ea5 rm trailing whitespace; 2019-12-05 13:40:05 -08:00
bjorn c031c0c578 Fix comment; 2019-11-18 03:37:42 -08:00
bjorn d21911d010 Add core/map hash table; rm lib/map; 2019-10-30 00:07:05 -07:00
bjorn b35ebc15b6 rm LOVR_USE_SSE;
It doesn't really improve performance on an average LÖVR app and
isn't worth the complexity.
2019-10-22 16:46:54 -07:00
Nevyn Bengtsson e35a5435ca update leftHandTransform in desktop_update
to be consistent with how headTransform is calculated.

also, rename ‘transform’ to ‘headTransform’ for consistency.
2019-10-15 21:50:28 +02:00
Nevyn Bengtsson cb75b387e5 Desktop driver: Move left controller with mouse 2019-10-14 10:08:12 +02:00
bjorn 8c0ae3fbb3 More WebVR (controller) fixes; 2019-10-09 14:54:07 -07:00
bjorn eb83962fc6 OpenXR fixes; 2019-10-02 16:29:09 -07:00
bjorn f4c6e9bd12 oculus_mobile: set error callback based on current coroutine;
Currently:

- load/update/run/etc. take place on the boot.lua coroutine.
- draw happens "asynchronously" on the main thread.

When C needs to throw an error, it doesn't know which thread to
throw the error on.  If it throws it on the wrong thread, you get
a crash instead of an error screen.

One way to fix this is to change the error context based on the
thread that's currently running, so that errors in C are thrown
on the correct thread.  This is the approach that's taken here.

A potentially better approach would be to run all the code on the
same thread, but I ran into issues when I tried to do this.

It may also be possible to (ab)use the Lua panic handler to catch
errors on one of the threads and somehow forward them to the other.
2019-09-26 18:46:19 -07:00
Bjorn d23f2f5810
Merge pull request #151 from sophiabaldonado/oculus-mobile-fix-error-screen
Throw lua errors in the error handler
2019-09-26 18:44:05 -07:00
mcc dc92eb5c58 Oculus mobile vibrate() returns false on illicit second call; style changes 2019-09-26 19:32:12 -04:00
mcc 4a41f98562 Vibrate function for Oculus Quest, first pass
Only does "simple" vibrate (hard on/off). Supports duration but not frequency. Requires a corresponding commit in the lovr-oculus-mobile repo.
2019-09-26 18:40:04 -04:00
sophia ef84a16716 Throw lua errors in the error handler; 2019-09-24 12:04:36 -07:00
bjorn e96c541244 Multithreaded builds on Windows; Formatting; 2019-09-18 16:12:08 -07:00
bjorn f82bcb703b Finalize skeletal input API; 2019-09-18 16:12:08 -07:00
mcc 785c7c722b Oculus mobile: Promote Lua print() statements to INFO
This means Lua print() statements can be uniquely filtered out vs anything else (because internal Lovr logging uses loglevel DEBUG and lovr errors use loglevel WARN).
2019-09-11 19:43:44 -04:00
bjorn f97031a8ec Fix Android print with multiple arguments; 2019-08-26 16:19:58 -07:00
bjorn 13655d0df4 Simplify logging; 2019-08-21 19:02:02 -07:00
bjorn cd09e1e695 rm sds; 2019-08-21 16:30:20 -07:00
bjorn 8d4760167f luax is now api; 2019-08-21 15:27:26 -07:00
bjorn 3050d70f3d Slightly better OpenVR head pose; 2019-08-19 14:55:28 -07:00
bjorn e6bedba0bc Fix OpenVR head pose; 2019-08-17 22:50:35 -07:00
bjorn 017dd15c78 Update OpenXR to 1.0;
Still untested, gib runtimes pls.
2019-08-03 19:06:57 -07:00
bjorn 7690db28af Windows: Fix all the int warnings; 2019-07-31 17:51:49 -07:00
bjorn c384d54aa5 OpenVR: Default haptic frequency to 1Hz; 2019-07-31 17:17:41 -07:00
bjorn 78f2060405 rm lovr.headset.getAcceleration, getAngularAcceleration;
Because OpenXR did...
2019-07-30 20:22:08 -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 9156fa2cbf Vector rework; 2019-07-16 20:30:51 -07:00
mcc 39f8203442 Don't reset camera position of desktop driver on reset 2019-07-16 20:27:45 -07:00
bjorn 3c07ad6b0b Replace Animator with Model:animate; 2019-07-10 22:08:19 -07:00
bjorn 4372eb293e rm comma operator;
everyone is making fun of me haha
2019-07-10 18:46:51 -07:00
mcc 070892ee12 Fix crash with lovr.event.quit("restart") on Oculus Mobile
Because of how and when draws occur in our Oculus Mobile path, during a restart it would attempt to draw a frame after lovrGraphicsDestroy() is called, leading to a crash in lovrGraphicsSetCamera(). This blocks draws until the restart is finished and renderTo() has been called (conveniently detectable using the existing state.renderCallback).
2019-07-10 16:10:02 -07:00
bjorn f2feda9420 oculus: Remove offset;
Since we are calling SetTrackingOriginType with floor level, we don't
need to apply the seated-level t.headset.offset adjustment.
2019-07-05 01:05:02 -07:00
mcc 1b085a00ea As discussed in slack, Oculus should be letting lovrCanvasCreate decide whether to double 2019-07-02 13:28:36 -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 d87fc56b63 lovr.headset.getDisplayMask; 2019-06-28 00:13:45 -07:00
bjorn adf5e69ea1 oculus: Remove unused variable; 2019-06-26 14:51:32 -07:00
mcc fc90a03584 Fix MSVC-specific warnings 2019-06-25 19:16:48 -07:00
mcc 430fbc27d5 ovrHand -> ovrHandType in oculus.c. We don't understand how this worked before but it fixes the oculus-windows build. 2019-06-25 19:16:48 -07:00
bjorn 010bbff519 openvr: Fix stereo Canvas dimensions mismatch;
(The width is automatically doubled when stereo now)
2019-06-25 19:15:38 -07:00
bjorn 749774e2fc Native texture depth must be explicitly specified;
To fix validation errors when attaching them to Canvases.
2019-06-25 18:57:18 -07:00
bjorn 7e65116add Fix oculus backend; 2019-06-25 18:16:54 -07:00
bjorn a3d5371d01 rm lib/vec/vec from oculus.c; 2019-06-25 18:07:56 -07:00
bjorn 928ccee5f1 Multiview; 2019-06-25 01:21:59 -07:00
bjorn 8d2f005bf3 Add stdlib.h to oculus_mobile; 2019-06-21 11:28:40 -07:00
bjorn 7ebee200ea rm strdup;
It isn't part of C, causing compiler errors on some platforms.
2019-06-20 22:21:31 -07:00
bjorn 879c789a08 Polyfill M_PI;
It technically isn't part of C, which is causing problems on some systems.
2019-06-20 21:43:40 -07:00
bjorn eb1e257209 Add new array implementation; Upgrade filesystem;
Filesystem:

- Uses streaming file IO.
- Uses less memory when requiring files.
- Simplifies its require path implementation.
2019-06-16 13:30:30 -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 0b5c609264 Add OpenVR touch bindings;
Untested.
2019-06-06 01:10:50 -07:00
bjorn 5551f76557 Reset render data when restarting in oculus_mobile;
Fixes a crash where rendering would occur with the old Lua state
after a restart.
2019-06-05 20:23:21 -07:00
bjorn c0f4e2848b Update android build; 2019-06-05 20:22:51 -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 dc34ed4570 Start to trend towards 4-element arrays for vec3;
It will be important for enabling more SIMD.
2019-06-02 20:35:52 -07:00
bjorn cf7a738a9f Fix openvr.c; 2019-06-02 02:27:19 -07:00
bjorn 22fe333150 Update refcounting (again);
- Ref struct only stores refcount now and is more general.
- Proxy stores a hash of its type name instead of an enum.
- Variants store additional information instead of using a vtable.
- Remove the concept of superclasses from the API.
- Clean up some miscellaneous includes.
2019-06-02 01:02:26 -07:00
bjorn 84bd50379d Add primary button/axis;
It's called "primary".
2019-05-31 12:00:15 -07:00
bjorn 7ac3d6938b rm TRACKER devices for now;
This is not the correct way to expose them.  It doesn't seem like
there is consensus on how to expose them yet.  At the very least
LÖVR should instead use the hardcoded OpenVR tracker paths like
/camera, /keyboard, /foot/left, /foot/right, etc.

See these issues:

- https://github.com/ValveSoftware/openvr/issues/1030
- https://github.com/ValveSoftware/openvr/issues/962
2019-05-31 10:57:29 -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 fe559903e1 Oculus Go controller has handedness; 2019-05-31 10:37:43 -07:00
mcc 1449d4c914 Oculus mobile: Support getAcceleration 2019-05-28 18:59:05 -04:00
mcc f4189d13e8 Oculus Mobile fixes: Fix potential crash, fix touches on Go after Quest changes 2019-05-26 11:17:49 -04:00
mcc 991b35a628 Oculus mobile: revamp bridge to support Oculus Quest 2019-05-26 10:29:42 -04:00
bjorn 0b8bc4145e openxr: Begin the session at the correct time; 2019-05-25 20:15:42 -07:00
bjorn 4cc154fdfa More number conversions; 2019-05-20 20:35:07 -07:00
bjorn e4c32d2f08 Fix oculus_mobile api.h include; 2019-05-20 15:17:38 -07:00
bjorn a9972a88de Fix oculus_mobile_bridge include path; 2019-05-20 15:15:10 -07:00
bjorn e8a8f6718e Fix vrapi_getAxis; 2019-05-20 15:13:05 -07:00
bjorn df6b7fc96a Ref is mostly private now;
It's really nice how objects don't need to care about how they're
allocated/managed now.
2019-05-20 15:09:06 -07:00
bjorn 67ddefd0c2 Ensure platform functions have prefix; 2019-05-20 04:02:25 -07:00