From 8633b85ee497747f3d811746d856f4b92629fbd9 Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 10 Mar 2017 01:22:24 +0000 Subject: [PATCH] Simplify draw_tmap interpolation Prior changes removed most of what made the switch branches distinct. Capitalize on that to combine identical code paths. --- common/texmap/ntmap.cpp | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/common/texmap/ntmap.cpp b/common/texmap/ntmap.cpp index ba40438a8..aca0d6805 100644 --- a/common/texmap/ntmap.cpp +++ b/common/texmap/ntmap.cpp @@ -847,47 +847,19 @@ void draw_tmap(grs_canvas &canvas, const grs_bitmap &rbp, uint_fast32_t nverts, Lighting_enabled = Lighting_on; // Now, call my texture mapper. - if (Lighting_on) { switch (Interpolation_method) { // 0 = choose, 1 = linear, 2 = /8 perspective, 3 = full perspective case 0: // choose best interpolation if (Current_seg_depth > Max_perspective_depth) + case 1: // linear interpolation ntexture_map_lighted_linear(*bp, Tmap1); else + case 2: // perspective every 8th pixel interpolation + case 3: // perspective every pixel interpolation ntexture_map_lighted(*bp, Tmap1); break; - case 1: // linear interpolation - ntexture_map_lighted_linear(*bp, Tmap1); - break; - case 2: // perspective every 8th pixel interpolation - ntexture_map_lighted(*bp, Tmap1); - break; - case 3: // perspective every pixel interpolation - ntexture_map_lighted(*bp, Tmap1); - break; default: Assert(0); // Illegal value for Interpolation_method, must be 0,1,2,3 } - } else { - switch (Interpolation_method) { // 0 = choose, 1 = linear, 2 = /8 perspective, 3 = full perspective - case 0: // choose best interpolation - if (Current_seg_depth > Max_perspective_depth) - ntexture_map_lighted_linear(*bp, Tmap1); - else - ntexture_map_lighted(*bp, Tmap1); - break; - case 1: // linear interpolation - ntexture_map_lighted_linear(*bp, Tmap1); - break; - case 2: // perspective every 8th pixel interpolation - ntexture_map_lighted(*bp, Tmap1); - break; - case 3: // perspective every pixel interpolation - ntexture_map_lighted(*bp, Tmap1); - break; - default: - Assert(0); // Illegal value for Interpolation_method, must be 0,1,2,3 - } - } Lighting_on = lighting_on_save;