Commit Graph

728 Commits

Author SHA1 Message Date
Nevyn Bengtsson 033817bd74 audio capture stubs 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 5c2e270c3f audio: clean up some magic numbers 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 407742e8b5 make Source:setSpatial a constructor option instead 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 8403c9bd70 just a super dummy spatializer 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson 01b8a6baa6 spatializer hooks to mixer 2021-02-08 16:08:29 -07:00
Nevyn Bengtsson fe8a6e8612 expose Source:{get|set}Spatial 2021-02-08 16:08:29 -07:00
bjorn 533939e673 Source:getDuration; Source:get/setTime; 2021-02-08 16:08:29 -07:00
bjorn 70839535f3 WIP; 2021-02-08 16:08:29 -07:00
bjorn 121a4f7108 Start spatialization and data conversion systems; 2021-02-08 16:08:29 -07:00
bjorn 1eb4070c92 Mixing; 2021-02-08 16:08:29 -07:00
bjorn 205e9404e0 Looping, playback; 2021-02-08 16:08:29 -07:00
bjorn c92b47e3a6 Another miniaudio attempt WIP; 2021-02-08 16:08:29 -07:00
bjorn ed09bc3cfa rm unnecessary newlines in assert messages; 2021-02-07 16:58:50 -07:00
bjorn 1dd692a009 lovrPlatformGetWindow -> lovrPlatformGetWin32Window; 2021-02-07 16:57:08 -07:00
bjorn 323436898a Add WIN32_LEAN_AND_MEAN; 2021-02-07 16:49:34 -07:00
bjorn d2ff6c29ac Change inclusive module defines to exclusive;
This reduces the number of flags needed to get a regular build.
2021-02-07 16:45:03 -07:00
Christoph Haag 394759c1ab initialize XrSystemProperties type 2021-01-22 15:43:01 +01:00
bjorn f1a5887133 WIP holographic_controller bindings; 2021-01-08 21:18:03 -07:00
bjorn b356ce2546 Plugins;
- The plugins folder can contain native plugins.
- CMake will build plugins with CMakeLists in them
  - They can check the LOVR variable to see if they are being built inside LOVR.
  - They can set the LOVR_PLUGIN_TARGETS variable to a list of targets they build.
    - If blank, all non-imported targets added in the folder will be used.
  - The libraries built by their targets will be moved next to the executable or into the apk.
- The library loader now tries to load libraries next to the executable or in the APK.
  - It is "fixed function" now, this may be improved in the future.
- The lovr.filesystem C require path has been removed.
- enet and cjson have been removed.  Use plugins.
2020-12-28 12:37:35 -07:00
bjorn 30e01f94a3 Upgrade stb_image; rm stb_image threadlocal patch;
stb_image's vertical flip flag was not thread safe in the version
of stb_image we were using.  We patched stb_image to use a thread
local variable for the flag.  stb_image has since been upgraded to
expose a thread local version of the flag, so our patch is no longer
necessary after upgrading.

The CMake flag to enable the thread local patch did not make very much
sense because thread local stuff is unconditionally used elsewhere.
2020-12-25 16:43:25 -07:00
bjorn 6cf74a976d Spacing; 2020-12-25 12:51:18 -07:00
bjorn d81a822bbc rm dead lovrMathOrientationToDirection declaration; 2020-12-25 12:50:50 -07:00
bjorn 25811f1c01 Change default require paths;
The lua_modules+deps paths were added for a LuaRocks experiment.
2020-12-25 12:20:58 -07:00
bjorn 96839c5181 Slightly better error messages on image load failure; 2020-12-15 20:20:25 -07:00
Bjorn 1513191660
Merge pull request #335 from bjornbytes/trackers
Support Vive Trackers;
2020-12-10 21:49:26 -07:00
bjornbytes eb319fdade Fix trailing whitespace; 2020-11-21 14:37:47 -07:00
bjornbytes 80a33c0544 mat4_multiply -> mat4_mul;
quat_mul vs. mat4_multiply is inconsistent.  Going with mul over
multiply is consistent with vec3_sub and Lua's __mul metamethod.
2020-11-21 14:32:59 -07:00
bjornbytes 314a5a9a2d vrapi: cleanup; fix getPose for non-head/hands devices; 2020-11-21 14:24:20 -07:00
bjornbytes 842efe36c7 Handle openvr-specific warnings more precisely;
Instead of disabling a warning for the entire project, it is only
disabled while processing the OpenVR header.
2020-11-21 14:09:51 -07:00
bjorn ad42609b1d Support Vive Trackers; 2020-11-19 00:39:38 -07:00
Jakob Bornecrantz cf22c11dd5 Do not try to create hand tracking devices if handTracking is not supported 2020-11-18 21:31:09 +00:00
Jakob Bornecrantz ca04882093 OpenXR: Add support for X11 and EGL on Linux 2020-11-16 17:02:51 -07:00
bjornbytes 94e7bafe47 KeyCode -> KeyboardKey because X11 conflict; 2020-11-16 17:02:51 -07:00
bjorn c6b4981389 Fix OpenXR view matrix; 2020-11-16 17:02:51 -07:00
Bjorn 8a3d365268
Merge pull request #299 from Wallbraker/linux-openxr
Linux OpenXR support
2020-11-16 13:51:41 -07:00
Jakob Bornecrantz 1400cd201a OpenXR: Add support for X11 and EGL on Linux 2020-11-15 22:51:20 +00:00
bjornbytes 0b73e7d7a6 KeyCode -> KeyboardKey because X11 conflict; 2020-11-15 22:51:20 +00:00
bjorn a139ed33e5 Fix OpenXR view matrix; 2020-11-15 22:49:00 +00:00
bjorn e8db2f8187 Basic cylinder uvs; 2020-11-12 18:08:05 -07:00
bjorn 1a1605f9ce rm textureData include; 2020-11-12 18:08:05 -07:00
bjorn 75c37bf7e9 rm trailing whitespace; 2020-11-12 18:08:05 -07:00
bjorn e533adf649 openxr indentation; 2020-11-12 18:08:05 -07:00
bjorn cdac6bf146 Fix textureData include; 2020-11-12 18:08:05 -07:00
bjorn 827dfda748 TextureData:encode returns Blob; rm core/png; 2020-11-12 18:08:05 -07:00
bjorn 1e7749a58a Fix MSVC warnings;
It's that time of year.
2020-11-12 18:08:05 -07:00
bjornbytes a81cd0d731 KeyCode -> KeyboardKey because X11 conflict; 2020-11-12 18:08:04 -07:00
bjorn 362e5525e7 Fix OpenXR view matrix; 2020-11-12 18:08:04 -07:00
bjornbytes 5c381ead34 Force set vsync in lovrGraphicsCreateWindow;
Headset drivers are allowed to override the vsync setting if vsync
messes up their frame timing.  The vsync property is effectively a
global piece of state in core/os and doesn't change across restarts
because the window is persistent.  This can mean that if you switch
from a headset driver that wants vsync off (anything except desktop)
to a headset driver that doesn't care what the vsync is (desktop),
you could end up with a vsync setting that doesn't match t.window.vsync.
I think this is a symptom of poor design somewhere and the best solution
to this probem is "to just not have it".  Similar issues exist for, e.g.
the window size (but that one is less weird because at least you were
the one who changed it).  For now we are just going to ensure that
lovr.graphics.createWindow always modifies the vsync property.
Untested, may need to adjust this fix later.
2020-11-02 11:57:02 -07:00
bjorn e12a6b7dc4 Fix WebGL; 2020-11-01 23:11:35 -07:00
bjorn 38875cb399 Fix buffer flushing;
lovrGraphicsMapBuffer had the potential to cause a flush.  Flushing
unmaps buffers.  This meant that during any of the calls to map while
creating a Batch, it was possible to cause a flush and unmap other
buffers that expected to be mapped.  This caused writes to unmapped
pointers and subsequent skipping of calls to glFlushMappedBufferRange.

The fix is to figure out if we need to flush upfront and get it out
of the way before mapping any buffers.
2020-10-29 12:12:34 -06:00
Jakob Bornecrantz 22a14e1013 OpenXR: Make sure to set types for XrActionState[Boolean|Float] structs 2020-10-25 01:20:44 +01:00
Jakob Bornecrantz e7d0a73353 OpenXR: Fix right actions not being marked as active in xrSyncActions call 2020-10-25 00:14:17 +01:00
Jakob Bornecrantz b8e3c187ed OpenXR: Fixes for implementations that are more strict with validation 2020-10-24 18:13:41 +01:00
Nevyn Bengtsson 57827eed3c Quest: Make tracked hands have a pose facing -Z
To be consistent with the pose for controllers.
2020-10-21 22:44:57 +02:00
bjorn 6a4779e899 Pico: Reset index buffer binding using vao; 2020-10-19 19:24:18 -06:00
Nevyn Bengtsson 0b9f4d30fd pico: start each eye from origin 2020-10-16 09:29:29 +02:00
bjorn 0388213be4 Reset camera after lovr.headset.renderTo; 2020-10-02 19:50:00 -06:00
bjorn 96fee538b9 Revert "More strict compute shader test;"
This reverts commit 61abb6f02b.
2020-09-29 17:30:50 -06:00
bjorn 92936f6977 Fix possible double-free of event data; 2020-09-29 16:57:41 -06:00
bjorn b139500864 Upgrade OpenVR; 2020-09-29 16:34:44 -06:00
bjorn 8db2f67b45 headset_openxr fix; 2020-09-29 02:49:17 -06:00
bjorn 80c1c2b4a7 headset_oculus fix; 2020-09-29 02:40:07 -06:00
bjorn 51f470cf85 Easier enums; 2020-09-27 17:13:00 -07:00
Bjorn 477b70156f
Merge pull request #287 from jmiskovic/trimesh-support
Support for trimesh shape colliders
2020-09-25 18:29:09 -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 b864f74be1 vrapi: fix getSkeleton joint poses; 2020-09-25 14:49:00 -07:00
bjorn a61291e453 Fix vrapi missing Oculus Go device type;
- Backported the OCULUSGO device type enumerant.  Need to test to
  determine if the Oculus Go still reports this device type or if
  it just reports unknown.
- A more involved fix will be to use JNI to discover the build model
  from the Android settings.
2020-09-25 14:08:13 -07:00
bjorn dd6e05cf32 Fix timers feature being true on GLES; 2020-09-24 19:04:50 -07:00
bjorn f1447fd69a lovr.graphics.get/setViewPose; lovr.graphics.get/setProjection; 2020-09-24 19:03:37 -07:00
Josip Miskovic 75591fde42 Support for trimesh shape colliders 2020-09-24 20:58:28 +02:00
bjorn 61abb6f02b More strict compute shader test;
Some hardware supports ARB_compute_shader but not 4.3, causing
shader compilation failures because currently we switch to GLSL 430
if compute shaders are detected.

Instead, just detect GL 4.3 instead of looking for the compute shader
extension.  This means that compute shaders will sometimes be
unavailable even when they're supported.

It would be possible to improve this by modifying the way shaders
are compiled.  Maybe the highest supported GLSL version should be used,
but this makes shader authoring somewhat more difficult.
2020-09-24 05:29:35 -07:00
bjorn 48a347ad01 mat4_fromQuat; mat4_getFov; getViewPose/Angles fixes; 2020-09-24 04:59:53 -07:00
bjorn 9f302c2314 Set default OpenVR far plane to 100.; 2020-09-22 01:33:05 -07:00
bjorn 9b0812c4f9 Disable timer queries on GLES;
They aren't compatible with multiview.
2020-09-19 17:25:54 -07:00
bjorn 2e65d71a74 Prevent mapped buffers from being discarded;
We never try to do this anyway, and the unmapping code in discard
doesn't flush contents so it's better for people to unmap the
buffer themselves before calling discard.
2020-09-19 17:21:37 -07:00
bjorn 61e9c746a8 Buffer sync fix;
It appears that GL_MAP_UNSYNCHRONIZED_BIT interferes with
GL_MAP_INVALIDATE_BUFFER_BIT's ability to discard buffer
contents.  Removing the unsynchronized bit fixes visual
glitches on Intel HD GPUs.
2020-09-19 17:19:34 -07:00
bjorn c7ca7eaa38 Add compute dispatch limit; 2020-09-18 15:19:34 -07:00
bjorn 4f730a89a7 android: fix t.graphics.debug; 2020-09-16 20:40:39 -07:00
bjorn ef88f5549b vrapi: Fix getViewPose; 2020-09-16 20:37:11 -07:00
bjorn 98918c5de5 OpenXR: rm visibility mask;
Haven't found a runtime that supports it yet.
2020-08-31 16:32:18 -06:00
bjorn 74546f357c OpenXR: Use multiple canvases instead of a single one;
To avoid constant framebuffer completeness checks.
2020-08-31 16:31:17 -06:00
bjorn 28144c8143 OpenXR Android stuff; 2020-08-29 19:45:52 -06:00
bjorn 5d659d0ac2 os_android: Add missing lovrPlatformSetSwapInterval; 2020-08-29 16:59:26 -06:00
bjorn aeda63b96a openvr: s/actionData/action; 2020-08-29 15:29:45 -06:00
bjorn ee8848d4f0 OpenXR: Lazily create hand trackers;
Works around some behavior observed with Ultraleap API layer.
2020-08-28 20:58:58 -06:00
bjorn cc02175241 OpenXR hand tracking; 2020-08-28 17:05:42 -06:00
bjorn 2e5bc6adac Fix OpenVR getSkeleton; 2020-08-28 17:05:42 -06:00
bjorn 17616b8415 OpenXR: load extensions; 2020-08-28 17:05:42 -06:00
bjorn b8598dfe64 Optimize Curve:render;
No longer does dynamic memory allocation and sets the initial table
size properly to avoid reallocs.
2020-08-28 03:57:39 -06:00
bjorn 37522bd8a3 OpenXR: MSAA; 2020-08-26 13:42:42 -06:00
bjorn 17e250c415 OpenXR: Cleanup/warnings; 2020-08-26 13:42:42 -06:00
bjorn aa52fc9ca4 OpenXR: Session fixes; getMirrorTexture; Frame submission; 2020-08-26 13:42:42 -06:00
bjorn 420ab91575 OpenXR: Fix clipFar; 2020-08-26 13:42:42 -06:00
bjorn 833fabb733 OpenXR: Add identity pose to reference spaces; 2020-08-26 13:42:42 -06:00
bjorn 93d82a8d14 OpenXR: Call xrGetOpenGLGraphicsRequirementsKHR; 2020-08-26 13:42:42 -06:00
bjorn beb281a43d Pass instance to xrResultToString; 2020-08-26 13:42:42 -06:00
bjorn 6c2679e00f Fix model loading edge case; 2020-08-26 04:41:15 -06:00
bjorn 2ced7c2c16 OpenXR: More robust graphics plugin; 2020-08-24 03:09:26 -06:00
bjorn 244e6cdd75 OpenXR focus events; 2020-08-24 02:10:12 -06:00
bjorn 0b94fe336e Reorganize OpenXR graphics extension stuff; 2020-08-24 02:04:06 -06:00
bjorn 5ab8dffd8d Fix OpenXR axis actions;
2D axes can't be used as 2D actions and instead need to be represented
as two 1D axes.  Also fixup oculus touch / valve index action paths.
2020-08-23 16:11:20 -06:00
bjorn 9f769470e6 Fix OpenXR OpenGL swapchain type; 2020-08-23 16:10:57 -06:00
bjorn 0439c932ce openxr: Move actions into resources; 2020-08-22 15:40:52 -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 19cf537726 Clean up tracking driver initialization; 2020-08-22 13:42:52 -06:00
bjorn a055caaae4 Fix file permissions; 2020-08-22 13:36:39 -06:00
bjorn 8973730d8a openvr_getSkeleton;
Untested
2020-08-22 13:33:06 -06:00
bjorn e50835260a Clean up WebXR;
- Pointer lock
- wasPressed/wasReleased
- Cleanup
2020-08-21 04:37:38 -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 f364fe030b Make Windows platform functions more private; 2020-08-18 21:21:35 -06:00
bjorn 17ce02d429 Fix OpenXR compile errors and add some android support; 2020-08-18 21:10:06 -06:00
bjorn 80f9514295 Shader:sendImage only checks srgb flag for RGBA textures;
It doesn't need to check it for RGB and compressed textures because
those are already rejected.

It may also be a good idea to zero-out the srgb flag for formats that
it doesn't apply to.
2020-08-18 20:20:48 -06:00
Nevyn Bengtsson 101cd38a7e pico: fix controller position 2020-08-17 14:34:40 +02:00
Nevyn Bengtsson d5e26a72d1 pico: stub for text event 2020-08-17 14:28:56 +02:00
bjorn ce4364fed2 Fix openvr_getSkeleton signature; 2020-08-17 03:30:20 -06:00
bjorn 82159a9885 rm persistent mapping; sync Mesh and ShaderBlock; 2020-08-17 03:29:30 -06:00
bjorn 810086e1ba Make WindowFlags const in createWindow; 2020-08-17 00:55:12 -06:00
bjorn e9841dd562 openvr hand -> device; 2020-08-16 20:28:21 -06:00
bjorn 9d1a685eb7 OpenVR: Remove skeletal input;
To fix the build, it will be re-added soon.
2020-08-16 20:27:24 -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 4177202cc7 Don't enable GL debug output in WebGL; 2020-08-08 17:38:12 -06:00
bjorn 40594317c3 Android textinput event; 2020-08-08 12:36:09 -06:00
bjorn 6823942e3d utf8_encode function; 2020-08-08 12:13:37 -06:00
bjorn 079338c0cc textinput event utf8 encode; 2020-08-07 16:25:56 -06:00
bjorn c24317d982 Start textinput event; 2020-08-07 15:17:19 -06:00
bjorn 682633d98b Add scancode and key repeat arguments to key events; 2020-08-07 14:15:45 -06:00
bjorn 414c5b991d Event module cleans up pending events on quit; 2020-08-06 20:09:45 -06:00
bjorn cb4281b889 Add keypressed and keyreleased events; rm t.hotkeys; 2020-08-06 19:19:45 -06:00
bjorn c20c5508b4 vrapi: lovr.headset.newModel and lovr.headset.animate; 2020-08-06 18:00:54 -06:00
bjorn 3e9c877507 Add missing malloc assert; 2020-08-05 15:08:35 -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
Nevyn Bengtsson b938a839e0 fix crash in lovrGraphicsGetPixelDensity
Neither Quest nor Pico check for null on its out-params.
Better to send in dummy params to avoid nulls.
2020-08-05 14:48:58 +02:00
bjorn e0decf5327 Fix ModelData pointer alignment;
ModelData manages a single allocation and creates pointers into
that allocation.  These pointers were tightly packed, creating
alignment issues which triggered undefined behavior.  Now, the
pointers are all aligned to 8 byte boundaries.
2020-08-04 12:28:21 -06:00
bjorn 83ff4783c2 ALIGN macro aligns up instead of down;
So you don't have to add (n - 1).  Hopefully this turns out to be
the common case.
2020-08-04 12:23:45 -06:00
Nevyn Bengtsson 27384ac62c Fix Pico build
* lovrPlatformGetBundlePath was missing the root argument
* ANDROID_SDK can't be assumed to be the parent of the ndk folder, in case it's a side-by-side installation of the NDK. Instead, ANDROID_SDK should be provided with -D
* One more thing we could mention in the docs that I ran into: Installing java with apt gave me an incompatible version. It worked better to just -DJAVA_HOME= to the java that comes with Android studio (/snap/android-studio/91/android-studio/jre on ubuntu).
2020-08-04 10:42:04 +02:00
bjorn ee95e6c6bd Refactor OBJ model loading;
It no longer uses sscanf and no longer overflows its buffer.
2020-08-04 00:12:58 -06:00
bjorn b45baacb66 Handle active attributes that don't have a location;
There are some attributes that don't have a location (gl_InstanceID
is being reported for some reason).  Their location is -1 and this
causes a left shift of a negative value which is undefined.
2020-07-30 02:46:17 -06:00
bjorn 4160743b77 Fix desktop game packaging issue;
Accidentally hardcoded it to "assets" when updating Android.
2020-07-29 16:30:14 -06:00
bjorn 826fc098bc Set identity to empty string if save mount fails; 2020-07-29 16:27:17 -06:00
Bjorn 617d508d68
Merge pull request #269 from jmiskovic/savemount
Config parameter for save directory precedence
2020-07-29 16:26:07 -06:00
bjorn ae2e14f98f rm save directory mount failure fix;
This is a temporary revert to make a merge easier.
2020-07-29 16:25:29 -06:00
bjorn 99fdcc8287 Fix calling convention of GL debug callback; 2020-07-29 14:56:46 -06:00
bjorn f0a5a8838b OpenGL debug messages and contexts;
The new t.graphics.debug flag controls the following:

- If enabled, a debug context is created
- If disabled, a no-error context is created
- If enabled, GL debug messages are forwarded to lovr.log
2020-07-28 16:12:30 -06:00
bjorn e3aa4c7d5d t.graphics.debug flag; 2020-07-28 16:12:15 -06:00
bjorn c423b1292a Fix save directory to use system path separator; 2020-07-27 18:15: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 58ab637465 Custom os implementation for pico; 2020-07-27 14:28:40 -06:00
bjorn b0b9e38da6 Pico: add pico jar and missing DRIVER_PICO enumerant; 2020-07-27 14:25:57 -06:00
bjorn e7d4e6cf7b Start pico headset backend; 2020-07-27 13:58:52 -06:00
bjorn 066a8a3795 opps; 2020-07-27 11:28:35 -06:00
bjorn d045929065 ShaderBlock:getShaderCode: add namespace support; 2020-07-04 17:50:00 -06:00
bjorn 29f8365eed Clean up os_android and fix event polling issues; 2020-07-03 20:17:39 -06:00
bjorn eb008935e8 vrapi: wasPressed/wasReleased; 2020-07-03 18:12:14 -06:00
bjorn 59a1c14c04 rm oculus_didChange; 2020-07-03 17:59:18 -06:00
bjorn 9777306b70 rm oculus mobile; 2020-07-02 10:46:10 -06:00
Bjorn 26b4b58479
Merge pull request #273 from bjornbytes/android-tup
Android Support
2020-07-02 09:26:14 -07:00
bjorn a0d2ba94ad vrapi: haptics, tracking space fixes; 2020-07-02 10:22:38 -06:00
bjorn 0dd4a1191c rm getApplicationId; 2020-06-29 18:10:03 -06:00
bjorn 4d6ad2239e Quest input fixes; 2020-06-26 16:09:16 -06:00
bjorn afaae2febb Remaining android filesystem work; 2020-06-25 18:18:44 -06:00
bjorn 27b04b2bde vrapi: Add support for focus awareness; 2020-06-25 15:00:12 -06:00
bjorn 6819a04f31 Bugfixes/cleanup for octupus go; 2020-06-25 14:29:44 -06:00
bjorn 2042010b5b Move core/fs paths to core/os;
Usually these are more of a platform-specific concept, and they
don't really interact with files or do any io.

There is a little bit of duplication among the *nix platforms since
they're similar, but overall this organization feels a bit better.
2020-06-25 13:28:40 -06:00
Josip Miskovic 66d7e887c7 Config parameter for save directory precedence 2020-06-21 18:02:36 +03:00
mcc cf05249b8b Oculus: Fix bug where vibration never stops
(because of a sign error)
2020-06-11 12:33:42 -04:00
bjorn a1aa3c8ae8 Finish vrapi driver; 2020-06-09 18:02:03 -06:00
bjorn f58c7075b1 OpenVR: Emit quit event when exiting from SteamVR dashboard; 2020-06-07 00:42:44 -06:00
Bjorn 27b2c0abad
Merge pull request #263 from jmiskovic/world-settings
Physics simulation access to global ERP and CFM
2020-06-04 10:06:51 -07:00
Nevyn Bengtsson e34953f064 lovrMicrophoneGetData: fix potential buffer overrun
With the check for samples==0 being done BELOW the assert for offset+samples<soundData->samples,
setting samples to 0 and then having more samples available in the mic than present in
the created buffer would cause buffer overrun
2020-06-04 14:31:24 +02:00
Josip Miskovic 139808cab0 Get/set World and Joint simulation parameters
Tightness parameter is amount of force is exerted on collider to resolve
collisions and enforce joint operation. Low values make joints loose,
high values make it tight and can cause collider to overshot the joint
target. With tightness set to 0 the joint loses its function. Going
above 1 puts even more energy into joint oscillations. Tightness
parameter is called ERP in ODE manual.

The responseTime affects the time constant of physics simulation, both
for collisions and for joint inertia. Low responseTime values make
simulation tight and fast, higher values make it sluggish. For
collisions it affects how fast penetration is resolved, with higher
values resulting in spongy objects with more surface penetration and
slower collision resolving. For joints the responseTime is similar to
inertia, with higher responseTime values resulting in slow oscillations.
The oscillation frequency is also affected by collider mass, so
responseTime can be used to tweak the joint to get desired frequency
with specific collider mass. Values higher than 1 are often desirable,
especially for very light objects. Unlike tightness, responseTime is
tweaked in orders of magnitude with useful values (depending on mass)
being between 10^-8 and 10^8.

Both parameters can be applied to World for simulation-wide usage, or
specified per-joint in case of distance and ball joints. Other joints
don't allow customizing these parameters, and will use World settings
instead..
2020-06-03 19:03:38 +03:00
bjorn 90e985c45b Fix MSAA Canvas readback; 2020-05-26 09:53:26 -06:00
bjorn 6d2fdac89f Prefix headset implementation files with headset_; 2020-05-24 13:32:13 -06:00
bjorn d6abcdfb0e Fix 2 memory leaks; 2020-05-23 13:03:16 -06:00
bjorn 1185fcf6e1 Autodetect integer attribute types;
Fixes inability to use integer attributes with Mesh.
2020-05-21 00:31:49 -06:00
bjorn 75e26f0051 Move core/hash to core/util; 2020-05-19 13:49:40 -06:00
bjorn 92ac93e6b8 Improve image uniform errors; 2020-05-18 15:14:17 -06:00
bjorn dab0be7055 World:getColliders; 2020-05-11 12:05:30 -06:00
bjorn 95635b4b02 Support loading 16 bit images;
With 1, 2, or 4 channels;
2020-05-10 02:35:45 -06:00
bjorn 6539bc1bd2 Make physics orientation getters more consistent; 2020-05-10 02:08:36 -06:00
Bjorn 62fbf7e0e3
Merge pull request #257 from jmiskovic/physics-vectors
Physics API support for vectors
2020-05-10 01:04:23 -07:00
bjorn 1e78ac8669 Add r16, rg16, rgba16 texture formats; 2020-05-10 01:59:58 -06:00
Josip Miskovic e2d1b33eed Shapes API accepts both vec3 and number coords 2020-05-10 01:12:45 +03: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 ed4b8d1f3d rm unneeded internal Source functions;
Now that things are in the same file, setters for internal source
fields are unnecessary, making things a bit simpler.
2020-05-03 13:02:19 -06:00
bjorn c455b0750e rm unused Source functions from header; 2020-05-03 13:00:02 -06:00
bjorn d847dd663a rm unused audio headers; 2020-05-03 12:57:50 -06:00
bjorn b9a2bddd25 Put all the audio stuff in one file;
If there was ever some sort of hypothetical switch to a different
audio library, this would make such a switch easier.
2020-05-03 12:54:35 -06:00
bjorn b0289de9a6 Error instead of crashing when skin has too many joints;
ModelData is still allowed to load skins with more joints, since
the limitation is in the graphics side of things (Model).

Eventually we will use a buffer for joints to alleviate this.
2020-05-02 14:14:29 -06:00
bjorn c0d73ab541 Add resize event; lovr.resize callback; 2020-05-02 13:09:10 -06:00
bjorn eea73792a6 Minor formatting; 2020-04-30 14:15:36 -06:00
Josip Miskovic 097d39628a Initialize inertia information for new colliders
Inertia matrix has to be calculated with algorithm specific for each
shape. Without calculated matrix the physics behaves very floaty and
slowed down.
2020-04-29 23:05:11 +03:00
Josip Miskovic a4b0d004a1 Fix collider setOrientation() and setPose()
The conversion from angle,ax,ay,az to quaternion is already done in
physics module.
2020-04-28 20:15:09 +03:00
bjorn 7d316d6218 Add internal filesystem module comment; 2020-04-22 01:47:16 -06:00
pendingchaos 28a2e5fd4c Fix when depth test is disabled but depth write is enabled
GL_DEPTH_TEST controls both whether depth testing and depth writes are
enabled. So if depth testing is disabled and depth writes are enabled,
GL_DEPTH_TEST has to be enabled and the compare mode should be GL_ALWAYS.
2020-04-21 23:39:16 +01:00
mcc c32fbdd8fc oculus mobile driver now supports restart cookie 2020-04-16 00:33:35 -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
mcc 334077c9f8 Fix crash on lovr.event.quit("restart") 2020-04-15 17:59:25 -04:00
mcc 9f5fd60545 The Quest has thumbsticks, not touchpads. Fix constants. 2020-04-15 16:44:39 -04:00
Colby Klein 34cef2673c
use clamp/max macros 2020-04-12 16:17:01 -07:00
Colby Klein 809d9b7385
ignore haptics for non-hands
seems a little strange that vibrating head or something would affect the right controller.
2020-04-12 16:12:06 -07:00
Colby Klein 14e79bf8ef
implement haptics on oculus 2020-04-12 16:02:59 -07:00
Colby Klein 077d90bc79
update ovr driver to newer frame submission api
as mentioned on slack.

there are some situations you can get into (high load in some place or other) where the newer frame submission api will behave much more consistently, and I've noticed no negative effects.

besides, the other one is deprecated as best i can tell.
2020-04-02 22:35:12 -07:00
bjorn 37d8df4784 Allow initializing empty TextureData with Blob; 2020-03-29 13:47:57 -06:00
bjorn c02839f5c2 Allow anisotropy to be used with any TextureFilter;
Instead of anisotropic being its own filter, it is now removed and
anisotropy settings can be used with any of the other filter modes.
2020-03-05 09:46:49 -08:00
bjorn 6f6de92d19 Add preliminary WebXR backend; 2020-03-04 22:47:24 -08:00
bjorn 8dcc97745e Tup: emscripten support; LuaJIT flag; 2020-03-02 23:06:42 -08:00
bjorn 45648baa1c Scope a variable better; 2020-03-02 22:23:59 -08:00
bjorn 1d6b7619ea oculus_mobile: Add handModels to bridge; 2020-03-01 18:08:59 -08:00
bjorn 90b605f012 Add restart cookie; lovr.event.restart; arg.restart; 2020-02-26 14:40:40 -08:00
bjorn 69dd0d4674 audio: rm paused and stopped states; rm rewind;
- There is now just one "playing" state.
- Instead of rewind, use :seek(0).

Note that now there is no way to resume or rewind all tracked sources.
This can be improved in the future if there's a need for it, probably
using variadic or table-based variants of the audio module functions.
2020-02-26 00:25:49 -08:00
bjorn fa771b04bd Fix CMake; 2020-02-23 01:01:34 -08:00
bjorn f8b8d427d7 Opaque Mesh; Opaque OpenGL; 2020-02-23 00:29:21 -08:00
bjorn aabb8cb830 Opaque Shader; 2020-02-23 00:29:21 -08:00
bjorn d034e8c01b Opaque Canvas; 2020-02-23 00:29:21 -08:00
bjorn 52d4f7e520 Opaque Texture; 2020-02-23 00:29:21 -08:00
bjorn b045d42782 Opaque Buffer; 2020-02-23 00:29:21 -08:00
bjorn 5d8bf1d45a Fix Source:setLooping assert; 2020-02-22 01:01:17 -08:00
bjorn 93d556b603 zip: read compressed size from central directory;
Some zip writers do not write the compressed size to the local file
headers.
2020-02-21 15:44:48 -08:00
bjorn 81f4232da5 opengl: Init compareMode for native textures; 2020-02-19 15:34:32 -08:00
Bjorn 98d2cc6cd4
Merge pull request #227 from mcclure/no-post-distortion
Instead of showing post-distortion in Oculus mirror, show the left eye (no stereo)
2020-02-17 18:02:47 -08:00
bjorn aa0e01ddab Cleanup; 2020-02-17 17:27:57 -08:00
bjorn bfdebffb34 Fix volume textures; 2020-02-17 17:27:57 -08:00
mcc c22c55865a Instead of showing post-distortion in Oculus mirror, show the left eye (no stereo) 2020-02-17 17:43:47 -05:00
mcc 7db4e4976b Fix compile warnings (MSVC2019) 2020-02-17 17:42:13 -05:00
bjorn 47f4319ba8 core/png; rm stb_image_write; 2020-02-16 04:11:55 -08:00
bjorn 2db1f2b743 Fix erroneous GLES enables;
None of these exist in OpenGL ES.  These were throwing seemingly
innocuous GL errors, so this is mostly just a matter of correctness.
2020-02-16 01:23:27 -08:00
bjorn d2f4628791 Add pointer devices; 2020-02-14 19:10:37 -08:00
Bjorn cce7fa8581
Merge pull request #197 from bjornbytes/hand-devices
More Hand Stuff
2020-02-13 16:35:14 -08:00
bjorn 409c2ad0c6 Fix projection matrices; 2020-02-13 16:33:17 -08:00
Bjorn f048f6d6f0
Merge pull request #218 from bjornbytes/android-bounds-size
oculus_mobile: Expose bounds dimensions;
2020-02-13 15:53:25 -08:00
Bjorn 56dad769dd
Merge pull request #217 from bjornbytes/android-button-changed
oculus_mobile: Expose button changed states;
2020-02-13 15:53:11 -08:00
Bjorn 4b041820aa
Merge pull request #216 from bjornbytes/android-display-frequency
oculus_mobile: lovr.headset.getDisplayFrequency;
2020-02-13 15:52:56 -08:00
bjorn e218733ee2 Make splay axis 1D; 2020-02-13 15:18:12 -08:00
bjorn a0c7d0235f leap: rm curl/splay emulation; 2020-02-13 15:13:08 -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 81e3119321 leap: curl/splay emulation; openvr fixes; 2020-02-13 15:08:58 -08:00
bjorn 7e34c7adcc leap: getPose for finger devices; 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
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 e8fdd5d7f0 Support KTX textures containing ASTC data; 2020-02-08 03:57:59 -08:00
bjorn 2097241596 Improve ASTC loading;
Just a little more reliable and easier to read.
2020-02-08 03:57:59 -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