diff --git a/config.cpp b/config.cpp index aa28aea9..f69b00c6 100644 --- a/config.cpp +++ b/config.cpp @@ -310,6 +310,7 @@ void initConfig() { addsaverenum(specialland, "land for special modes"); addsaver(viewdists, "expansion mode"); + addsaver(backbrightness, "brightness behind sphere"); #if CAP_SHMUP shmup::initConfig(); @@ -1022,6 +1023,9 @@ void show3D() { dialog::addBoolItem(XLAT("hyperboloid model"), pmodel == mdHyperboloid, 'M'); dialog::addSelItem(XLAT("camera rotation in ball model"), fts3(vid.ballangle), 'b'); dialog::addSelItem(XLAT("projection in ball model"), fts3(vid.ballproj), 'x'); + + if(sphere) + dialog::addSelItem(XLAT("brightness behind the sphere"), fts3(backbrightness), 'i'); dialog::addBreak(50); if(!(wmspatial || mmspatial)) @@ -1088,6 +1092,9 @@ void show3D() { cmode &= sm::A3, dialog::editNumber(vid.ballproj, 0, 100, .1, 0, XLAT("projection in ball model"), "This parameter affects the ball model the same way as the projection parameter affects the disk model."); + else if(uni == 'i') + dialog::editNumber(backbrightness, 0, 1, .01, 0.25, XLAT("brightness behind the sphere"), + "brightness behind the sphere"); else if(uni == 'B') pmodel = (pmodel == mdBall ? mdDisk : mdBall); else if(uni == 'M') diff --git a/hyper.h b/hyper.h index b4cf5733..e0728c1f 100644 --- a/hyper.h +++ b/hyper.h @@ -2126,3 +2126,4 @@ bool handleCompass(); bool sphereflipped() { return sphere && vid.alpha > 1.1; } int cellcolor(cell *c); transmatrix screenpos(ld x, ld y); +extern ld backbrightness; diff --git a/mapeditor.cpp b/mapeditor.cpp index e73eeef1..40bf3896 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -2159,12 +2159,6 @@ namespace linepatterns { switch(id) { -#define col1 \ -lessalphaif(col, behindsphere(V)) - -#define col2 \ -lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) - case patZebraTriangles: if(zebra40(c) / 4 == 10) { bool all = true; @@ -2203,7 +2197,7 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) if(euclid ? c->mov[t]mov[t] < c)) queueline(V * ddspin(c,t,-S7) * xpush0(x), V * ddspin(c,t,+S7) * xpush0(x), - col1, 1); + col, 1); break; } @@ -2214,14 +2208,14 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) double x = sphere?.3651:euclid?.2611:.2849; queueline(V * ddspin(c,i,-S14) * xpush0(x), V * ddspin(c,i,+S14) * xpush0(x), - col2, 1); + col, 1); } break; case patTriNet: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2)) if(celldist(c) != celldist(c2)) { queueline(tC0(V), gmatrix[c2]*C0, - darkena(backcolor ^ 0xFFFFFF, 0, col2), + darkena(backcolor ^ 0xFFFFFF, 0, col), 2); } break; @@ -2229,21 +2223,21 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) case patTriRings: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && celldist(c) == celldist(c2)) queueline(tC0(V), gmatrix[c2]*C0, - darkena(backcolor ^ 0xFFFFFF, 0, col2), + darkena(backcolor ^ 0xFFFFFF, 0, col), 2); break; case patHepta: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) == pseudohept(c2)) queueline(tC0(V), gmatrix[c2]*C0, - darkena(backcolor ^ 0xFFFFFF, 0, col2), + darkena(backcolor ^ 0xFFFFFF, 0, col), 2); break; case patRhomb: forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) != pseudohept(c2)) queueline(tC0(V), gmatrix[c2]*C0, - darkena(backcolor ^ 0xFFFFFF, 0, col2), + darkena(backcolor ^ 0xFFFFFF, 0, col), 2); break; @@ -2264,29 +2258,27 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) if(pseudohept(c)) for(int i=0; i<7; i++) queueline(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), V * ddspin(c,i,84*9/14) * xpush0(tessf/2), - col1, 1); + col, 1); break; case patBigTriangles: { if(pseudohept(c) && !euclid) for(int i=0; imaster->move[i] < c->master) { - queueline(tC0(V), V*xspinpush0((nontruncated?M_PI:0) -2*M_PI*i/S7, tessf), col1, 2); + queueline(tC0(V), V*xspinpush0((nontruncated?M_PI:0) -2*M_PI*i/S7, tessf), col, 2); } break; } case patBigRings: { if(pseudohept(c) && !euclid) for(int i=0; imaster->move[i] && c->master->move[i] < c->master && c->master->move[i]->dm4 == c->master->dm4) { - cell *c2 = c->master->move[i]->c7; - queueline(tC0(V), V*xspinpush0((nontruncated?M_PI:0) -2*M_PI*i/S7, tessf), col2, 2); - } + if(c->master->move[i] && c->master->move[i] < c->master && c->master->move[i]->dm4 == c->master->dm4) + queueline(tC0(V), V*xspinpush0((nontruncated?M_PI:0) -2*M_PI*i/S7, tessf), col, 2); break; } case patTree: if(ctof(c) && !euclid) - queueline(tC0(V), V*ddi0(nontruncated?S42:0, tessf), col1, 2); + queueline(tC0(V), V*ddi0(nontruncated?S42:0, tessf), col, 2); break; case patAltTree: @@ -2339,8 +2331,6 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) } } } -#undef col1 -#undef col2 int numpat = 0; diff --git a/polygons.cpp b/polygons.cpp index fd635c4d..53b81ee4 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -740,6 +740,8 @@ ld xintval(const hyperpoint& h) { return -intval(h, C0); } +ld backbrightness = .25; + void drawqueue() { int siz = size(ptds); @@ -824,7 +826,10 @@ void drawqueue() { #endif if(ptd.kind == pkPoly || ptd.kind == pkLine) { unsigned c = ptd.col; - ptd.col = (gradient(c>>8, backcolor, 0, .75, 1)<<8) | 0xFF; + int alpha = ptd.col & 255; + if(alpha == 255) + ptd.col = (gradient(backcolor, c>>8, 0, backbrightness, 1)<<8) | 0xFF; + else ptd.col = ptd.col - alpha + int(backbrightness * alpha); drawqueueitem(ptd); ptd.col = c; }