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.
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.
This enables a few things:
- Custom vector methods can be added/replaced.
- Vector methods can be called as non-methods e.g. vec3.normalize(v)
- Possibility for vector constants in an __index metamethod.
This was measured as increasing overhead by 3.5% when creating temporary
vectors (2ns), which is arbitrarily deemed acceptable.
They are now destroyed explicitly after tearing down the Lua state
instead of relying on finalizers. It's definitely annoying to make it
coordinated in a centralized way like this instead of being distributed,
but there's not really any reliabel way to ensure that graphics objects
are destroyed before the graphics module/device is destroyed, which is a
problem.
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} )`
conf doesn't work in threads. While this seems problematic, it can
kinda be considered the right thing. Right now the math module can't
be required at all in threads which seems bad, so we'll make it work
and just ignore the "globals" flag for now.
- Ref struct only stores refcount now and is more general.
- Proxy stores a hash of its type name instead of an enum.
- Variants store additional information instead of using a vtable.
- Remove the concept of superclasses from the API.
- Clean up some miscellaneous includes.