From 2e0cf7fe53915f4d760c3b90953d95b57a3288a4 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 27 Dec 2019 00:49:58 +0100 Subject: [PATCH] band_shift correctly applied in shader-based band model --- basegraph.cpp | 5 ++++- shaders.cpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/basegraph.cpp b/basegraph.cpp index 34a1f47f..e8c47bc8 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -236,11 +236,14 @@ EX bool new_projection_needed; inline void reset_projection() { new_projection_needed = true; } #endif +EX ld lband_shift; + void display_data::set_all(int ed) { auto t = this; auto current_projection = tie(ed, pmodel, t, current_rbuffer); - if(new_projection_needed || !glhr::current_glprogram || (next_shader_flags & GF_which) != (glhr::current_glprogram->shader_flags & GF_which) || current_projection != last_projection) { + if(new_projection_needed || !glhr::current_glprogram || (next_shader_flags & GF_which) != (glhr::current_glprogram->shader_flags & GF_which) || current_projection != last_projection || band_shift != lband_shift) { last_projection = current_projection; + lband_shift = band_shift; set_projection(ed); set_mask(ed); set_viewport(ed); diff --git a/shaders.cpp b/shaders.cpp index f47475b6..e6d88181 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -439,6 +439,9 @@ void display_data::set_projection(int ed) { if(selected->shader_flags & SF_BAND) glhr::projection_multiply(glhr::scale(2 / M_PI, 2 / M_PI, GDIM == 3 ? 2/M_PI : 1)); + if(selected->shader_flags & SF_BAND) + glhr::projection_multiply(glhr::translate(band_shift, 0, 0)); + if(selected->shader_flags & SF_HALFPLANE) { glhr::projection_multiply(glhr::translate(0, 1, 0)); glhr::projection_multiply(glhr::scale(-1, 1, 1));