Skip to content

Commit

Permalink
Hotfix (removed broken rendering code)
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarElek committed Jul 24, 2024
1 parent 3dd009a commit 5f9cef8
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/polyphy/core/discrete3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5f9cef8

Please sign in to comment.