Commit Graph

3267 Commits

Author SHA1 Message Date
bjorn 9428b36986 Fix OpenVR driver; 2022-02-11 18:37:21 -08:00
bjorn 6f3e46d8cf Fix some pointer formatting; 2022-02-02 12:01:38 -08:00
bjorn 3ff64fa3ef OpenXR: Fix instance extension enumeration; 2022-01-29 15:31:44 -08:00
bjorn 7ed47e946b Fix problem when requiring audio/graphics/headset in threads;
These modules access the conf table, which isn't available on threads.
2022-01-16 12:13:46 -08:00
bjorn 599bbc5cf4 Fix off by one error in texture limit; 2022-01-10 00:03:01 -08:00
bjorn 07074a39a8 mv os_web os_wasm;
Gotta pick a consistent name.
2022-01-06 22:23:21 +02:00
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 20e4567bd6 Merge branch 'master' into dev 2021-12-20 17:12:39 +02:00
bjorn 255ecbb4d8 Fix stencil color mask;
- When calling lovr.graphics.stencil, the color mask is initially
  disabled, and gets restored to its initial state afterwards.
- However, when it's restored, it uses lovrGraphicsSetColorMask, which
  just sets shadow state that doesn't make it all the way to GL until
  another draw is done.
- The consequence of this is that if you call .stencil and then don't do
  a draw, any clears that happen will use the old (disabled) color mask,
  preventing the color buffer from being cleared.
- The solution here is to lower the color mask change down into opengl.c
  where it can directly hit OpenGL.
2021-11-24 12:25:57 -08:00
bjorn e283245dc6 Remove suspicious friction override; 2021-11-12 12:20:21 -08:00
bjorn 6fb5885e9b Fix glb loading; 2021-11-05 18:47:03 -07:00
bjorn 998b355e30 Make some private functions static; 2021-10-31 12:35:49 -07:00
bjorn ebeee33298 Fix lovrAudioGetSampleRate prototype; 2021-10-31 12:09:33 -07:00
bjorn af6ae0cfbb Fix VrApi casing; 2021-10-28 14:36:31 -07: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 61730dd89b ModelData exposes its animations; 2021-10-08 14:25:03 -07:00
bjorn 00e6e20595 Details; 2021-10-08 14:12:44 -07:00
bjorn b3a5a14c2d ModelData exposes its skins;
ew
2021-10-08 14:12:30 -07:00
bjorn 3bfe2ee3d5 ModelData exposes its materials; 2021-10-08 13:58:34 -07:00
bjorn e5efe890f9 ModelData exposes its meshes; 2021-10-08 13:47:08 -07:00
bjorn bfa155a103 ModelBuffer tracks more blob info; 2021-10-08 13:46:42 -07:00
bjorn ff680f7882 ModelData exposes nodes; 2021-10-08 12:49:31 -07:00
bjorn e3fab5e107 ModelData exposes its Blobs and Images; 2021-10-08 11:46:08 -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 04d6996b94 Font:getWidth also returns width of last line; 2021-09-06 16:14:47 -07:00
bjorn 8a1b38237a Indentation; 2021-09-04 11:30:56 -07:00
bjorn 1fdaa797ac Error on enabling an effect on a Source with effects disabled; 2021-08-12 11:25:51 -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
mcc 25ffcf9dd1 Add new XML attributes required for Oculus submission 2021-08-04 11:15:54 -07:00
bjorn 703104c4d1 Fix pico build; 2021-08-04 11:05:29 -07:00
mcc 9f96917d91 Fix horizontal rotation bug in Oculus spatializer 2021-07-26 11:24:04 -07:00
mcc db28be591a Fix incomplete LOVR_ENABLE PHONON/OCULUS define change 2021-07-23 09:55:16 -07:00
bjorn 95d23e8739 Fixup; 2021-07-20 11:31:16 -07:00
mcc 52db969622 Remove DEFAULT_SAMPLE_RATE 2021-07-20 11:28:48 -07:00
mcc a0a242a610 Fix types/naming to standard style 2021-07-20 11:28:48 -07:00
mcc 56138492f2 Allow get sample rate in conf.lua, read back with lovr.audio.getSampleRate() 2021-07-20 11:28:48 -07:00
mcc 2a73310198 Fix distance attenuation in Oculus spatializer 2021-07-20 11:23:32 -07:00
bjorn bb78d266b4 DESKTOP_HEADSET -> DESKTOP; 2021-07-18 22:24:00 -07:00
bjorn ecd7769ba0 Convert Tupfile to Lua; 2021-07-18 22:24:00 -07:00
mcc 39dca2f093 Fix lovr.audio.setPose() in oculus spatializer mode 2021-07-18 20:39:46 -07:00
bjorn fdb8a2423c Merge branch 'master' into dev 2021-07-10 09:44:03 -07:00
bjorn e2cad4ed81 Fix crash in Material:setTexture; 2021-07-10 09:42:49 -07:00
bjorn 7984baad65 os_linux: implement virtual memory allocator; 2021-07-09 18:39:23 -07:00
bjorn f959770396 Add missing OpenVR pointer actions; 2021-06-29 13:09:57 -07:00
bjorn 8ef2b064fd Fix ShaderBlock:send(Blob) error message; 2021-06-28 22:39:16 -07:00
bjorn b70f8e2d1a Fix and separate ShaderBlock:send(Blob) offset arguments;
- You were able to write a Blob to a ShaderBlock
- Using ShaderBlock:send(Blob, offset, size)
- It was not flexible enough and it was broken
  - The data was read from `offset` bytes into the Blob.
  - The data was written to the beginning of the Buffer.
  - The Buffer was flushed at `offset` bytes into the Buffer.
- This commit changes the signature of the variant
- to ShaderBlock:send(Blob, srcOffset, dstOffset, size)
- and hopefully fixes the behavior.
- Also why is this entire commit description a bulleted list
2021-06-28 22:32:11 -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 f4ac1ef422 Minor unreachable fix;
Would like to keep unreachable throws consistent.
2021-06-24 14:47:48 -07:00
mcc caf9428ff1 Fix compile on macos 10.13 2021-06-24 15:47:30 -06: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
Jakob Bornecrantz 1842d9e6bb Fix AppImage lovr.desktop file
Changes by @darltrash
2021-06-18 15:53:13 -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 88000579ff Don't call start on tracking drivers;
Start is mainly used for setting up graphics-related stuff, since it
was created to perform setup after the window/graphics module is
initialized.  Since the display driver is the only one doing rendering,
it makes sense to only call start on the display driver.

...also fixes a bug where start is getting called twice.
2021-06-16 16:15:08 -06:00
bjorn 0582746137 Fix OpenXR compilation; 2021-06-12 14:42:30 -06:00
bjorn 82b7632cea Require material textures to be 2D; 2021-06-12 14:26:39 -06:00
bjorn 69a22afed4 Fix vrapi compilation; 2021-06-12 14:15:00 -06:00
bjorn 92400df89d lovr.headset.init -> lovr.headset.start;
- We need some headset initialization to happen upfront
- But we still want some delayed initialization for when graphics is ready
- Go back to headset initialization happening when module is required
- Add lovr.headset.start that can be used for post-graphics init
2021-06-10 17:26:15 -06:00
bjorn 7dc54cc264 Add lovrCheck macro;
lovrCheck is a new way of performing runtime assertions.

It's identical to lovrAssert, except it's compiled out if
LOVR_UNCHECKED is defined.

It is meant to be used for non-mission-critical validation, for
example proper usage of types passed to the Lua API.  lovrAssert
should still be used to check return values from platform APIs.
2021-06-05 11:12:00 -06:00
bjorn 053c318995 Fix depth test;
- Use incoming depth settings to determine whether depth test should be
  enabled or disabled (wtf)
- Always track state.depthTest, even if depth test is disabled
2021-06-01 12:58:02 -06:00
bjorn bf627e1e3e Allow passing vec2 as scale argument;
Useful for planes.
2021-06-01 09:59:38 -06:00
bjorn a9e22a37c2 rm unused variables; 2021-06-01 09:59:38 -06:00
bjorn 907305e430 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-06-01 09:59:38 -06:00
Ilya Chelyadin ce3470a6e6 All-in-One Lua loader 2021-06-01 09:59:38 -06:00
bjorn a45fab4416 vrapi: map pinch to trigger axis; 2021-06-01 09:59:38 -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
Nevyn Bengtsson ff4f594a62 switch back from aaudio to opensl
because capture on quest is broken with miniaudio's aaudio backend :/
2021-05-31 09:07:38 -06:00
Nevyn Bengtsson 28abb7270d Omit main() function if requested 2021-05-31 09:07:38 -06:00
Nevyn Bengtsson 7b70fac0bb mic permissions code for macos 2021-05-31 09:07:38 -06:00
Nevyn Bengtsson 9c37a6cdc8 don't include main/winmain in dll build
otherwise the parent app can't define a main of its own
2021-05-31 09:07:38 -06:00
Nevyn Bengtsson 62a2d01daf API for Sound:getCapcity 2021-05-31 09:07:38 -06:00
Nevyn Bengtsson 6566423f66 Sound:setFrames should use a stream's write buffer size, not read buffer size
otherwise you can never fill up a stream from scratch
2021-05-31 09:07:38 -06:00
Nevyn Bengtsson 9f45e7a9c5 I think audio:setDevice requires this permission 2021-05-31 09:07:38 -06:00
Ilya Chelyadin b6c3a8fa17 All-in-One Lua loader 2021-04-30 18:50:35 -06:00
bjorn 25bb12d07c Native textures don't destroy their handles;
If a Texture is created from a handle, that means someone else created
it, so we expect them to destroy it.  We were always destroying handles,
and I guess this was usually okay because glDeleteTextures is idempotent.

However, we're seeing a crash in the Oculus driver when OVR is torn
down.  Presumably it is trying to access its swapchain textures after we
destroyed them.  Not sure why this wasn't an observable issue before,
maybe it's a new regression.  Still, it makes sense to only delete the
GL texture handle if we were the one that created it.

We don't need to check this for the renderbuffer since we always own those.
2021-04-27 22:24:42 -06:00
bjorn 51f81c9db6 Switch back to ALSA on Linux; 2021-04-27 22:20:56 -06:00
bjorn 87bf9c7b27 Merge branch 'master' into dev 2021-04-27 22:20:38 -06:00
bjorn 4a4aff210d Upgrade miniaudio; 2021-04-27 22:17:07 -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
bjorn 159243190b rm some unnecessary includes; 2021-04-20 20:08:30 -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
bjorn f2590078a9 Don't always force AMD mode to true!; 2021-04-14 10:41:14 -06:00
Jakob Bornecrantz b02c30a0e4 Make bin directory AppImage ready 2021-04-13 11:03:57 -06:00