diff --git a/config.cpp b/config.cpp index 96ca6614..3c6ea72e 100644 --- a/config.cpp +++ b/config.cpp @@ -1179,6 +1179,31 @@ void config_camera_rotation() { ); } +void add_edit_wall_quality(char c) { + dialog::addSelItem(XLAT("wall quality"), its(vid.texture_step), c); + dialog::add_action([] { + dialog::editNumber(vid.texture_step, 1, 16, 1, 1, XLAT("wall quality"), + XLAT( + "Controls the number of triangles used for wall surfaces. " + "Higher numbers reduce the performance. " + "This has a strong effect when the walls are curved indeed " + "(honeycombs based on horospheres, and projections other than native perspective), " + "but otherwise, usually it can be set to 1 without significant adverse effects other " + "than slightly incorrect texturing." + ) + ); + dialog::bound_low(1); + dialog::bound_up(128); + dialog::reaction = [] { + if(floor_textures) { + delete floor_textures; + floor_textures = NULL; + } + need_reset_geometry = true; + }; + }); + } + void show3D() { cmode = sm::SIDE | sm::MAYDARK; gamescreen(0); @@ -1245,30 +1270,7 @@ void show3D() { dialog::editNumber(vid.radarsize, 0, 360, 15, 90, "", "set to 0 to disable"); }); } - if(DIM == 3) { - dialog::addSelItem(XLAT("wall quality"), its(vid.texture_step), 'W'); - dialog::add_action([] { - dialog::editNumber(vid.texture_step, 1, 16, 1, 1, XLAT("wall quality"), - XLAT( - "Controls the number of triangles used for wall surfaces. " - "Higher numbers reduce the performance. " - "This has a strong effect when the walls are curved indeed " - "(honeycombs based on horospheres, and projections other than native perspective), " - "but otherwise, usually it can be set to 1 without significant adverse effects other " - "than slightly incorrect texturing." - ) - ); - dialog::bound_low(1); - dialog::bound_up(128); - dialog::reaction = [] { - if(floor_textures) { - delete floor_textures; - floor_textures = NULL; - } - need_reset_geometry = true; - }; - }); - } + if(DIM == 3) add_edit_wall_quality('W'); #endif dialog::addBreak(50); diff --git a/floorshapes.cpp b/floorshapes.cpp index 6b0a12a7..de1e33fc 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -464,6 +464,7 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) { } } + #if MAXMDIM >= 4 if(WDIM == 2 && GDIM == 3) { finishshape(); for(auto pfsh: all_plain_floorshapes) { @@ -499,6 +500,12 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) { } } } + + for(int l=0; l= last->s; i--) { - hpc.push_back(zshift(hpc[i], fac)); - hpc[i] = zshift(hpc[i], fac2); + if(GDIM == 2) { + for(int i=isize(hpc)-1; i >= last->s; i--) { + hpc.push_back(mscale(hpc[i], fac)); + hpc[i] = mscale(hpc[i], fac2); + } + hpc.push_back(hpc[last->s]); + last->flags |= POLY_ISSIDE; + } + else { + vector points; + for(int s = last->s; ss); + last->flags |= POLY_TRIANGLES; + last->texture_offset = 0; + last->s = isize(hpc); + using namespace hyperpoint_vec; + auto at = [&] (ld x, ld y) { + x *= (isize(points) - 1); + int zf = int(x); + x -= zf; + hpcpush(zshift(points[zf] + (points[zf+1] - points[zf]) * x, fac + (fac2-fac) * y)); + }; + texture_order([&] (ld x, ld y) { at((1-x+y)/2, (1-x-y)/2); }); + texture_order([&] (ld x, ld y) { at((1-x-y)/2, (1+x-y)/2); }); + texture_order([&] (ld x, ld y) { at((1+x-y)/2, (1+x+y)/2); }); + texture_order([&] (ld x, ld y) { at((1+x+y)/2, (1-x+y)/2); }); } - hpc.push_back(hpc[last->s]); - last->flags |= POLY_ISSIDE; } #endif