band_shift correctly applied in shader-based band model

This commit is contained in:
Zeno Rogue 2019-12-27 00:49:58 +01:00
parent c247936e34
commit 2e0cf7fe53
2 changed files with 7 additions and 1 deletions

View File

@ -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);

View File

@ -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));