Commit Graph

4816 Commits

Author SHA1 Message Date
bjorn 2f90255d1a physics no longer depends on maf;
So little is used, may as well make it more self-contained.
2023-07-28 16:16:14 -07:00
bjorn f960141fd7 Add :type method to vectors; Change Mat4 __tostring; 2023-07-24 15:12:25 -07:00
bjorn 941918152a Merge branch 'master' into dev 2023-07-24 14:52:35 -07:00
bjorn 2dcba24138 Update README;
Don't trick people into thinking WebXR is supported right now,
and spell macOS better.
2023-07-24 14:52:00 -07:00
Bjorn fd49a4a287
Merge pull request #687 from xiejiangzhi/world_query_early_exit
World query early exit
2023-07-20 17:15:58 -07:00
xiejiangzhi ee10e22402 World query: Rename should_stop to shouldStop, early stop queryCallback if no give a callback 2023-07-21 08:00:58 +08:00
xiejiangzhi 91e586bbd4 Fix early exit logic for raycast & querySphere 2023-07-20 16:46:40 +08:00
xiejiangzhi a4dc1d9ffb Support early exit for world:raycast world:queryBox world:querySphere 2023-07-20 16:34:56 +08:00
bjorn 5c322d3403 Include temp buffer offset in draw range; 2023-07-17 18:45:37 -07:00
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