From 5f9cef8ae97e9bc87b9a2cb1db4a3e46294455cb Mon Sep 17 00:00:00 2001 From: Oskar Elek Date: Wed, 24 Jul 2024 01:29:16 -0600 Subject: [PATCH] Hotfix (removed broken rendering code) --- src/polyphy/core/discrete3D.py | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/src/polyphy/core/discrete3D.py b/src/polyphy/core/discrete3D.py index ef63c9a..7ab6972 100644 --- a/src/polyphy/core/discrete3D.py +++ b/src/polyphy/core/discrete3D.py @@ -256,10 +256,10 @@ def __init__(self, camera_azimuth -= 0.1 if window.event.key == ti.ui.RIGHT: camera_azimuth += 0.1 - if window.event.key == ti.ui.PLUS: + if window.event.key == ti.ui.SHIFT: camera_distance -= 0.1 * ppConfig.DOMAIN_SIZE_MAX camera_distance = max(0.85 * ppConfig.DOMAIN_SIZE_MAX, camera_distance) - if window.event.key == ti.ui.MINUS: + if window.event.key == ti.ui.CTRL: camera_distance += 0.1 * ppConfig.DOMAIN_SIZE_MAX # Handle camera control: rotation @@ -358,28 +358,6 @@ def __init__(self, ppInternalData.trace_field, ppInternalData.vis_field) - # Handle 3D rendering - if not batch_mode: - if window.is_pressed(ti.ui.LMB): - x = int(mouse_pos[0] * canvas.get_image().shape[1]) - y = int(mouse_pos[1] * canvas.get_image().shape[0]) - if (x >= 0) and (y >= 0) and (x < canvas.get_image().shape[1]) and (y < canvas.get_image().shape[0]): - pixels = np.array(canvas.get_image()) - rgb = pixels[y, x, :] - lum = np.sqrt(0.299 * rgb[0] ** 2 + 0.587 * rgb[1] ** 2 + 0.114 * rgb[2] ** 2) - Logger.logToStdOut("info", "Luminosity: %.2f" % (lum)) - - camera_pos = np.array([ - camera_distance * np.sin(camera_polar) * np.sin(camera_azimuth), - camera_distance * np.cos(camera_polar), - camera_distance * np.sin(camera_polar) * np.cos(camera_azimuth) - ]) - camera_dir = -camera_pos / np.linalg.norm(camera_pos) - camera_up = np.array([0.0, 1.0, 0.0]) - canvas.set_background_color((0.0, 0.0, 0.0)) - scene = ti.ui.Scene() - canvas.scene(scene, camera_pos, camera_dir, camera_up) - if batch_mode is False: canvas.set_image(ppInternalData.vis_field) if self.do_screenshot: