Commit Graph

229 Commits

Author SHA1 Message Date
bjorn cdecc1bae7 Add defer system; Rework exceptions; util cleanup;
Defer can be used to clean up resources when an error occurs.
2024-03-29 18:10:22 -07:00
bjorn 67e228125b Add d24 TextureFormat;
LÖVR uses d32f by default, but that's not guaranteed to be supported.

However, GPUs must support either d32f or d24, so we can fall back to
d24 reliably.
2024-03-29 18:07:25 -07:00
bjorn d097d9819d Add wrappers for malloc functions; 2024-03-11 14:38:00 -07:00
bjorn 2d7b636a90 Change more asserts to checks; 2024-03-11 00:58:21 -07:00
bjorn 0d8d6f579b rm unused lovrImageClear prototype; 2024-03-11 00:57:59 -07:00
Bjorn d23164235b
Merge pull request #732 from bjornbytes/model-vertex-compression
Model Vertex Compression
2024-01-31 13:35:58 -08:00
bjorn 215e042e05 Add lovrUnreachable branch; 2024-01-31 12:52:29 -08:00
bjorn 35f97f08f3 glTF: support glb models without BIN chunk; 2024-01-29 00:29:23 -08:00
bjorn 40d85c6a16 Model uses sn10x3 normals and tangents;
This shaves 20 bytes off of each model vertex, or around 40% savings.
The vertex size is also a power of two which results in extreme amounts
of style points.
2024-01-20 17:39:36 -08:00
bjorn 90a14478a3 lovrImageCreateRaw takes sRGB flag; Fix readback encoding;
Roundtripping pixels through a readback preserves sRGB encoding.
2023-11-02 13:38:21 -07:00
bjorn f0686f0115 Update msdfgen; Orient contours properly;
This fixes issues where some fonts would have glyphs with weird windings
and they would get rendered inside-out.

Unfortunately updating msdfgen increased its size by a factor of 2-3x.
2023-10-03 11:12:38 -07:00
bjorn 5b6d882475 Add Image:mapPixel; 2023-09-11 18:48:46 -07:00
bjorn be213cc32d Cleanup; 2023-09-11 17:24:27 -07:00
Bjorn c38165a154
Merge pull request #688 from bjornbytes/mesh
Mesh
2023-07-29 18:21:01 -07:00
bjorn 53ae77f123 Merge branch 'master' into dev 2023-07-29 03:40:36 -07:00
bjorn 072452a4da Fix issue where OBJ UVs are upside down;
Most OBJ loaders use OpenGL texture coordinate conventions.

After switching to Vulkan, the UV origin became upper-left and images no
longer needed to be flipped on import.  This means that the OBJ importer
now needs to flip its UVs to compensate.  Somehow, no one noticed until
now!  Most people are using glTF I guess.
2023-07-29 03:37:18 -07:00
bjorn 4892d228b3 WIP; 2023-07-24 15:34:44 -07:00
bjorn be795c0ebd Change vec3 back to 3 floats; Clean up maf/vectors;
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.
2023-07-10 17:51:24 -07:00
bjorn 6a915a2993 Fix issue with mesh-multiple-skin check; 2023-06-25 19:16:34 -07:00
bjorn d17232bac5 Fix warning; 2023-06-23 18:28:17 -07:00
bjorn b9e14a8f2d Merge branch 'master' into dev 2023-06-21 16:52:10 -07:00
bjorn 06811dcb1a Fix lovr.graphics.newModel when model has unused meshes;
Prefer n^2 loop over a weird sentinel value that wasn't always getting written over.
2023-06-21 16:50:24 -07:00
bjorn aa12263a29 Fix 24-bit WAV import; 2023-06-03 22:55:40 -07:00
bjorn 4100be4f23 Fix vertex color import when model stores it as VEC3; 2023-05-27 12:04:35 -07:00
bjorn 4a6de6caf5 Write blend shape compute shader; Bugfixes; 2023-03-31 18:45:16 -07:00
bjorn 3b1414deac Ok redesign blend shapes but they're good now; 2023-03-31 18:44:29 -07:00
bjorn b118ac1938 Terrible blend shape Lua API; 2023-03-31 18:43:16 -07:00
bjorn b1b78319b5 Model loads blend shape data and weights; 2023-03-31 18:42:45 -07:00
bjorn 21bb3eb096 ModelData parses blend shapes; 2023-03-31 18:39:39 -07:00
bjorn ffd6396aae Error when model uses absolute path; Ignore ./ in model paths;
Fixes #652
2023-03-13 21:14:47 -07:00
bjorn 886db5f91d Stop using isdigit in obj importer; 2023-02-25 00:00:04 -08:00
bjorn b6d8546a6f Merge branch 'master' into dev 2023-01-02 16:46:55 -08:00
bjorn 886e3bb42f Fix some windows warnings; 2022-12-19 14:01:30 -08:00
bjorn e12563ad25 Merge branch 'master' into dev 2022-12-16 21:21:05 -08:00
bjorn efc81e4cec Fix some gcc warnings; 2022-12-03 01:20:02 -08:00
s-ol 043f9c7920 store headset model metadata for animations 2022-11-22 12:24:57 +01:00
s-ol 533e02771e throw when model references external asset but no 'io' is given 2022-11-22 12:24:31 +01:00
bjorn 9277b38273 Use fancy syntax for model data map indices;
Matches nodes.
2022-11-14 19:20:29 -08:00
bjorn c61d6b059b Merge branch 'master' into dev 2022-11-14 19:19:17 -08:00
s-ol 7dbdda1205 Fix node indexing for GLTF models with multiple root nodes 2022-11-14 08:02:13 -08:00
bjorn cacc5eae71 ModelData:getTriangles reuses vertices better;
ModelData:getTriangles currently adds a fresh set of vertices for every
mesh in a node.  This is technically correct, but it wastes space when 2
nodes reference the same set of vertices with different index buffers,
which is pretty common when a node has multiple materials.  It also
breaks ODE, who doesn't like it when vertices outnumber indices too
much.
2022-11-09 22:22:51 -08:00
bjorn 2e0b5a4efa Flip msdf glyphs;
They don't look right when using a negative y scale for some reason,
even though the rendering was still working.
2022-09-22 20:30:04 -07:00
bjorn bcde681710 Mark ASTC textures as sRGB;
They don't contain this metadata, but marking as sRGB is more reasonable
than not.
2022-09-10 23:55:15 -07:00
bjorn 8697466009 Shader flag adjustments;
- glowTexture is on by default, but still requires the glow flag.
- occlusionTexture is named ambientOcclusion, and is on by default,
  but is still not used by any builtin shaders/helpers.
2022-09-02 15:33:18 -07:00
bjorn d3c93634ad Fix KTX1 cube/array loading; 2022-08-23 20:17:19 -07:00
bjorn 0496b81f23 Improve KTX1 error messages; 2022-08-23 20:16:58 -07:00
bjorn b8df6f9651 Fix rg11b10f KTX1 loading, I think; 2022-08-23 20:15:36 -07:00
bjorn 1a809666ec Fix loading KTX files with mipmaps;
Forgot to allocate memory for mipmaps.
2022-08-23 20:15:16 -07:00
bjorn dd5e89523d Fix BC1/BC4 sizes; 2022-08-19 23:15:18 -07:00
bjorn 6052ed7a95 Rename ModelData enums;
To better match graphics.
2022-08-13 21:10:03 -07:00