Commit Graph

3791 Commits

Author SHA1 Message Date
bjorn b22dbd8f0c Add luax_checku32 and luax_optu32;
These functions read an unsigned 32 bit integer from the Lua stack
and error if the value is negative or too big.  Currently converting
Lua numbers to integers will silently wrap or invoke undefined behavior
when they are outside of the acceptable range.

For projects that don't want the overhead of type/bounds checks, the
supercharge build option (LOVR_UNCHECKED) can now be used to skip all
type/bounds checks.
2022-02-21 14:19:24 -08:00
Josip Miskovic 517b104c1e Fix NaN handling when calculating angle for mat4
The arccos was incorrectly calculated when cosangle was larger than 1.0
2022-02-21 14:18:49 -08:00
bjorn a6a86fd908 lovr.filesystem.getDirectoryItems works if table.sort is unavailable;
It just doesn't sort the output.
2022-02-21 14:04:58 -08:00
bjorn 88f367c0e5 Declare data module constructors consistently; 2022-02-21 14:01:47 -08:00
bjorn a6747f97ea Sound:getByteStride; 2022-02-21 14:00:36 -08:00
bjorn bfb73f0c19 Improve Sound:getFrames Blob error message;
Probably need a generic "out of range" template, but this makes things
better for now.
2022-02-21 13:58:46 -08:00
Josip Miskovic 110333fce7 Fix gamma/linear conversion of a RGB table
Correcting the order of stack operations to fetch RGB components from
the table and to put in conversion the results.

Before the fix these two calls produced different results:
`lovr.math.gammaToLinear(  0.1, 0.2, 0.3  )`
`lovr.math.gammaToLinear( {0.1, 0.2, 0.3} )`
2022-02-19 22:21:35 -08:00
bjorn 9428b36986 Fix OpenVR driver; 2022-02-11 18:37:21 -08:00
bjorn 3f87393e04 Silence ode warning; 2022-02-02 14:37:11 -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 63246d60aa Year; 2022-01-01 02:08:46 +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 9ff00ae789 tup: use d8 instead of dx; 2021-12-07 18:20:03 +02:00
Nevyn Bengtsson 06dd81f6d7 Use d8 instead of dx
dx was deprecated years ago, and d8 replaces it. dx is
removed in build-tools 31, so it's best not to depend on it.

In addition, d8 now supports Java 11 (class version 55), which
is required to use the javac bundled with Android Studio.
2021-12-07 08:17:56 -08: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 743be341f4 tup: prettier clang error colors; 2021-10-31 12:06:03 -07:00
bjorn af6ae0cfbb Fix VrApi casing; 2021-10-28 14:36:31 -07:00
bjorn ce43386a42 Update tup config;
- tup.config can now override Lua config values
- comment some of the config values
2021-10-28 14:35:05 -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
bjorn cb56d7713a Update README; 2021-09-26 10:01:53 -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 5aa0da0df5 tup: buildtoolsversion -> buildtools; native target instead of nil; 2021-08-19 12:22:14 -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