Skip to content

Commit 87d4297

Browse files
committed
feat: add cubemap stitching module with cross-layout and equirectangular support via OpenCL
1 parent e5e6866 commit 87d4297

1 file changed

Lines changed: 20 additions & 30 deletions

File tree

src/forms/cubemap_maker/worker.py

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,7 @@ def load_local_faces(self, ss_dir, ev_suffix, session_id):
3030

3131
for name in face_names:
3232
pattern = os.path.join(ss_dir, f"{session_id}_cube_{ev_suffix}_{name}*.png")
33-
34-
# Retry mechanism for file appearance (Source 2 can be slow to flush to disk)
35-
files = []
36-
for _ in range(15): # Try for 3 seconds
37-
files = glob.glob(pattern)
38-
if files:
39-
break
40-
time.sleep(0.2)
41-
33+
files = glob.glob(pattern)
4234
if not files:
4335
raise FileNotFoundError(f"Missing face: {name} for session {session_id}")
4436

@@ -140,43 +132,43 @@ def run(self):
140132
time.sleep(0.5)
141133

142134
# Build command list to avoid semicolon issues in netcon
143-
t = 0.2 # Increased tick interval for stability
135+
t = 0.1 # Tick interval
144136
cmds = [
145137
"sv_cheats 1", "noclip 1", "r_drawviewmodel 0", "cl_drawhud 0", "r_drawpanorama 0", "cl_firstperson_legs 0",
146138
"fov_cs_debug 106.260205", "ent_fire cmd kill", "ent_create point_servercommand {targetname cmd}",
147139
"screenshot_subdir screenshots\\\\cubemap",
148140
'ent_fire worldent addoutput "OnUser1>cmd>command>r_always_render_all_windows true>0.01>1"',
149141
# Forward
150142
f'ent_fire worldent addoutput "OnUser1>cmd>command>setpos_exact {x} {y} {z}>{1*t}>1"',
151-
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 1 0 0>{1*t}>1"',
152-
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_forward>{1*t + 0.05}>1"',
153-
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{1*t + 0.1}>1"',
143+
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 3 0 0>{1*t}>1"',
144+
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_forward>{1*t + 0.01}>1"',
145+
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{1*t + 0.02}>1"',
154146
# Right
155147
f'ent_fire worldent addoutput "OnUser1>cmd>command>setpos_exact {x} {y} {z}>{2*t}>1"',
156-
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 0 270 -1>{2*t}>1"',
157-
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_right>{2*t + 0.05}>1"',
158-
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{2*t + 0.1}>1"',
148+
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 0 270 -3>{2*t}>1"',
149+
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_right>{2*t + 0.01}>1"',
150+
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{2*t + 0.02}>1"',
159151
# Back
160152
f'ent_fire worldent addoutput "OnUser1>cmd>command>setpos_exact {x} {y} {z}>{3*t}>1"',
161-
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact -1 180 0>{3*t}>1"',
162-
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_back>{3*t + 0.05}>1"',
163-
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{3*t + 0.1}>1"',
153+
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact -3 180 0>{3*t}>1"',
154+
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_back>{3*t + 0.01}>1"',
155+
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{3*t + 0.02}>1"',
164156
# Left
165157
f'ent_fire worldent addoutput "OnUser1>cmd>command>setpos_exact {x} {y} {z}>{4*t}>1"',
166-
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 0 90 1>{4*t}>1"',
167-
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_left>{4*t + 0.05}>1"',
168-
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{4*t + 0.1}>1"',
158+
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 0 90 3>{4*t}>1"',
159+
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_left>{4*t + 0.01}>1"',
160+
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{4*t + 0.02}>1"',
169161
# Up
170162
f'ent_fire worldent addoutput "OnUser1>cmd>command>fov_cs_debug 106.260205>{5*t}>1"',
171163
f'ent_fire worldent addoutput "OnUser1>cmd>command>setpos_exact {x} {y} {z}>{5*t}>1"',
172-
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact -89 0 0>{5*t}>1"',
173-
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_up>{5*t + 0.05}>1"',
174-
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{5*t + 0.1}>1"',
164+
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact -87 0 0>{5*t}>1"',
165+
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_up>{5*t + 0.01}>1"',
166+
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{5*t + 0.02}>1"',
175167
# Down
176168
f'ent_fire worldent addoutput "OnUser1>cmd>command>setpos_exact {x} {y} {z}>{6*t}>1"',
177-
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 89 180 0>{6*t}>1"',
178-
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_down>{6*t + 0.05}>1"',
179-
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{6*t + 0.1}>1"',
169+
f'ent_fire worldent addoutput "OnUser1>cmd>command>setang_exact 87 180 0>{6*t}>1"',
170+
f'ent_fire worldent addoutput "OnUser1>cmd>command>screenshot_prefix {session_id}_cube_{ev_suffix}_down>{6*t + 0.01}>1"',
171+
f'ent_fire worldent addoutput "OnUser1>cmd>command>png_screenshot>{6*t + 0.02}>1"',
180172
# Cleanup
181173
f'ent_fire worldent addoutput "OnUser1>cmd>command>cl_drawhud 1;r_drawviewmodel 1;r_drawpanorama 1;cl_firstperson_legs 1;fov_cs_debug 0;noclip 1>{7*t}>1"',
182174
f'ent_fire worldent addoutput "OnUser1>cmd>command>r_always_render_all_windows {original_render_all}>{7*t + 0.1}>1"',
@@ -192,8 +184,6 @@ def run(self):
192184
sentinel="[Cubemap Done]",
193185
timeout=15.0
194186
)
195-
# Small delay after each EV to ensure engine stability
196-
time.sleep(1.0)
197187

198188
# 3. Stitching
199189
self.progress.emit("Stitching images...")

0 commit comments

Comments
 (0)