Reconstruct lab story, interactions, patrol and jet pack practice flow

This commit is contained in:
UnixNight committed 2026-10-24 20:33:03 -04:00
1 parent 58424120bb
commit c929f942e1
84 files changed
+7957 -305

No files matched your search

+5 -2
View File
@@ -265,12 +265,13 @@ def export_scene(database: Database, output: Path):
scene = {'source': database.path.name, 'sha256': hashlib.sha256(database.data).hexdigest(),
'coordinates': 'Original OMT world coordinates, unchanged',
'vertices': [], 'uvs': [], 'normals': [], 'indices': [], 'meshes': [],
'materials': [], 'textures': [], 'warnings': []}
'materials': [], 'textures': [], 'warnings': [], 'collisionPolygons': []}
material_names = {entry.id: entry.name for entry in database.entries if entry.type == '3DMa'}
for entry in database.entries:
payload = database.payload(entry)
if entry.type == '3DSh':
shape = read_shape(payload)
for poly in shape['polygons']:
for polygon_index, poly in enumerate(shape['polygons']):
first_index = len(scene['indices'])
first_vertex = len(scene['vertices'])
for corner in poly['corners']:
@@ -280,6 +281,8 @@ def export_scene(database: Database, output: Path):
scene['normals'].append(shape['normals'][ni] if ni < len(shape['normals']) else poly['normal'])
for i in range(1, len(poly['corners'])-1):
scene['indices'].extend((first_vertex, first_vertex+i, first_vertex+i+1))
scene['collisionPolygons'].append({'shapeId': entry.id, 'polygonIndex': polygon_index,
'normal': poly['normal'], 'materialName': material_names.get(poly['material']['id']) if poly['material'] else None})
if len(poly['corners']) > 3:
scene['warnings'].append(f'{entry.id}: polygon with {len(poly["corners"])} corners fan triangulated; concavity not validated')
material = poly['material']['id'] if poly['material'] else -1