3d:: miniwalls used for weird stuff

This commit is contained in:
? 2019-02-27 16:29:30 +01:00 committed by Zeno Rogue
parent c2b6600ce5
commit 0620916dd2
2 changed files with 35 additions and 9 deletions

View File

@ -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; a<c->type; 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<color_t> 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; a<c->type; a++)
queuepoly(V, shMiniWall3D[a], darkena(wcol - d * get_darkval(a), 0, 0xFF));
}
}
else switch(c->wall) {

View File

@ -1659,9 +1659,10 @@ hpcshape
shAsymmetric,
shWall3D[12],
shDodeca;
vector<hpcshape> 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; i<isize(shWall3D); i++) {
bshape(shMiniWall3D[i], PPR::WALL);
for(int a=shWall3D[i].s; a < shWall3D[i].e; a++)
hpcpush(mid(C0, hpc[a]));
if(shWall3D[i].flags & POLY_TRIANGLES)
last->flags |= POLY_TRIANGLES;
}
}
ld krsc = 1;
if(sphere) krsc *= 1.4;
if(S7 ==8) krsc *= 1.3;