diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-23 00:31:25 +0000 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-23 00:31:25 +0000 |
| commit | d8a3201fa574dcbc60fac2fe4543ea5b5b970823 (patch) | |
| tree | e0cca88d0ddd7d82cac108a3ccc0c713994d0ddc /tools | |
| parent | 53826fa5b52a1ceffdb16a5f0236f92b5897a10a (diff) | |
fix(first-light): reject OBJ UVs that overflow binary32
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/first_light.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/first_light.py b/tools/first_light.py index f7db7319d..e9bac376b 100644 --- a/tools/first_light.py +++ b/tools/first_light.py | |||
| @@ -186,6 +186,10 @@ def read_obj( | |||
| 186 | raise SystemExit(f"{path}: invalid texture coordinates: {line.strip()!r}") from None | 186 | raise SystemExit(f"{path}: invalid texture coordinates: {line.strip()!r}") from None |
| 187 | if not (math.isfinite(u) and math.isfinite(v)): | 187 | if not (math.isfinite(u) and math.isfinite(v)): |
| 188 | raise SystemExit(f"{path}: non-finite texture coordinates: {line.strip()!r}") | 188 | raise SystemExit(f"{path}: non-finite texture coordinates: {line.strip()!r}") |
| 189 | try: | ||
| 190 | struct.pack("<2f", u, v) # Validate the mesh encoding before opening the output. | ||
| 191 | except OverflowError: | ||
| 192 | raise SystemExit(f"{path}: texture coordinates exceed the binary32 range: {line.strip()!r}") from None | ||
| 189 | uvs.append((u, v)) | 193 | uvs.append((u, v)) |
| 190 | elif p[0] == "f": | 194 | elif p[0] == "f": |
| 191 | face = [] | 195 | face = [] |