From 8498ae7af81f0e2490a463ee4751f73548ff81d2 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 3 Nov 2017 19:20:54 +0100 Subject: [PATCH] Zebra patterns for some of the new geometries --- cell.cpp | 9 +++------ graph.cpp | 9 +++++---- hyper.h | 5 +++++ hypgraph.cpp | 4 ++-- patterns.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 12 deletions(-) diff --git a/cell.cpp b/cell.cpp index 8f7a520d..cf1f9a22 100644 --- a/cell.cpp +++ b/cell.cpp @@ -968,6 +968,9 @@ int zebra40(cell *c) { else if(ctof(c)) return (c->master->zebraval/10); else if(sphere) return 0; else if(euclid) return eupattern(c); + else if(S3 == 4 && S7 == 6) { + return 8 + ((c->master->zebraval / 10 + c->spin(0))%2) * 2; + } else { int ii[3], z; ii[0] = (c->mov[0]->master->zebraval/10); @@ -1306,12 +1309,6 @@ int getBits(cell *c) { } } -eLand getCLand(cell *c) { - int b = getBits(c); - b = (b&31) ^ (b>>5); - return land_scape[b & 31]; - } - cell *heptatdir(cell *c, int d) { if(d&1) { cell *c2 = createMov(c, d); diff --git a/graph.cpp b/graph.cpp index a6ef7c52..cbda4ce7 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3176,7 +3176,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(orig) gm = V; } - if(behindsphere(V)) return; + // if(behindsphere(V)) return; callhooks(hooks_drawcell, c, V); @@ -3472,7 +3472,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(c->wall == waChasm) { if(c->land == laZebra) fd++; if(c->land == laHalloween && !wmblack) { - transmatrix Vdepth = mscale(V, geom3::BOTTOM); + transmatrix Vdepth = wmspatial ? mscale(V, geom3::BOTTOM) : V; queuepolyat(Vdepth, shFloor[ct6], darkena(firecolor(ticks / 10), 0, 0xDF), PPR_LAKEBOTTOM); } @@ -4227,6 +4227,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(!chasmg) { #define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V * cellrelmatrix(c,i)) : 1), 1), fd, 0xFF) +// #define D(v) darkena(col, fd, 0xFF) if(sha & 1) { forCellIdEx(c2, i, c) if(chasmgraph(c2)) @@ -4254,10 +4255,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { } } - if(chasmg == 2 && wmspatial && sphere) { + if(false) if(chasmg == 2 && wmspatial && sphere) { forCellIdEx(c2, i, c) if(chasmgraph(c2) == 0) { transmatrix V2 = V * cellrelmatrix(c, i); - if(!behindsphere(V2)) continue; + // if(!behindsphere(V2)) continue; bool w = isWarped(c2); int wcol2, fcol2; setcolors(c2, wcol2, fcol2); diff --git a/hyper.h b/hyper.h index 1ff96153..8fc1b961 100644 --- a/hyper.h +++ b/hyper.h @@ -1827,6 +1827,7 @@ struct qpoly { int cnt; int outline; double minwidth; + int flags; }; struct qline { @@ -2096,3 +2097,7 @@ const char *dnameof(eWall w); const char *dnameof(eItem i); void runGeometryExperiments(); + +// z to close to this limit => do not draw + +#define BEHIND_LIMIT 1e-6 diff --git a/hypgraph.cpp b/hypgraph.cpp index ca609e61..192ad701 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -86,7 +86,7 @@ void ballmodel(hyperpoint& ret, double alpha, double d, double zl) { void applymodel(hyperpoint H, hyperpoint& ret) { ld tz = euclid ? (EUCSCALE+vid.alphax) : vid.alphax+H[2]; - if(tz < 1e-3 && tz > -1e-3) tz = 1000; + if(tz < BEHIND_LIMIT && tz > -BEHIND_LIMIT) tz = BEHIND_LIMIT; if(pmodel == mdUnchanged) { for(int i=0; i<3; i++) ret[i] = H[i] / vid.radius; @@ -306,7 +306,7 @@ ld spherity(const hyperpoint& h) { } if(vid.alpha <= 1) { - return to01(-.8, 1, h[2]); + return to01(-1.5, 1, h[2]); } return 1; diff --git a/patterns.cpp b/patterns.cpp index 864bd725..5b826805 100644 --- a/patterns.cpp +++ b/patterns.cpp @@ -1063,6 +1063,53 @@ int zebratable6[28][3] = { // rules for the emeraldvalues of heptagons. int zebra_heptagon(int parent, int dir) { + if(S3 == 4) { + int mm = (parent % 10 + S7 - dir) % S7; + int mv = parent / 10; + // whichbright: d&1 + if(S7 == 5) switch(mm) { + case 0: + return 10 * (mv^1); + case 1: + return 10 * (mv^2) + 4; + case 2: + return 10 * (mv^4) + 3; + case 3: + return 10 * (mv^4) + 2; + case 4: + return 10 * (mv^2) + 1; + } + if(S7 == 7) switch(mm) { + case 0: + return 10 * (mv^2); + case 1: + return 10 * (mv^1) + 6; + case 2: + return 10 * (mv^2) + 5; + case 3: + return 10 * (mv^4) + 4; + case 4: + return 10 * (mv^4) + 3; + case 5: + return 10 * (mv^2) + 2; + case 6: + return 10 * (mv^1) + 1; + } + if(S7 == 6) switch(mm) { + case 0: + return 10 * (mv^2); + case 1: + return 10 * (mv^1) + 5; + case 2: + return 10 * (mv^2) + 4; + case 3: + return 10 * (mv^1) + 3; + case 4: + return 10 * (mv^2) + 2; + case 5: + return 10 * (mv^1) + 1; + } + } if(S7 == 8 && dir > 3) dir--; return zebratable[parent/10-4][(70+dir-(parent%10))%7]; }