diff --git a/3d-models.cpp b/3d-models.cpp index 55c38384..ef419ac4 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -32,6 +32,7 @@ vector geometry_information::get_shape(hpcshape sh) { EX hyperpoint normalize_flat(hyperpoint h) { if(prod) return product_decompose(h).second; + if(sl2) h = slr::translate(h) * zpush0(-atan2(h[2], h[3])); return normalize(h); } @@ -133,6 +134,12 @@ vector scaleshape(const vector& vh, ld s) { return res; } +ld get_zlevel(hyperpoint h) { + if(prod) return zlevel(h); + if(sl2) return atan2(h[2], h[3]); + return asin_auto(h[2]); + } + void geometry_information::make_ha_3d(hpcshape& sh, bool isarmor, ld scale) { shcenter = C0; @@ -202,7 +209,7 @@ void geometry_information::make_ha_3d(hpcshape& sh, bool isarmor, ld scale) { int arm1 = isize(hpc); for(int i=arm0; i d(vid.texture_step, 8); texture_order([&] (ld x, ld y) { ld z = 1-x-y; - ld r = scalefactor * hcrossf7 * (0 + pow(max(x,max(y,z)), .3) * 0.8) * (prod ? .5 : 1); + ld r = scalefactor * hcrossf7 * (0 + pow(max(x,max(y,z)), .3) * 0.8) * (hybri ? .5 : 1); hyperpoint h = dir_to_point(dir_setlength(a*x+b*y+c*z, r)); hpcpush(h); }); diff --git a/geometry.cpp b/geometry.cpp index 6c556dc2..a055720c 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -569,6 +569,7 @@ void geometry_information::prepare_basics() { } plevel = vid.plevel_factor * scalefactor; + if(sl2) plevel = M_PI / 14; set_sibling_limit(); @@ -650,7 +651,7 @@ namespace geom3 { string invalid; ld actual_wall_height() { - if(prod) return cgi.plevel; + if(hybri) return cgi.plevel; #if CAP_GP if(GOLDBERG && vid.gp_autoscale_heights) return vid.wall_height * min(4 / hypot_d(2, gp::next), 1); @@ -722,7 +723,7 @@ namespace geom3 { human_height = vid.human_wall_ratio * wh; if(WDIM == 3) human_height = scalefactor * vid.height_width / 2; - if(prod) human_height = min(human_height, cgi.plevel * .9); + if(hybri) human_height = min(human_height, cgi.plevel * .9); ld reduce = (WDIM == 3 ? human_height / 2 : 0); diff --git a/graph.cpp b/graph.cpp index f65f8c2a..f59d159a 100644 --- a/graph.cpp +++ b/graph.cpp @@ -349,14 +349,14 @@ double hexshiftat(cell *c) { } EX transmatrix ddspin(cell *c, int d, ld bonus IS(0)) { - if(prod) return PIU( ddspin(c, d, bonus) ); + if(hybri) return PIU( ddspin(c, d, bonus) ); if(WDIM == 3 && d < c->type) return rspintox(tC0(calc_relative_matrix(c->cmove(d), c, C0))) * cspin(2, 0, bonus); if(WDIM == 2 && (binarytiling || penrose) && d < c->type) return spin(bonus) * rspintox(nearcorner(c, d)); return spin(displayspin(c, d) + bonus - hexshiftat(c)); } EX transmatrix iddspin(cell *c, int d, ld bonus IS(0)) { - if(prod) return PIU( iddspin(c, d, bonus) ); + if(hybri) return PIU( iddspin(c, d, bonus) ); if(WDIM == 3 && d < c->type) return cspin(0, 2, bonus) * spintox(tC0(calc_relative_matrix(c->cmove(d), c, C0))); if(WDIM == 2 && (binarytiling || penrose) && d < c->type) return spin(bonus) * spintox(nearcorner(c, d)); return spin(hexshiftat(c) - displayspin(c, d) + bonus); @@ -808,6 +808,7 @@ color_t kind_outline(eItem it) { EX transmatrix face_the_player(const transmatrix V) { if(GDIM == 2) return V; + if(sl2) return V * zpush(cos(ptick(750)) * cgi.plevel / 16); if(prod) return mscale(V, cos(ptick(750)) * cgi.plevel / 16); if(nonisotropic) return spin_towards(V, C0, 2, 0); return rgpushxto0(tC0(V)); @@ -870,6 +871,8 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF); if(c && prod) Vit = mscale(Vit, sin(ptick(750)) * cgi.plevel / 4); + else if(c && sl2) + Vit = Vit * zpush(sin(ptick(750)) * cgi.plevel / 4); else if(GDIM == 3 && c && it != itBabyTortoise) Vit = face_the_player(Vit); // V * cspin(0, 2, ptick(618, 0)); @@ -1351,7 +1354,7 @@ EX bool drawMonsterType(eMonster m, cell *where, const transmatrix& V1, color_t char xch = minf[m].glyph; transmatrix V = V1; - if(WDIM == 3 && (classflag(m) & CF_FACE_UP) && where && !prod) V = V1 * cspin(0, 2, M_PI/2); + if(WDIM == 3 && (classflag(m) & CF_FACE_UP) && where && !hybri) V = V1 * cspin(0, 2, M_PI/2); // if(GDIM == 3) V = V * cspin(0, 2, M_PI/2); @@ -2548,7 +2551,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m if(mmmon) { if(isAnyIvy(c)) { - if(prod) { + if(hybri) { queuepoly(Vb, cgi.shILeaf[ctof(c)], darkena(col, 0, 0xFF)); for(int a=0; atype-2; a++) queuepoly(Vb * spin(a * 2 * M_PI / (c->type-2)), cgi.shILeaf[2], darkena(col, 0, 0xFF)); @@ -2788,13 +2791,13 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m if(prod) Vs = mscale(Vs, z); } } - else { + else if(!sl2) { hyperpoint V0 = inverse(cwtV) * tC0(Vs); Vs = cwtV * rspintox(V0) * xpush(hdist0(V0)) * cspin(0, 2, -M_PI); // cwtV * rgpushxto0(inverse(cwtV) * tC0(Vs)); } if(c->monst == moHunterChanging) - Vs = Vs * (prod ? spin(M_PI) : cspin(WDIM-2, WDIM-1, M_PI)); + Vs = Vs * (hybri ? spin(M_PI) : cspin(WDIM-2, WDIM-1, M_PI)); } if(c->monmirror) Vs = Vs * Mirror; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index cbdf436b..58d7eb3c 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -493,6 +493,7 @@ EX bool eqmatrix(transmatrix A, transmatrix B, ld eps IS(.01)) { // in the 3D space, move the point h orthogonally to the (x,y) plane by z units EX hyperpoint orthogonal_move(const hyperpoint& h, ld z) { if(prod) return zshift(h, z); + if(sl2) return slr::translate(h) * cpush0(2, z); if(!hyperbolic) return rgpushxto0(h) * cpush(2, z) * C0; if(nil) return nisot::translate(h) * cpush0(2, z); if(translatable) return hpxy3(h[0], h[1], h[2] + z); @@ -960,6 +961,7 @@ EX hyperpoint orthogonal_of_C0(hyperpoint h0, hyperpoint h1, hyperpoint h2) { EX hyperpoint zshift(hyperpoint x, ld z) { if(GDIM == 3 && WDIM == 2) return rgpushxto0(x) * cpush0(2, z); + else if(sl2) return mscale(x, z); else if(prod) return mscale(x, z); else return mscale(x, z); }