1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

2d3d:: cone graphics for trees etc.

This commit is contained in:
Zeno Rogue 2019-05-10 01:24:16 +02:00
parent 13f3f49db9
commit dbb8857a39
3 changed files with 35 additions and 2 deletions

View File

@ -500,6 +500,33 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
}
}
}
sizeto(fsh.cone, id);
bshape(fsh.cone[id], fsh.prio);
last->flags |= POLY_TRIANGLES;
last->tinf = &fsh.tinf3;
last->texture_offset = 0;
#if CAP_BT
if(binarytiling)
for(int t=0; t<c->type; t++)
texture_order([&] (ld x, ld y) {
using namespace hyperpoint_vec;
hyperpoint left = binary::get_corner_horo_coordinates(c, t);
hyperpoint right = binary::get_corner_horo_coordinates(c, t+1);
hpcpush(rgpushxto0(binary::get_horopoint(left * x + right * y)) * zpush(geom3::WALL + (geom3::FLOOR-geom3::WALL) * (x+y)) * C0);
});
else
#endif
if(1) {
int s = fsh.b[id].s;
int e = fsh.b[id].e-1;
for(int t=0; t<e-s; t++) {
using namespace hyperpoint_vec;
hyperpoint v1 = hpc[s+t] - C0;
hyperpoint v2 = hpc[s+t+1] - C0;
texture_order([&] (ld x, ld y) { hpcpush(rgpushxto0(normalize(C0 + v1 * x + v2 * y))*zpush(geom3::WALL + (geom3::FLOOR-geom3::WALL) * (x+y))*C0); });
}
}
for(int l=0; l<SIDEPARS; l++) {
for(auto& li: fsh.side[l]) li.tinf = &fsh.tinf3;
@ -520,6 +547,8 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
fsh.gpside[l][e] = shFullFloor.gpside[l][e];
for(auto& li: fsh.gpside[l][e]) li.tinf = &fsh.tinf3;
}
fsh.cone = shFullFloor.cone;
for(auto& li: fsh.cone) li.tinf = &fsh.tinf3;
}
}
finishshape();

View File

@ -3881,9 +3881,13 @@ int getSnakelevColor(cell *c, int i, int last, int fd, color_t wcol) {
void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int ct6, int fd) {
if(DIM == 3 && WDIM == 2) {
if(!qfi.fshape) qfi.fshape = &shFullFloor;
if(conegraph(c)) {
draw_shapevec(c, V, qfi.fshape->cone, darkena(wcol, 0, 0xFF), PPR::WALL);
return;
}
color_t wcol0 = wcol;
color_t wcol2 = gradient(0, wcol0, 0, .8, 1);
if(!qfi.fshape) qfi.fshape = &shFullFloor;
draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol, 0, 0xFF), PPR::WALL);
forCellIdEx(c2, i, c)
if(!highwall(c2))

View File

@ -4248,7 +4248,7 @@ struct floorshape {
int pstrength; // pattern strength in 3D
int fstrength; // frame strength in 3D
PPR prio;
vector<hpcshape> b, shadow, side[SIDEPARS], gpside[SIDEPARS][MAX_EDGE], levels[SIDEPARS];
vector<hpcshape> b, shadow, side[SIDEPARS], gpside[SIDEPARS][MAX_EDGE], levels[SIDEPARS], cone;
basic_textureinfo tinf3;
floorshape() { prio = PPR::FLOOR; pstrength = fstrength = 10; }
};