diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:12:59 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:12:59 -0500 |
| commit | 9c2508e6af1a1f150c19ab7cada91d8e7b929dc9 (patch) | |
| tree | 9556557b4a22aebab2fde5db228608b59f76b643 /tools/first_light.py | |
| parent | 286821bc104c5759cacf15b80f126f491462095e (diff) | |
| parent | d8a3201fa574dcbc60fac2fe4543ea5b5b970823 (diff) | |
Merge pull request #4270 from Vonsek
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/first_light.py')
| -rw-r--r-- | tools/first_light.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/first_light.py b/tools/first_light.py index c55bced05..74540eb5e 100644 --- a/tools/first_light.py +++ b/tools/first_light.py | |||
| @@ -246,9 +246,16 @@ def read_obj( | |||
| 246 | if len(p) < 3: | 246 | if len(p) < 3: |
| 247 | raise SystemExit(f"{path}: short texture-coordinate line: {line.strip()!r}") | 247 | raise SystemExit(f"{path}: short texture-coordinate line: {line.strip()!r}") |
| 248 | try: | 248 | try: |
| 249 | uvs.append(tuple(float(x) for x in p[1:3])) | 249 | u, v = map(float, p[1:3]) |
| 250 | except ValueError: | 250 | except ValueError: |
| 251 | raise SystemExit(f"{path}: invalid texture coordinates: {line.strip()!r}") from None | 251 | raise SystemExit(f"{path}: invalid texture coordinates: {line.strip()!r}") from None |
| 252 | if not (math.isfinite(u) and math.isfinite(v)): | ||
| 253 | raise SystemExit(f"{path}: non-finite texture coordinates: {line.strip()!r}") | ||
| 254 | try: | ||
| 255 | struct.pack("<2f", u, v) # Validate the mesh encoding before opening the output. | ||
| 256 | except OverflowError: | ||
| 257 | raise SystemExit(f"{path}: texture coordinates exceed the binary32 range: {line.strip()!r}") from None | ||
| 258 | uvs.append((u, v)) | ||
| 252 | elif p[0] == "f": | 259 | elif p[0] == "f": |
| 253 | face = [] | 260 | face = [] |
| 254 | for word in p[1:]: | 261 | for word in p[1:]: |