mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-17 11:30:09 +00:00
2D3D:: wall shadows
This commit is contained in:
parent
8858b137b5
commit
740cc5fbb6
@ -470,6 +470,9 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
finishshape();
|
||||
for(auto pfsh: all_plain_floorshapes) {
|
||||
auto& fsh = *pfsh;
|
||||
|
||||
for(int i=fsh.shadow[id].s; i<fsh.shadow[id].e; i++)
|
||||
hpc[i] = orthogonal_move(hpc[i], geom3::FLOOR - geom3::human_height / 100);
|
||||
|
||||
for(int k=0; k<SIDEPARS; k++) {
|
||||
sizeto(fsh.levels[k], id);
|
||||
@ -545,6 +548,7 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
|
||||
for(int l=0; l<SIDEPARS; l++) {
|
||||
fsh.levels[l] = shFullFloor.levels[l];
|
||||
fsh.shadow = shFullFloor.shadow;
|
||||
for(auto& li: fsh.levels[l]) li.tinf = &fsh.tinf3;
|
||||
fsh.side[l] = shFullFloor.side[l];
|
||||
for(auto& li: fsh.side[l]) li.tinf = &fsh.tinf3;
|
||||
|
14
graph.cpp
14
graph.cpp
@ -4006,6 +4006,8 @@ void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int c
|
||||
if(!qfi.fshape) qfi.fshape = &shFullFloor;
|
||||
if(conegraph(c)) {
|
||||
draw_shapevec(c, V, qfi.fshape->cone[0], darkena(wcol, 0, 0xFF), PPR::WALL);
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
||||
return;
|
||||
}
|
||||
color_t wcol0 = wcol;
|
||||
@ -4014,6 +4016,9 @@ void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int c
|
||||
forCellIdEx(c2, i, c)
|
||||
if(!highwall(c2) || conegraph(c2))
|
||||
placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, fd, 255));
|
||||
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5555,6 +5560,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
if(c->land == laOceanWall && wmescher && wmspatial) {
|
||||
if(GDIM == 3 && qfi.fshape) {
|
||||
draw_shapevec(c, V, qfi.fshape->cone[1], darkena(wcol, 0, 0xFF), PPR::WALL);
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
||||
break;
|
||||
}
|
||||
const int layers = 2 << detaillevel;
|
||||
@ -5629,6 +5636,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
else if(c->wall == waExplosiveBarrel) {
|
||||
if(DIM == 3 && qfi.fshape) {
|
||||
draw_shapevec(c, V, qfi.fshape->cone[1], 0xD00000FF, PPR::REDWALL);
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
||||
break;
|
||||
}
|
||||
const int layers = 2 << detaillevel;
|
||||
@ -5641,8 +5650,11 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
else if(isFire(c) || isThumper(c) || c->wall == waBonfireOff) {
|
||||
auto V2 = V;
|
||||
if(hasTimeout(c)) V2 = V2 * spintick(c->land == laPower ? 5000 : 500);
|
||||
if(GDIM == 3 && qfi.fshape)
|
||||
if(GDIM == 3 && qfi.fshape) {
|
||||
draw_shapevec(c, V2, qfi.fshape->cone[1], darkena(wcol, 0, 0xF0), PPR::WALL);
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW);
|
||||
}
|
||||
else queuepoly(V2, shStar, darkena(wcol, 0, 0xF0));
|
||||
if(isFire(c) && rand() % 300 < ticks - lastt)
|
||||
drawParticle(c, wcol, 75);
|
||||
|
@ -672,6 +672,7 @@ void dqi_poly::gldraw() {
|
||||
if(flags & POLY_TRIANGLES) {
|
||||
glhr::color2(color);
|
||||
glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE);
|
||||
glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW);
|
||||
glDrawArrays(GL_TRIANGLES, ioffset, cnt);
|
||||
}
|
||||
else {
|
||||
@ -687,6 +688,7 @@ void dqi_poly::gldraw() {
|
||||
current_display->set_mask(ed);
|
||||
glhr::color2(color);
|
||||
glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE);
|
||||
glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW);
|
||||
|
||||
if(flags & (POLY_INVERSE | POLY_FORCE_INVERTED)) {
|
||||
glStencilOp( GL_ZERO, GL_ZERO, GL_ZERO);
|
||||
|
12
shaders.cpp
12
shaders.cpp
@ -781,5 +781,17 @@ void set_depthtest(bool b) {
|
||||
else glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool current_depthwrite;
|
||||
|
||||
void set_depthwrite(bool b) {
|
||||
if(b != current_depthwrite) {
|
||||
current_depthwrite = b;
|
||||
if(b) glDepthMask(GL_TRUE);
|
||||
else glDisable(GL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user