diff --git a/graph.cpp b/graph.cpp index 5450a55a..150b8192 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3808,6 +3808,16 @@ bool isWall3(cell *c, color_t& wcol) { return false; } +// how much should be the d-th wall darkened in 3D +int get_darkval(int d) { + const int darkval_h[9] = {0,2,2,0,6,6,8,8,0}; + const int darkval_s[12] = {0,1,2,3,4,5,0,1,2,3,4,5}; + const int darkval_e[6] = {0,4,6,0,4,6}; + if(sphere) return darkval_s[d]; + if(euclid) return darkval_e[d]; + return darkval_h[d]; + } + void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { cells_drawn++; @@ -4639,10 +4649,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(DIM == 3) { if(isWall3(c, wcol)) { color_t dummy; - const int darkval_h[9] = {0,2,2,0,6,6,8,8,0}; - const int darkval_s[12] = {0,1,2,3,0,1,2,3,0,1,2,3}; - const int darkval_e[6] = {0,0,4,4,6,6}; - const int *darkval = sphere ? darkval_s : hyperbolic ? darkval_h : darkval_e; int d = (wcol & 0xF0F0F0) >> 4; for(int a=0; atype; a++) @@ -4650,10 +4656,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(a < 4 && hyperbolic) { if(celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue; dynamicval p (poly_outline, 0); - queuepoly(V, shWall3D[a], darkena(wcol - d * darkval[a], 0, 0xFF)); + queuepoly(V, shWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF)); } else { - queuepoly(V, shWall3D[a], darkena(wcol - d * darkval[a], 0, 0xFF)); + queuepoly(V, shWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF)); } } } @@ -4667,7 +4673,12 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { } else if(winf[c->wall].glyph == '.') ; - else if(!hiliteclick) queuechr(V, 1, winf[c->wall].glyph, darkenedby(wcol, darken), 2); + else if(!hiliteclick) { + int d = (wcol & 0xF0F0F0) >> 4; + + for(int a=0; atype; a++) + queuepoly(V, shMiniWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF)); + } } else switch(c->wall) { diff --git a/polygons.cpp b/polygons.cpp index 4a4bb0c4..184bf7f6 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -1659,9 +1659,10 @@ hpcshape shAsymmetric, - shWall3D[12], - shDodeca; + +vector shWall3D, shMiniWall3D; + #endif ld tentacle_length; @@ -2500,6 +2501,7 @@ void buildpolys() { bshape(shDragonHead, PPR::ONTENTACLE, scalefactor, 242); if(DIM == 3 && binarytiling) { + shWall3D.resize(9); make_wall(shWall3D[0], 0,0,-1, -1,0,-1, 0,-1,-1, 2); make_wall(shWall3D[1], 0,0,-1, +1,0,-1, 0,-1,-1, 2); make_wall(shWall3D[2], 0,0,-1, -1,0,-1, 0,+1,-1, 2); @@ -2512,6 +2514,7 @@ void buildpolys() { } if(DIM == 3 && euclid) { + shWall3D.resize(6); for(int w=0; w<6; w++) { bshape(shWall3D[w], PPR::WALL); for(int a=0; a<=4; a++) { @@ -2528,6 +2531,7 @@ void buildpolys() { } if(DIM == 3 && sphere) { + shWall3D.resize(12); for(int w=0; w<12; w++) { bshape(shWall3D[w], PPR::WALL); for(int a=0; a<=5; a++) @@ -2535,6 +2539,17 @@ void buildpolys() { } } + if(DIM == 3) { + shMiniWall3D.resize(isize(shWall3D)); + for(int i=0; iflags |= POLY_TRIANGLES; + } + } + ld krsc = 1; if(sphere) krsc *= 1.4; if(S7 ==8) krsc *= 1.3;