Commit Graph

1578 Commits

Author SHA1 Message Date
bjorn 08d6b2ad28 Refcounted modules;
This allows them to be initialized/destroyed from multiple threads in
any order.  Previously, the first thread to require a module had to be
the last thread to use the module, otherwise it would be destroyed too
early.

There are still a few issues.  If the main thread doesn't require a
module, it won't pick up the conf.lua settings.  Also graphics isn't
handling the shader cache writing properly.  And I think this breaks the
headset-graphics refcounting.  But these will be fixed in future
commits.
2023-11-23 17:07:44 -08:00
bjorn 7ca331a5f5 Adjust fs_read/fs_write signatures; Fix seeking; 2023-11-22 16:37:31 -08:00
bjorn d949b90eea Details; 2023-11-22 16:19:40 -08:00
bjorn f04a0e6bc4 Fix zip EOF emulation;
To match regular files, the file offset should be allowed to go past the
end of the file, but reads will return 0 bytes.
2023-11-22 15:49:10 -08:00
bjorn 79abe3b1d6 Windows fixes; 2023-11-21 20:19:49 -08:00
bjorn 19ac219b0c Add File object; 2023-11-21 18:49:32 -08:00
bjorn f50e9f6fe1 Use miniz to decompress files; 2023-11-21 18:49:32 -08:00
bjorn d0f1462e51 Make Archive a refcounted object;
- Archive is now an object that has a refcount
- Archives are stored in linked list instead of array
- Not exposed to Lua yet, but could be in the future
- core/zip was merged into the filesystem module
- Mountpoints are handled centrally instead of per-archive
- Zip doesn't pre-hash with the mountpoint anymore
- mtime is truly only computed on request for zips

Mountpoints don't work properly yet.
2023-11-21 18:49:32 -08:00
bjorn 209ea1e4b5 Simplify Pass draw list;
It's a normal stretchy buffer instead of a weird page table thing.

This was definitely overdesigned.

Now it uses less memory too.
2023-11-18 02:02:05 -08:00
Bjorn 895c702388
Merge pull request #720 from xiejiangzhi/auto_wakeup
Auto wake up collider when calling API to apply force or change force.
2023-11-17 17:50:10 -08:00
xiejiangzhi 1e120d3401 Auto wake up collider when calling API to apply force or change force. 2023-11-18 09:43:52 +08:00
bjorn e0e1bc68f9 Add support for cubemap arrays;
- Cubemaps can have any layer count that is a multiple of 6.
- A cubemap with more than 6 layers will be a cubemap array image view.
  - This isn't perfect because it conflates regular cubemaps with
    6-layer cubemap arrays.
- Enable the vk feature, handle the spv feature, add getPixel helper.
2023-11-10 11:15:16 -08:00
bjorn 67b1929af6 Merge branch 'stable' into dev 2023-11-09 16:51:28 -08:00
bjorn eefc89909e Fix bitangent sign;
Really gotta compress ModelVertex at some point.
2023-11-09 16:50:52 -08:00
bjorn 62810a195c rm Pass:append;
This was an experiment that was never documented/announced.
2023-11-09 16:08:14 -08:00
bjorn 534947bc20 Merge branch 'stable' into dev 2023-11-09 14:57:42 -08:00
bjorn 4522d1050f Fix OpenXR layout transitions; 2023-11-09 14:57:29 -08:00
bjorn 02860ff8e9 Merge branch 'stable' into dev 2023-11-09 12:48:10 -08:00
bjorn 648118d308 Fix excessive gamma-to-linear conversion; 2023-11-09 12:47:39 -08:00
bjorn c4cda0a7bb core/gpu: rm TRANSIENT texture usage;
It's implied when the usage is just RENDER
2023-11-08 14:54:10 -08:00
bjorn e8945763c2 core/gpu: allocation callbacks; 2023-11-08 14:45:04 -08:00
bjorn 8ed5572b0e rm lovr.graphics.initialize/isInitialized;
This only existed because the graphics module had to know about the
window during initialization, but this is no longer the case.
2023-11-03 15:53:33 -07:00
bjorn c98db5b670 lovr.system.wasMousePressed/Released; 2023-11-02 18:55:02 -07:00
bjorn 038db88cb7 Consolidate texture format features;
- 'sample' now implies both sample and linear filtering (practically always
  true for all formats lovr supports)
- 'render' now includes 'blend' for color formats (also practically
  always true except for r32f on some old mobile GPUs)
- 'blit' now includes 'blitsrc'/'blitdst' because lovr doesn't support
  blitting between textures with different formats
- 'atomic' is removed because lovr doesn't really support atomic images yet
2023-11-02 15:33:29 -07:00
bjorn c2d9aa5657 Destroy linear texture views; 2023-11-02 13:40:16 -07:00
bjorn 90a14478a3 lovrImageCreateRaw takes sRGB flag; Fix readback encoding;
Roundtripping pixels through a readback preserves sRGB encoding.
2023-11-02 13:38:21 -07:00
bjorn b2083e9a4a Ignore linear=false flag for linear-only formats;
Also fix bug with r8 srgb canvases...
2023-11-02 13:26:49 -07:00
bjorn 0468a2f090 Default texture is linear; 2023-11-02 13:16:00 -07:00
bjorn e9743a2fb8 Secretly create and bind linear views of sRGB storage textures; 2023-10-31 17:14:09 -07:00
bjorn a28d66e3a1 Mesh:setMaterial takes texture too; 2023-10-31 16:08:00 -07:00
bjorn 9ff8ad61e1 Prefix KEY enums with OS_KEY; 2023-10-31 13:16:20 -07:00
bjorn df9f50ca5c Fixes for layer depth test and depth submission; 2023-10-26 16:29:35 -07:00
bjorn bdbdd467e0 Layer improvements; 2023-10-25 15:24:14 -07:00
bjorn 6bccbd66ec Layer fixes; 2023-10-25 15:24:14 -07:00
bjorn c8eb6606c6 OpenXR layer implementation; 2023-10-25 15:24:13 -07:00
bjorn 4c2e206e30 Bindings; 2023-10-25 15:23:41 -07:00
bjorn 72aac1c58a Start Layers; 2023-10-25 15:23:41 -07:00
bjorn 2f8d9aa6dc Disable depth submission when depthResolve is not supported;
Prefer MSAA over depth submission on GPUs that can't resolve depth
buffers (Quest 1).
2023-10-25 15:22:16 -07:00
bjorn 42cfb273f9 Fix bug where depth wasn't being submitted to VR runtime; 2023-10-25 15:15:16 -07:00
bjorn 0dfa95626e Model:resetBlendShapes;
Resets blend shapes to default values, like :resetNodeTransforms.
2023-10-18 15:51:52 -07:00
bjorn 35628e332c rm deprecated pass stuff; 2023-10-15 14:10:39 -07:00
bjorn ab3922345f rm deprecated buffer stuff; 2023-10-15 14:08:50 -07:00
bjorn 99f8c3a25c Fix frustum culling;
The technique used only works for AABBs.  Trying to apply the model
matrix to the extent like that isn't valid.  For now, switch back to
the naive approach.  This is quite a bit slower, but at least it's
correct.
2023-10-11 18:21:11 -07:00
bjorn 68aad50a2d Use better UBO size when pass has more than 256 draws; 2023-10-11 13:55:25 -07:00
bjorn 5d6f538524 Pass:barrier also barriers against indirect stage;
Fixes a validation error that probably no one was running into.
2023-10-11 08:26:06 -07:00
bjorn b319aeeb40 Fix Pass:send when using a table with an array UBO; 2023-10-07 16:22:56 -07:00
bjorn 539b19c84c Fix minor undefined behavior; 2023-10-05 12:21:27 -07:00
bjorn 6cfbfd050d Fix issue with synchronization;
If there is only a single pass in the submit, barrierCount is zero
since there will be no inter-pass synchronization.  This is almost
correct, but not quite, because if a Pass has compute and render work,
the render pass may need to synchronize with the compute pass.  So a
barrier is still necessary.  For simplicity, always allocate the full
number of barriers, even though the final render barrier will always be
empty.

Additionally, avoids passing NULL to memset when the barrier count is
zero and the barrier arrays are NULL.
2023-10-05 12:09:55 -07:00
bjorn fc9bb8a5e4 Fix crash when trying to load hand models on non-Quest; 2023-10-04 17:04:03 -07:00
bjorn 6682fe1930 Fix Mesh:computeBoundingBox; 2023-10-04 14:36:39 -07:00
bjorn 44b250a517 Fix issue with texture readback layer count; 2023-10-04 13:12:55 -07:00
bjorn 842df4b305 Fix buffer readback issues; 2023-10-04 08:52:05 -07:00
bjorn f0686f0115 Update msdfgen; Orient contours properly;
This fixes issues where some fonts would have glyphs with weird windings
and they would get rendered inside-out.

Unfortunately updating msdfgen increased its size by a factor of 2-3x.
2023-10-03 11:12:38 -07:00
bjorn 9a276e5f9a Tally fixups;
- rm :getTallyData, it's totally lame, just do a readback
  - rm gpu_tally_get_data too, webgpu doesn't support it anyway
- Clamp tally copy count so it doesn't overflow buffer
- Tally buffer offset's gotta be a multiple of 4
- Return nil instead of 2 values when tally buffer isn't set
- Copy correct number of tallies (multiply by view count instead of max
  view count)
- Skip occlusion queries entirely if no tally buffer was set
2023-10-02 10:20:52 -07:00
bjorn 9c28eab732 Fix crash when drawing with an active compute shader; 2023-10-02 09:56:33 -07:00
bjorn 6462c7bc07 getBundle takes bindings; 2023-10-02 09:07:50 -07:00
bjorn d901481cdc Clear canvas info properly when setting canvas to nil; 2023-09-30 13:19:31 -07:00
bjorn d7c6461916 Render targets with mipmaps get transfer usage;
Also I think no mipmaps is more sane default for render targets.
2023-09-29 05:22:03 -07:00
bjorn 4e6effceff lovr.graphics.wait updates timing stats and readbacks; 2023-09-28 23:26:04 -07:00
bjorn a2f539de56 Update glslang; Shader #include uses virtual filesystem;
This update seemed to increased glslang's binary size even more...
2023-09-28 22:04:05 -07:00
bjorn c3b99a397a Mesh bounding box uses same convention as everyone else;
It was using

minx, miny, minz, maxx, maxy, maxz

Instead of

minx, maxx, miny, maxy, minz, maxz
2023-09-28 02:26:53 -07:00
bjorn 19c4aed465 Fix crash when headset module is disabled; 2023-09-27 23:04:55 -07:00
bjorn c3c5284f11 Improve viewport/scissor accessors;
- Better validation
- Can set to nil to "disable"
- Getter returns nil when "disabled"
- Negative viewport height works again
2023-09-27 00:24:01 -07:00
bjorn 73b1b951f5 Model:clone has separate blend shape state; 2023-09-24 23:51:42 -07:00
bjorn a478f417f2 Pass:draw(Texture) bounds; 2023-09-24 23:31:57 -07:00
bjorn d021596e6d Mark blend passthrough mode as supported on Quest; 2023-09-24 22:07:37 -07:00
bjorn 1d91ea1fde Replace tinycthread with C11 threads.h polyfill; 2023-09-21 23:26:16 -07:00
Bjorn 5db7d4a914
Merge pull request #704 from bjornbytes/surface
Surface Improvements
2023-09-21 22:34:45 -07:00
bjorn 94cdb9ae4e Fix GCC warning;
GCC warns when passing a pointer to a float to lovrModelSetNodeTransform
(currently done in OpenXR driver when updating model poses from an
XrPose).
2023-09-21 22:24:57 -07:00
bjorn b03e3244c3 LÖVR no longer requires 64KB uniform buffers;
Due to per-draw data size reduction from 144 -> 64 bytes.
2023-09-21 15:58:04 -07:00
bjorn 479983fede gpu: surface improvements;
Restores ability to open window after initializing graphics module.

Surface is created lazily instead of being required upfront.

Use native platorm handles instead of GLFW's callbacks.

Some minor reorganization around core/gpu present API and xr transitions.

Linux links against libxcb/libX11/libX11-xcb for XGetXCBConnection.
2023-09-20 21:17:24 -07:00
bjorn f318c68796 Buffers can be cleared to values other than zero; 2023-09-18 23:05:27 -07:00
bjorn 38dbc46e8b Pass:append also copies draw bounding boxes; 2023-09-18 17:49:19 -07:00
bjorn d7e7449e5a Fix message box;
oops I thought windows was already in graphics.c
2023-09-17 19:04:15 -07:00
bjorn c98f945cae rm os_window_message_box;
The message box is meant to be a hack to improve UX on Windows, not an
officially supported feature of core/os.  So it's more appropriate to
inline it in the one place/platform where it's used.
2023-09-17 17:22:08 -07:00
bjorn 181427eee4 glfw: filter resize events and cache window size;
GLFW reports window size as zero on Windows when the desktop window is
minimized.  This is by design.  Using zero width/height for window
textures isn't valid.  The fix is to ignore resize events where the
width or height is zero and also cache the last-valid window size so it
can be reported by os_window_get_size.  Sighs...
2023-09-13 18:56:06 -07:00
bjorn f6216415e6 Rename pass memory stats to indicate they're CPU; 2023-09-11 20:19:36 -07:00
bjorn 5b6d882475 Add Image:mapPixel; 2023-09-11 18:48:46 -07:00
bjorn be213cc32d Cleanup; 2023-09-11 17:24:27 -07:00
bjorn 9542d46f33 Buffer format cleanup; 2023-09-11 03:01:11 -07:00
bjorn fe93018627 Fix issue with DrawData UBO size; 2023-09-11 00:35:26 -07:00
bjorn de268ef2d9 simulator: hand stays tracked while rotating;
It continues to use the mouse position of the click to compute the pose.
2023-09-09 12:29:32 -07:00
bjorn 5badf6d8db DPI fix; 2023-09-05 16:27:18 -07:00
bjorn 14cb2ed368 Add os_thread_attach/os_thread_detach;
These are called when creating/destroying Thread objects.  It's
currently only implemented on Android, where it attaches/detaches the
Java VM to the thread.  This allows JNI calls to be used on threads.

However I don't think e.g. `lovr.system.requestPermission` will work on
a thread yet, because it uses the global JNI env from the main thread
instead of the thread's JNI env.  Still, attaching/detaching the VM is
an improvement and will allow well-behaved JNI methods to work on
threads now.

I don't know how expensive this is, yolo.
2023-09-05 16:20:32 -07:00
bjorn 78308acfa4 Fix Pass:capsule when its length is zero;
Just draw a sphere.  The transform is rotated so the sphere segments
line up better, because spheres and capsules use different orientations
for their sphere parts.  Also the "degenerate" z axis is reconstructed
to be perpendicular to the x/z axes.  This doesn't seem like it will be
particularly fast, but hopefully people aren't drawing zero-length
capsules too often.  There might be an opportunity to shortcut the
rotation since it's 90 degrees and would just involve swapping columns.
2023-08-22 20:36:17 -07:00
bjorn 0fcbdcbf5d Fixup overlay order;
- state.features.overlay should remain a bool since it just indicates
  whether the extension is supported/enabled.
- split the config value into a bool/u32 pair so the full u32 range can
  be used for the order (seems important to coordinate with other apps).
  - Also you can use a boolean now like before, which uses 0 as the order.
2023-08-21 15:15:39 -07:00
Bjorn f8f9c833b1
Merge branch 'dev' into master 2023-08-21 14:59:53 -07:00
bjorn 2d94841db6 Pass:skybox takes nil; 2023-08-21 14:37:05 -07:00
BabbleBones 6fbfc16f7d feat: overlay layers 2023-08-18 11:30:58 -04:00
bjorn 6f566f2125 Show a message box when Vulkan initialization fails on Windows; 2023-08-17 15:02:53 -07:00
bjorn 0d6c9a1def World:isCollisionEnabledBetween takes nils;
They act like wildcards, just like nil tags do otherwise.
2023-08-15 18:24:19 -07:00
bjorn b1deeda0ce Fix issue with buffer recycling; 2023-08-15 10:18:48 -07:00
bjorn 339e6cf94b Shrink DrawData from 128 to 64 bytes!;
- Last row of transform matrix is unused, make it 4x3
  - Requires funny row-major packing due to vec3 std140 padding.
  - Teach spirv parser to tolerate non-square matrix types, though
    they aren't supported anywhere else yet.
- Compute cofactor in shader for normal matrix, ALU is free,
  optimize out many terms, rm maf_cofactor.
- Take out complex UBO alignment logic since stuff is PO2 these days.

This was a common bottleneck for some workloads, so there are measurable
performance gains (up to 2x faster pass submission on CPU).  GPU time is
identical, at least on desktop.
2023-08-01 18:57:09 -07:00
bjorn 715edfd431 Add hand/*/pinch and hand/*/poke devices; 2023-07-31 18:30:35 -07:00
bjorn 5fddd28137 Add hand/left/grip and hand/right/grip devices; 2023-07-31 18:08:56 -07:00
bjorn c6cb5451ee Set XR_LOADER_DEBUG environment variable to none;
LOVR doesn't require OpenXR to run.  When the headset module is enabled
and the openxr headset driver is enabled, LOVR tries to initialize
OpenXR, and if it fails then it will try the next driver.

The OpenXR loader will print error messages to stderr by default.  This
is undesirable because someone who is unfamiliar with OpenXR will see a
bunch of messages in their console that say "ERROR" and think something
is wrong, even though the messages are innocuous and don't indicate an
actual problem.

The only way to silence these messages from the OpenXR loader, to my
knowledge, is to set the XR_LOADER_DEBUG environment variable to 'none'.
This is only done when the environment variable isn't set, so it's still
possible to set XR_LOADER_DEBUG to see the logs.
2023-07-31 17:32:31 -07:00
Bjorn c38165a154
Merge pull request #688 from bjornbytes/mesh
Mesh
2023-07-29 18:21:01 -07:00
bjorn 53ae77f123 Merge branch 'master' into dev 2023-07-29 03:40:36 -07:00
bjorn 072452a4da Fix issue where OBJ UVs are upside down;
Most OBJ loaders use OpenGL texture coordinate conventions.

After switching to Vulkan, the UV origin became upper-left and images no
longer needed to be flipped on import.  This means that the OBJ importer
now needs to flip its UVs to compensate.  Somehow, no one noticed until
now!  Most people are using glTF I guess.
2023-07-29 03:37:18 -07:00
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 4892d228b3 WIP; 2023-07-24 15:34:44 -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 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 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 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 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 2bc90d2106 Add lovr.audio.getDevice; 2023-07-06 13:50:34 -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 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 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 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 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 b9e14a8f2d Merge branch 'master' into dev 2023-06-21 16:52:10 -07:00
bjorn 06811dcb1a Fix lovr.graphics.newModel when model has unused meshes;
Prefer n^2 loop over a weird sentinel value that wasn't always getting written over.
2023-06-21 16:50:24 -07:00
bjorn b086b3d236 Fix issue where models sometimes wouldn't reanimate;
If the very first graphics-related thing done in a frame is drawing a
model, the reanimation logic would skip because a new frame hasn't
started yet.  lovrModelAnimateVertices needs to unconditionally start a
new frame.  (Previously, a new frame was guaranteed to be started
because all passes were temporary, but this is no longer the case).
2023-06-20 21:46:04 -07:00
bjorn 065fc7b1d5 Rename variable to avoid shadowing; 2023-06-20 21:45:58 -07:00
bjorn 97cc7d9137 Fix issue with blend shape compute shader;
It was only copying the raw vertex data for the first blend shape,
not the first blend shape in each group.
2023-06-20 21:42:44 -07:00
bjorn 4ec065757d Optimize blendshapes;
To initialize the vertices to their default state, it's way faster to
use a branch in the compute shader rather than using a copy.
2023-06-17 17:14:00 -07:00
Josip Miskovic f0d916787a Add wheelmoved callback 2023-06-17 12:42:18 +02:00