From da6477f154732ed069c2d0919e18f0c1cf172f94 Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Thu, 27 Jun 2024 15:02:14 -0500 Subject: [PATCH] fix slice rendering --- yt_idv/shaders/slice_sample.frag.glsl | 2 +- yt_idv/tests/test_yt_idv.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/yt_idv/shaders/slice_sample.frag.glsl b/yt_idv/shaders/slice_sample.frag.glsl index 84bbbb1..99d2568 100644 --- a/yt_idv/shaders/slice_sample.frag.glsl +++ b/yt_idv/shaders/slice_sample.frag.glsl @@ -62,5 +62,5 @@ void main() float map_sample = texture(bitmap_tex, tex_curr_pos).r; if (!(map_sample > 0.0)) discard; - output_color = texture(ds_tex, tex_curr_pos); + output_color = texture(ds_tex[0], tex_curr_pos); } diff --git a/yt_idv/tests/test_yt_idv.py b/yt_idv/tests/test_yt_idv.py index 66b46b5..9ebce3f 100644 --- a/yt_idv/tests/test_yt_idv.py +++ b/yt_idv/tests/test_yt_idv.py @@ -68,7 +68,12 @@ def test_snapshots(osmesa_fake_amr, image_store): def test_slice(osmesa_fake_amr, image_store): osmesa_fake_amr.scene.components[0].render_method = "slice" - image_store(osmesa_fake_amr) + osmesa_fake_amr.scene.components[0].slice_position = (0.5, 0.5, 0.5) + for ax in [0, 1, 2]: + normal = [0.0, 0.0, 0.0] + normal[ax] = 1.0 + osmesa_fake_amr.scene.components[0].slice_normal = tuple(normal) + image_store(osmesa_fake_amr) osmesa_fake_amr.scene.components[0].slice_normal = (1.0, 1.0, 0.0) osmesa_fake_amr.scene.components[0].slice_position = (0.5, 0.25, 0.5) image_store(osmesa_fake_amr)