Commit Graph

4807 Commits

Author SHA1 Message Date
bjorn 534d47904e World:queryBox/World:querySphere callback is optional;
They also return a bool indicating if any intersections occurred.
2023-07-17 13:23:57 -07:00
bjorn 9b7433c1de Add :type method to objects;
NYI for vectors.
2023-07-17 13:18:19 -07:00
bjorn cc67e06d3c Make keyboard input functions variadic; 2023-07-17 13:13:17 -07:00
Bjorn 8ac6c4dbb0
Merge pull request #685 from xiejiangzhi/get_set_shape_pose
Add getPose/setPose for shape. #650
2023-07-17 01:59:33 -07:00
xiejiangzhi 98ee9739b4 Fix luax_readquat for lovrShapeSetPose 2023-07-17 16:42:58 +08:00
bjorn 2e6f95f06a Fix errhand when headset module is disabled; 2023-07-17 00:10:02 -07:00
Bjorn b37c74c93b
Merge pull request #684 from xiejiangzhi/fix_boot_lua
Fix boot.lua without math.globals
2023-07-17 00:08:04 -07:00
xiejiangzhi c880ed529a Add getPose/setPose for shape. #650 2023-07-17 14:34:54 +08:00
xiejiangzhi 8542624895 Fix boot.lua without math.globals 2023-07-17 10:11:22 +08:00
bjorn 61ffd5716f Disable LOCAL reference space on SteamVR;
Recent SteamVR versions have bugs with it, especially after triggering a
recenter operation.

In SteamVR, recentering fires referenceSpaceChangePending for the LOCAL
space, then the STAGE space, then the LOCAL space again, all with
different changeTimes.  No poseInPreviousSpace is given.

Recreating the main reference space whenever this event is received
leads to strange, inconsistent issues.  Sometimes the local/stage spaces
end up on top of each other, other times one or both will be way up in
the air (putting the headset at negative y coordinates).

This bug is even present when recentering in the compositor, so it's not
an issue with lovr.  Cautiously disabling the local-floor emulation on
SteamVR runtimes and just always using the STAGE space until things are
sorted out.
2023-07-16 14:43:23 -07:00
bjorn 83d6e64c6e Use reference space change time when recreating reference spaces;
This doesn't fix any observed issue, but should be more correct.
2023-07-16 14:29:25 -07:00
Bjorn 01ac8ef8a4
Merge pull request #683 from jmiskovic/fix/mat4_mul_vec3_w
Restore w normalization in mat4:mul(vec3)
2023-07-15 12:33:37 -07:00
Josip Miskovic 1e475d122b Restore w normalization in mat4:mul(vec3) 2023-07-15 18:06:36 +02:00
bjorn b268cd1776 World:queryBox; World:querySphere; 2023-07-10 23:20:01 -07:00
bjorn 9bf2def86d Rename box shape dimensions to be more clear; 2023-07-10 23:11:14 -07:00
bjorn 5210d474b8 Source pitchable flag defaults to true; 2023-07-10 20:09:16 -07:00
bjorn 74325d81a1 Expose runtime name in lovr.headset.getDriver; 2023-07-10 19:35:21 -07:00
bjorn dabbd449a8 Format support considers both linear/srgb encodings; 2023-07-10 19:21:11 -07:00
bjorn be795c0ebd Change vec3 back to 3 floats; Clean up maf/vectors;
The "vec3 is 4 floats" thing was consistently confusing to people.  It's
reverted everywhere except for Curve.

maf now has full sets of methods for vec2/vec3/vec4, for consistency.

Vector bindings now use luax_readvec* helper functions for the
number/vector variants, and use maf for most functionality, which cleans
things up a lot.
2023-07-10 17:51:24 -07:00
bjorn 6ad9386dea rm lua-https;
Unfortunately the library has too many issues/restrictions to be usable
on all of LÖVR's target platforms.
2023-07-10 15:29:03 -07:00
bjorn 0d30055dd7 webgpu/wasm updates;
Some compile fixes and a rename from gpu_wgpu to gpu_web, since wgpu
refers to a specific implementation of WebGPU and I'm really bad at
typing it for some reason.
2023-07-09 13:13:58 -07:00
bjorn 22202af27f Revert "gpu: prefer rgb10a2 for window swapchains;"
This reverts commit b7a00c82d1.

I think srgb-encoded rgb10a2 swapchains require manual gamma correction
in shaders (?!), which we aren't quite ready for yet because shaders don't
know the "color space" of their canvas textures.
2023-07-08 15:47:58 -07:00
bjorn b7a00c82d1 gpu: prefer rgb10a2 for window swapchains;
We don't support transparent desktop windows, so losing alpha bits is fine.
2023-07-08 15:02:42 -07:00
bjorn c52f09cdc2 Fix some gcc warnings; 2023-07-08 14:49:35 -07:00
Bjorn 115465b201
Merge pull request #678 from bjornbytes/frustum-culling
Frustum culling;
2023-07-07 14:59:47 -07:00
bjorn 10c2c75482 Frustum culling;
- Adds Pass:setViewCull to enable/disable frustum culling.
- Renames Pass:setCullMode to Pass:setFaceCull (with backcompat).

Some stuff currently missing:

- Text is not culled, but should be.
- VR view frusta are not merged yet.
2023-07-07 14:51:22 -07:00
bjorn 48a9bb0384 rm some unused maf methods; 2023-07-07 14:05:44 -07:00
bjorn 237a4c19e2 Ignore empty tables when writing arrays; 2023-07-07 14:03:16 -07:00
bjorn e9af3d9167 Fix bug when writing tables of numbers to nested arrays; 2023-07-07 14:02:58 -07:00
bjorn 1ab791d89d Automatically unwrap single-field buffer structs; 2023-07-07 14:02:36 -07:00
bjorn 2bc90d2106 Add lovr.audio.getDevice; 2023-07-06 13:50:34 -07:00
bjorn 9d24d0173d Fix issue with lightuserdata in Buffer:setData; 2023-07-05 20:16:16 -07:00
bjorn fd0d3fc1ec Fix number + lightuserdata binary vector ops; 2023-07-03 19:17:09 -07:00
bjorn c5afb32ad2 Fix temporary vector memory layout;
It's important that the bits for the vector type occupy the least
significant bits, so that vectors can be distinguished from pointer
lightuserdata.

When the vector pool was expanded, this broke, causing e.g. Blob
pointers to exhibit undefined behavior when trying to use them as
vectors.

tbh I still don't understand the union/bitfield memory layout.
2023-07-03 19:14:27 -07:00
bjorn d109518c27 Fix number - vector math;
It still errors on temporary vectors, but that's a separate issue.
2023-07-03 18:49:57 -07:00
bjorn d4842d3502 Fix vec3 3-char swizzles; 2023-07-03 18:45:09 -07:00
bjorn 38be62c103 Use mat4_fromPose more; 2023-07-03 13:16:35 -07:00
bjorn 5904d3997e tup: stop linking libc++ statically;
This will break Android.  The proper fix there is to move the c++
library into the APK like CMake recently started doing.
2023-07-03 13:14:55 -07:00
Bjorn 63ebd095bd
Merge pull request #677 from bjornbytes/mousearm
Implement mousearm simulator controls;
2023-07-03 13:14:36 -07:00
bjorn 85ed9b9ca5 Scroll wheel changes simulated hand distance; 2023-07-02 16:08:00 -07:00
bjorn e9a9056b8c Return linear velocity for head; 2023-07-02 15:56:43 -07:00
bjorn 5b8d3e0cc8 Fix hand orientation; 2023-07-02 15:33:25 -07:00
bjorn 581c42b906 Implement mousearm simulator controls; 2023-07-01 00:40:04 -07:00
bjorn cde7177db4 rm unused typedef; 2023-06-29 16:29:47 -07:00
bjorn 447e746d41 Rename desktop driver to simulator internally;
The HeadsetDriver enumerant remains the same for now.
2023-06-29 16:24:51 -07:00
bjorn 6d8dba4657 Fix Quest hand mesh animation;
Quest added a thing where they emulate grip pose when hand tracking is
active.  This is actually pretty cool, and maybe LÖVR should do it too
on other runtimes, but it messed up the Quest hand mesh animation, for
some complicated reasons:

- Previously, getPose('hand/*') was returning the wrist pose because
  LÖVR fell back to hand tracking data when the controller wasn't
  tracked.
- Because of this, coupled with the fact that hand/controller models are
  expected to be drawn at the hand pose, hand meshes were animated such
  that the root node was located at the wrist pose.
- When Oculus added grip pose emulation for hand tracking, it caused a
  discrepancy:
  - Hand meshes were still being animated relative to their wrist pose
  - getPose was now returning grip-style poses
- This resulted in hand meshes being off by approximately 90 degrees.

The fix is to locate skeletal joints relative to the grip pose when
animating Oculus hand meshes, and to place the origin/wrist at its real
pose instead of assuming it's the origin.
2023-06-28 21:19:40 -07:00
bjorn 0daf85a7d9 Fix recentering bugs; 2023-06-28 21:04:56 -07:00
bjorn 21b8557ee9 lovr.system.has/setKeyRepeat; 2023-06-28 18:45:34 -07:00
bjorn e3cbf6c22d Add 'radius' field to hand tracking joints;
The radius is also included as the 4th number in the table,
but I think this was a mistake.

Not going to remove it yet, but maybe we can start to prefer reading it
from a string key.
2023-06-28 17:32:37 -07:00
bjorn 6e018b8c96 Replace HeadsetOrigin with 'seated' flag;
Origin type used to be a query-able property of the VR system that
indicated whether the tracking was roomscale or seated-scale.

The t.headset.offset config value could be used to design an
origin-agnostic experience, which by default shifted content up 1.7
meters when tracking was seated-scale.  That way, stuff rendered at
y=1.7m was always at "eye level".  It worked pretty well.

It's getting replaced with a t.headset.seated flag.

- If seated is false (the default), the origin of the coordinate space
  will be on the floor, enabling the y=1.7m eye level paradigm.  If
  tracking is not roomscale, a floor offset of 1.7m will be emulated.
- If seated is true, the origin of the coordinate space will be y=0
  at eye level (where the headset was when the app started).  This is
  the case on both roomscale and seated-scale tracking.

So basically 'seated' is an opt-in preference for where the app wants
its vertical origin to be.

One advantage of this is that it's possible to consistently get a y=0
eye level coordinate space, which was not possible before.  This makes
it easier to design simpler experiences that only need to render a
floating UI and don't want to render a full environment or deal with
offsetting everything relative to a 'floor'.  This also makes it easier
to implement hybrid VR+flatscreen experiences, because the camera is at
y=0 when the headset module is disabled.

The opt-in nature of the flag, coupled with the fact that it is
consistent across all types of tracking and hardware, is hopefully a
more useful design.
2023-06-28 16:38:36 -07:00