1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 09:30:35 +00:00

brightness behind the sphere configurable; works a bit better with transparency now

This commit is contained in:
Zeno Rogue 2017-11-13 12:23:42 +01:00
parent d8a279b15d
commit d8a647d972
4 changed files with 25 additions and 22 deletions

View File

@ -310,6 +310,7 @@ void initConfig() {
addsaverenum(specialland, "land for special modes"); addsaverenum(specialland, "land for special modes");
addsaver(viewdists, "expansion mode"); addsaver(viewdists, "expansion mode");
addsaver(backbrightness, "brightness behind sphere");
#if CAP_SHMUP #if CAP_SHMUP
shmup::initConfig(); shmup::initConfig();
@ -1023,6 +1024,9 @@ void show3D() {
dialog::addSelItem(XLAT("camera rotation in ball model"), fts3(vid.ballangle), 'b'); dialog::addSelItem(XLAT("camera rotation in ball model"), fts3(vid.ballangle), 'b');
dialog::addSelItem(XLAT("projection in ball model"), fts3(vid.ballproj), 'x'); 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); dialog::addBreak(50);
if(!(wmspatial || mmspatial)) if(!(wmspatial || mmspatial))
dialog::addInfo(XLAT("set 3D monsters or walls in basic config first")); dialog::addInfo(XLAT("set 3D monsters or walls in basic config first"));
@ -1088,6 +1092,9 @@ void show3D() {
cmode &= sm::A3, cmode &= sm::A3,
dialog::editNumber(vid.ballproj, 0, 100, .1, 0, XLAT("projection in ball model"), 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."); "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') else if(uni == 'B')
pmodel = (pmodel == mdBall ? mdDisk : mdBall); pmodel = (pmodel == mdBall ? mdDisk : mdBall);
else if(uni == 'M') else if(uni == 'M')

View File

@ -2126,3 +2126,4 @@ bool handleCompass();
bool sphereflipped() { return sphere && vid.alpha > 1.1; } bool sphereflipped() { return sphere && vid.alpha > 1.1; }
int cellcolor(cell *c); int cellcolor(cell *c);
transmatrix screenpos(ld x, ld y); transmatrix screenpos(ld x, ld y);
extern ld backbrightness;

View File

@ -2159,12 +2159,6 @@ namespace linepatterns {
switch(id) { switch(id) {
#define col1 \
lessalphaif(col, behindsphere(V))
#define col2 \
lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2]))
case patZebraTriangles: case patZebraTriangles:
if(zebra40(c) / 4 == 10) { if(zebra40(c) / 4 == 10) {
bool all = true; bool all = true;
@ -2203,7 +2197,7 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2]))
if(euclid ? c->mov[t]<c : (((t^1)&1) || c->mov[t] < c)) if(euclid ? c->mov[t]<c : (((t^1)&1) || c->mov[t] < c))
queueline(V * ddspin(c,t,-S7) * xpush0(x), queueline(V * ddspin(c,t,-S7) * xpush0(x),
V * ddspin(c,t,+S7) * xpush0(x), V * ddspin(c,t,+S7) * xpush0(x),
col1, 1); col, 1);
break; break;
} }
@ -2214,14 +2208,14 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2]))
double x = sphere?.3651:euclid?.2611:.2849; double x = sphere?.3651:euclid?.2611:.2849;
queueline(V * ddspin(c,i,-S14) * xpush0(x), queueline(V * ddspin(c,i,-S14) * xpush0(x),
V * ddspin(c,i,+S14) * xpush0(x), V * ddspin(c,i,+S14) * xpush0(x),
col2, 1); col, 1);
} }
break; break;
case patTriNet: case patTriNet:
forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2)) if(celldist(c) != celldist(c2)) { forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2)) if(celldist(c) != celldist(c2)) {
queueline(tC0(V), gmatrix[c2]*C0, queueline(tC0(V), gmatrix[c2]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col2), darkena(backcolor ^ 0xFFFFFF, 0, col),
2); 2);
} }
break; break;
@ -2229,21 +2223,21 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2]))
case patTriRings: case patTriRings:
forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && celldist(c) == celldist(c2)) forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && celldist(c) == celldist(c2))
queueline(tC0(V), gmatrix[c2]*C0, queueline(tC0(V), gmatrix[c2]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col2), darkena(backcolor ^ 0xFFFFFF, 0, col),
2); 2);
break; break;
case patHepta: case patHepta:
forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) == pseudohept(c2)) forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) == pseudohept(c2))
queueline(tC0(V), gmatrix[c2]*C0, queueline(tC0(V), gmatrix[c2]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col2), darkena(backcolor ^ 0xFFFFFF, 0, col),
2); 2);
break; break;
case patRhomb: case patRhomb:
forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) != pseudohept(c2)) forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2) && pseudohept(c) != pseudohept(c2))
queueline(tC0(V), gmatrix[c2]*C0, queueline(tC0(V), gmatrix[c2]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col2), darkena(backcolor ^ 0xFFFFFF, 0, col),
2); 2);
break; break;
@ -2264,29 +2258,27 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2]))
if(pseudohept(c)) for(int i=0; i<7; i++) if(pseudohept(c)) for(int i=0; i<7; i++)
queueline(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), queueline(V * ddspin(c,i,84*5/14) * xpush0(tessf/2),
V * ddspin(c,i,84*9/14) * xpush0(tessf/2), V * ddspin(c,i,84*9/14) * xpush0(tessf/2),
col1, 1); col, 1);
break; break;
case patBigTriangles: { case patBigTriangles: {
if(pseudohept(c) && !euclid) for(int i=0; i<S7; i++) if(pseudohept(c) && !euclid) for(int i=0; i<S7; i++)
if(c->master->move[i] < c->master) { if(c->master->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; break;
} }
case patBigRings: { case patBigRings: {
if(pseudohept(c) && !euclid) for(int i=0; i<S7; i++) if(pseudohept(c) && !euclid) for(int i=0; i<S7; i++)
if(c->master->move[i] && c->master->move[i] < c->master && c->master->move[i]->dm4 == c->master->dm4) { if(c->master->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), col, 2);
queueline(tC0(V), V*xspinpush0((nontruncated?M_PI:0) -2*M_PI*i/S7, tessf), col2, 2);
}
break; break;
} }
case patTree: case patTree:
if(ctof(c) && !euclid) 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; break;
case patAltTree: case patAltTree:
@ -2339,8 +2331,6 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2]))
} }
} }
} }
#undef col1
#undef col2
int numpat = 0; int numpat = 0;

View File

@ -740,6 +740,8 @@ ld xintval(const hyperpoint& h) {
return -intval(h, C0); return -intval(h, C0);
} }
ld backbrightness = .25;
void drawqueue() { void drawqueue() {
int siz = size(ptds); int siz = size(ptds);
@ -824,7 +826,10 @@ void drawqueue() {
#endif #endif
if(ptd.kind == pkPoly || ptd.kind == pkLine) { if(ptd.kind == pkPoly || ptd.kind == pkLine) {
unsigned c = ptd.col; 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); drawqueueitem(ptd);
ptd.col = c; ptd.col = c;
} }