Commit Graph

3151 Commits

Author SHA1 Message Date
bjorn 8462beef00 Fix/improve alpha cutoff;
The current flag did not work because float shader flags are not
supported.  It was also not very useful because it was per-shader
and did not use the alpha cutoff property of glTF materials.

Instead, let's turn the shader flag into an enable/disable boolean,
and add a scalar material property named "alphacutoff" that gets
read by the glTF importer.

When the alphaCutoff flag is enabled, the material property will be
compared against the pixel's alpha value to decide whether it should
get discarded.
2021-12-28 21:10:52 +02:00
bjorn 8d3d233e91 Include unknwn.h to fix OpenXR on some windows systems; 2021-12-27 15:16:50 +02:00
bjorn e283245dc6 Remove suspicious friction override; 2021-11-12 12:20:21 -08:00
bjorn e1527a949a openxr: fix xrLocateViews call;
- The input parameter is a count, not a size
- The view structs must be initialized with a type
2021-10-24 13:03:05 -07:00
Josip Miskovic 8e64ded60a Check stbtt_GetGlyphBox() return status
Only use results of stbtt_GetGlyphBox() if they are valid. Fixes the
font rendering glitch when printing text with leading space character.
2021-10-24 11:21:16 -07:00
Josip Miskovic 09cc73a988 Move text measuring to Rasterizer 2021-10-21 10:42:11 -07:00
bjorn 0a2f968850 Fix circle uvs;
After changing circle scale from diameter to radius, the uvs broke,
since they are calculated from the position.
2021-10-09 03:52:11 -07:00
bjorn fe08dc3769 Fix Mesh:setVertices starting index wraparound crash; 2021-10-09 03:01:40 -07:00
bjorn 6b99862d3d Don't always force AMD mode to true!; 2021-10-03 15:31:29 -07:00
bjorn 48d98a701c Use WebGL buffer path on AMD GPUs;
AHHHHHHHHHHHHH
2021-10-03 15:31:17 -07:00
Josip Miskovic 015a2ed69c Accept number values in Vec2/3/4 operations
Vector methods are extended to receive vectors as individual numbers
for each of x,y,z,w component. The vector objects are still supported
as well.

Previously only single value scalar was supported. This change maintains
backward compatibility.

```
v = vec3():add( 1, 2, 3 )          -- both do the same
v = vec3():add( vec3(1, 2, 3) )    _/

v = vec4():mul( 2 )            -- x component is a default for y, z
v = vec4():mul( 2, 2, 2, 2 )   _/

v = vec2():lerp( 2, 2, 0.5 )        -- in lerp, dot, cross, distance
v = vec2():lerp( vec2(2, 2), 0.5 )  _/   all components are mandatory
```
2021-09-07 14:00:59 -07:00
bjorn a73be7cba0 Fix lovr.headset.getName on Quest 2;
The manifest was not properly marking Quest 2 as a supported device,
so Oculus was pretending to be a Quest 1.
2021-08-12 11:16:18 -07:00
bjorn 8ea24c266c vrapi: Fix recentering; 2021-08-07 09:27:58 -07:00
bjorn 703104c4d1 Fix pico build; 2021-08-04 11:05:29 -07:00
bjorn e2cad4ed81 Fix crash in Material:setTexture; 2021-07-10 09:42:49 -07:00
bjorn f959770396 Add missing OpenVR pointer actions; 2021-06-29 13:09:57 -07:00
bjorn 63320252a1 Fix error when rapidly recreating objects;
If you create and destroy objects quickly (using :release), malloc
might give you the same pointer.  When we look up this pointer in
the userdata cache, it'll give you an invalid Proxy/pointer, which
throws an error like "Calling 'fn' on bad self".

When collecting objects, remove them from the userdata cache.
2021-06-26 14:41:42 -07:00
bjorn 4125796211 Fix shaders with nil stages;
The length was getting kept as zero, need to adjust length when
falling back to default shaders.
2021-06-21 10:22:15 -06:00
Jakob Bornecrantz 93d867a972 Fix AppImage lovr.desktop file
Changes by @darltrash
2021-06-18 15:53:31 -06:00
bjorn 92a08c326f vrapi: getViewPose returns a pose when position is invalid;
To match getViewAngles.  Also simplify mask check.
2021-06-18 15:51:18 -06:00
brainrom 59d3b25932 Able to get view angles with 3DOF 2021-06-18 15:50:28 -06:00
kokokoshka 7e52ffe956 MinGW support 2021-06-18 15:45:26 -06:00
bjorn 526e06d445 Fix mat4 corruption when using vectors;
We correct m[15] to 1.f too late, by that time the undefined 4th
component of the vec3 could have corrupted the rotation/scale.
2021-06-16 16:55:19 -06:00
bjorn 82b7632cea Require material textures to be 2D; 2021-06-12 14:26:39 -06:00
bjorn ca4b7d01bc Allow passing vec2 as scale argument;
Useful for planes.
2021-05-31 15:05:13 -06:00
bjorn 46a5c83a08 rm unused variables; 2021-05-31 15:04:24 -06:00
bjorn 89550e55d6 Fix oculus hand model orientation;
- Previously, animate was converting from oculus basis to lovr basis.
- Not all hand models are animated.
- Instead, apply the compensation in newModel.
- This means that both animated and non-animated models have correct orientation.
- Verified that regular getPose is returning correct rotation as well.
2021-05-31 14:35:53 -06:00
Ilya Chelyadin b6c3a8fa17 All-in-One Lua loader 2021-04-30 18:50:35 -06:00
bjorn 0a9956db60 phonon: Fix crash when setGeometry fails;
The call to `free` above was fixed, but the one in the error case
was not.
2021-04-27 22:15:15 -06:00
bjorn 09c1fe8117 Improve luax_readmesh error handling; 2021-04-23 12:55:21 -06:00
Jakob Bornecrantz 28a0356a9a Add overlay support for OpenXR 2021-04-16 14:20:05 -06:00
Jakob Bornecrantz 70ef04e595 Add overlay parameter to headset init 2021-04-16 14:20:05 -06:00
Jakob Bornecrantz 909b43f34a Order OpenXR extension adding 2021-04-16 14:20:05 -06:00
Josip Miskovic 8b5d3af9b8 Allow using alpha with hexcode when setting color
Implements #411 proposal
2021-04-15 10:24:35 -06:00
Jakob Bornecrantz b02c30a0e4 Make bin directory AppImage ready 2021-04-13 11:03:57 -06:00
mcc d558996206 Hold lock when changing geometry (prevents crash, see issue #403) 2021-04-12 13:01:54 -06:00
bjorn fa47ecbdd3 v0.15.0; 2021-04-11 08:57:11 -06:00
bjorn 7b7c3132b8 vrapi: Fix lovr.headset.animate flipping left hand; 2021-04-11 08:15:17 -06:00
bjorn 70bbbc4549 Use pulseaudio on linux; 2021-04-11 07:19:49 -06:00
bjorn 046762c564 WebXR: Fix isDown; Fix hand tracking; 2021-04-10 19:41:37 -06:00
bjorn d2a9e230bf Rework Sound:getFrames;
It follows a more predictable argument order.

Fixed crash when reading frames into Blob.
2021-04-05 12:52:16 -06:00
bjorn 1ef99882f7 Fix Mesh vertex map memory leak; 2021-04-05 10:24:43 -06:00
bjorn f565a7b69b rm linking to OpenSLES; 2021-04-03 18:42:34 -06:00
bjorn df6b6516d6 Add required Oculus manifest entries; Add debuggable; 2021-04-03 18:42:34 -06:00
bjorn 3b61dfc8c9 miniaudio: Use AAudio instead of OpenSL; 2021-04-03 18:42:34 -06:00
bjorn 419f281291 rm oculus go support; add oculus quest 2 support;
Rest in pieces, oculus gone.
2021-04-03 18:42:34 -06:00
bjorn 5106aaf74c Audio listener/source default to identity orientations; 2021-04-03 18:38:27 -06:00
bjorn 2b94bcb46e Add quat_identity; 2021-04-03 18:38:23 -06:00
bjorn 609d7e05ce simple spatializer supports directivity;
Also coming soon to an oculus spatializer near you.
2021-04-03 18:22:23 -06:00
bjorn 19620c7682 wasm: Use default miniaudio buffer size.
Audio currently stutters on the wasm build.  It is much more severe
in Chrome than in Firefox (very rare/subtle in Firefox).  miniaudio
is currently using ScriptProcessorNode, which is deprecated because
it processes audio on the main thread.  There's a new API that lets
you programmatically process audio on a thread called AudioWorklet,
but it's hella complicated.  miniaudio doesn't want to support this
because it's complicated and requires a separate JavaScript request
but it seems like it would be possible to work around using a Blob.
In the meantime, miniaudio bumps up the buffer size on WebAudio, so
let's just use that in hope that it helps.
2021-04-03 18:04:26 -06:00