Commit Graph

4106 Commits

Author SHA1 Message Date
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 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 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 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
bjorn 7e464d8abb Add optional mode argument to lovr.filesystem.load;
Matches Lua 5.2 / LuaJIT syntax.  luax_loadbufferx polyfills new Lua API.
2023-06-28 16:10:30 -07:00
bjorn 3f0dbeb595 Add lovr.headset.stopVibration; 2023-06-27 20:45:44 -07:00
bjorn 88628ad8a8 Add 'floor' device;
You can do lovr.headset.getPose('floor') to get the offset of the stage
relative to the local origin if you want to draw something at the center
of the play area.

Also lovr.headset.isTracked('floor') basically tells you if it's roomscale.
2023-06-27 20:23:44 -07:00
bjorn c65eddb7cc Fix space leak after recenter; 2023-06-27 20:14:28 -07:00
bjorn 9798f14182 Add back spaces that accidentally got removed; 2023-06-27 20:09:29 -07:00
bjorn 8a9a05a3b9 lovr.recenter event; Use local-floor space by default; 2023-06-26 16:41:42 -07:00
bjorn 6a915a2993 Fix issue with mesh-multiple-skin check; 2023-06-25 19:16:34 -07:00
bjorn 98729912a8 Add GL_EXT_samplerless_texture_functions; 2023-06-24 14:00:22 -07:00
bjorn 116d14cdf8 Details; 2023-06-24 11:26:09 -07:00
bjorn ad5d00fb2f Bugfixes; 2023-06-23 22:56:33 -07:00
bjorn 3ed3a1b2f9 Store align on stack instead of in field; 2023-06-23 21:35:39 -07:00
bjorn 68878f9197 Rename/refactor more Buffer stuff;
BufferField -> DataField
fields -> format
decontaminate buffer constructor
2023-06-23 21:14:19 -07:00
bjorn 0ff633fa56 mv FieldType DataType; 2023-06-23 19:11:30 -07:00
bjorn 3804d15184 rm Pass:setVertexFormat and table variant of Pass:mesh;
The complexity/convenience tradeoff isn't satisfactory.
2023-06-23 19:05:42 -07:00
bjorn d17232bac5 Fix warning; 2023-06-23 18:28:17 -07:00
bjorn a511064987 Collider:isDestroyed; 2023-06-22 15:48:23 -07:00
Bjorn 9c56c41b03
Merge pull request #676 from jmiskovic/add/vec3_from_quat
Initialize vec3 from quat
2023-06-22 15:48:11 -07:00
Josip Miskovic 3bd4c6c4f0 Initialize vec3 from quat 2023-06-22 19:14:19 +02:00