upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/first_light.py
diff options
context:
space:
mode:
authorVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-23 00:31:25 +0000
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-23 00:31:25 +0000
commitd8a3201fa574dcbc60fac2fe4543ea5b5b970823 (patch)
treee0cca88d0ddd7d82cac108a3ccc0c713994d0ddc /tools/first_light.py
parent53826fa5b52a1ceffdb16a5f0236f92b5897a10a (diff)
fix(first-light): reject OBJ UVs that overflow binary32
Diffstat (limited to 'tools/first_light.py')
-rw-r--r--tools/first_light.py4
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 = []