From d87a471714142190921466b63787ec1148ac672f Mon Sep 17 00:00:00 2001 From: ? Date: Fri, 22 Feb 2019 21:13:33 +0100 Subject: [PATCH] 3D::binary:: nice walls --- graph.cpp | 29 +++++++++++++++++++++++------ polygons.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/graph.cpp b/graph.cpp index 83a49bbd..8d5123cc 100644 --- a/graph.cpp +++ b/graph.cpp @@ -4586,7 +4586,28 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { char xch = winf[c->wall].glyph; - switch(c->wall) { + if(DIM == 3) { + if(isWall(c)) { + + const int darkval[9] = {0,1,1,0,3,3,4,4,0}; + int d = (asciicol & 0xF0F0F0) >> 3; + for(int a=0; a<9; a++) + if(c->move(a) && !isWall(c->move(a))) { + if(a < 4) { + if(celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue; + dynamicval p (poly_outline, 0); + queuepoly(V, shBinaryWall[a], darkena(asciicol - d * darkval[a], 0, 0xFF)); + } + else { + queuepoly(V, shBinaryWall[a], darkena(asciicol - d * darkval[a], 0, 0xFF)); + } + } + } + else if(c->wall == waNone) ; + else error = true; + } + + else switch(c->wall) { case waBigBush: if(detaillevel >= 2) @@ -5079,11 +5100,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { #if CAP_QUEUE if(error) { - if(ch == '#') - binary::queuecube(V, 1, 0xFF, darkena(asciicol, 0, 0xFF)); - else if(ch == '.') ; - else - queuechr(V, 1, ch, darkenedby(asciicol, darken), 2); + queuechr(V, 1, ch, darkenedby(asciicol, darken), 2); } if(vid.grid) { diff --git a/polygons.cpp b/polygons.cpp index 1889e949..3f637749 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -1617,6 +1617,8 @@ hpcshape shJiangShi, shJiangShiDress, shJiangShiCap1, shJiangShiCap2, shAsymmetric, + + shBinaryWall[9], shDodeca; #endif @@ -1880,6 +1882,43 @@ ld dlow_table[SIDEPARS], dhi_table[SIDEPARS]; #define SHADMUL (S3==4 ? 1.05 : 1.3) +void make_wall(hpcshape& sh, int x0, int y0, int z0, int x1, int y1, int z1, int x2, int y2, int z2, int flags) { + hyperpoint h0 = point3(x0,y0,z0); + hyperpoint h1 = point3(x1,y1,z1); + hyperpoint h2 = point3(x2,y2,z2); + using namespace hyperpoint_vec; + hyperpoint h3 = h1 + h2 - h0; + bshape(sh, PPR::WALL); + ld yy = log(2) / 2; + const int STEP=10; + auto at = [&] (hyperpoint h) { + hyperpoint res = binary::parabolic3(h[0], h[1]) * xpush0(yy*h[2]); + hpcpush(res); + }; + if(flags == 2) { + for(int y=0; yflags |= POLY_TRIANGLES; + } + } + else { + int STP2 = ((flags == 1) ? 2 : 1) * STEP; + for(int t=0; t