Commit Graph

728 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 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
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 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
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
bjorn 82b7632cea Require material textures to be 2D; 2021-06-12 14:26:39 -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
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
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
mcc d558996206 Hold lock when changing geometry (prevents crash, see issue #403) 2021-04-12 13:01:54 -06:00
bjorn 7b7c3132b8 vrapi: Fix lovr.headset.animate flipping left hand; 2021-04-11 08:15:17 -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 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
bjorn 024498b964 Source:clone fixes;
Clones no longer try to create converters if they aren't needed, which
was causing an error.

Also handle malloc failure.
2021-04-03 09:49:27 -06:00
bjorn 4469fc99e8 Fix mixer bug; Refactor mixer;
- Sources without converters always read into the beginning of the
  raw buffer, overwriting previous frames if the source was rewound
  due to looping.  This resulted in an audible click whenever the
  source was rewound.
- After looping, Sources without converters would try to read too
  many frames -- they would read a full buffer instead of only the
  necessary number of frames.
2021-04-02 23:36:30 -06:00
bjorn 6ae0d9f96a phonon works by default when no mesh is provided; 2021-04-02 23:35:18 -06:00
mcc 6b099e467f Encapsulate "uses spatializer?" nature in lovrSourceUsesSpatializer
Also, remove accessor prototype for old IsSpatial() function
2021-04-02 14:16:39 -06:00
bjorn 82a309a56d Draft new effects API;
- A list or map of effects can be provided to newSource.
- false can be used to bypass effects.
- All effects are enabled by default.
  - Occlusion-y effects should only take effect when setGeometry is called
    - Spatializer is responsible for ensuring this.
2021-04-01 16:46:16 -06:00
bjorn cfe0d71520 audio: throw if miniaudio fails to initialize;
This prevents a situation where miniaudio fails to initialize but the
audio module is still usable.
2021-03-31 14:01:30 -06:00
bjorn eb8b559e88 phonon: Fix freeing incorrect variable; 2021-03-30 12:45:24 -06:00
Josip Miskovic f6fbc2ad17 Route ODE messages into LOVR log system
ODE errors, debugs and messages are redirected into LOVR's log system
by a callback mechanism for each.

The ODE submodule is updated to revision that does not crash when error
or debug occurs.
2021-03-28 17:34:11 -06:00
bjorn 948b77b7fa phonon doesn't try to make a mesh if there are no vertices; 2021-03-26 10:30:08 -06:00
bjorn 6413a6eda2 Fix Model:getTriangles; Add Lua API; 2021-03-25 12:29:11 -06:00
bjorn e1195a92a0 lovrModelGetTriangles; 2021-03-25 12:29:11 -06:00
bjorn 3a35f81918 Fix underscores not printing;
Signed arithmetic strikes again.  Before the padding was configurable,
padding was just a #define'd constant, so signedness didn't matter.
2021-03-25 12:18:48 -06:00
bjorn 895589c914 Add even more padding to stb zlib; 2021-03-24 21:13:04 -06:00
bjorn 634e7210bf Make Source:clone suck less; 2021-03-23 14:31:04 -06:00
bjorn 5ef5ac5f22 I am once again fixing the mixer EOF case; 2021-03-23 14:31:04 -06:00
bjorn 6a79ffb34a rm Source::blend; 2021-03-23 14:31:04 -06:00
bjorn de5099badd rm SourceInterpolation; 2021-03-23 14:31:04 -06:00
bjorn 98f33dc131 mv falloff attenuation; 2021-03-23 14:31:04 -06:00
mcc e3c2b5b865 Fix Android build
- Fix typos after refactor
- Fix CMake when using ANDROID_PACKAGE
2021-03-22 14:09:16 -06:00
bjorn b1f7a6c11d Add optional VolumeUnit to get/setVolume functions;
Volume can be specified in linear units or dB.
2021-03-19 17:20:48 -06:00
bjorn c1c15c46db Don't share ma_data_converters between Sources;
It causes distortions when resampling is involved.
2021-03-18 16:31:14 -06:00
bjorn 96e0cc8b9b Fix mixer bug when reaching end of source; 2021-03-18 13:47:04 -06:00
bjorn 369bd5d8b4 Clamp source/listener volumes to 0-1 range;
Prevents miniaudio errors and horrible clipping on bad input.
2021-03-18 13:06:11 -06:00