mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
2d3d:: shadows
This commit is contained in:
parent
b63f8a3c4d
commit
175c061ab4
@ -828,6 +828,12 @@ void queueball(const transmatrix& V, ld rad, color_t col, eItem what) {
|
||||
}
|
||||
}
|
||||
|
||||
void make_shadow(hpcshape& sh) {
|
||||
sh.shs = isize(hpc);
|
||||
for(int i=sh.s; i < sh.e; i++) hpcpush(orthogonal_move(hpc[i], geom3::FLOOR - geom3::human_height / 100));
|
||||
sh.she = isize(hpc);
|
||||
}
|
||||
|
||||
void make_3d_models() {
|
||||
if(DIM == 2) return;
|
||||
DEBBI(DF_POLY, ("make_3d_models"));
|
||||
@ -838,6 +844,17 @@ void make_3d_models() {
|
||||
utt.tvertices.clear();
|
||||
utt.texture_id = floor_textures->renderedTexture;
|
||||
}
|
||||
|
||||
if(WDIM == 2) {
|
||||
DEBB(DF_POLY, ("shadows"));
|
||||
for(hpcshape* sh: {&shBatWings, &shBugBody, &shBullBody, &shButterflyWing, &shCatBody, &shDogBody, &shDogTorso,
|
||||
&shEagle, &shFemaleBody, &shFlailMissile, &shGadflyWing, &shGargoyleWings, &shHawk, &shJiangShi, &shKnife,
|
||||
&shPBody, &shPHead, &shRaiderBody, &shReptileBody, &shSkeletonBody, &shTongue, &shTrapArrow, &shTrylobite,
|
||||
&shWaterElemental, &shWolfBody, &shYeti})
|
||||
make_shadow(*sh);
|
||||
|
||||
for(int i=0; i<8; i++) make_shadow(shAsteroid[i]);
|
||||
}
|
||||
|
||||
DEBB(DF_POLY, ("humanoids"));
|
||||
make_humanoid_3d(shPBody);
|
||||
|
12
graph.cpp
12
graph.cpp
@ -563,6 +563,16 @@ bool noshadow;
|
||||
|
||||
#if CAP_SHAPES
|
||||
void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio) {
|
||||
if(WDIM == 2 && GDIM == 3 && bp.shs != bp.she) {
|
||||
auto& p = queuepolyat(V, bp, 0x18, PPR::TRANSPARENT);
|
||||
p.outline = 0;
|
||||
p.subprio = -100;
|
||||
p.offset = bp.shs;
|
||||
p.cnt = bp.she - bp.shs;
|
||||
p.flags &=~ POLY_TRIANGLES;
|
||||
p.tinf = NULL;
|
||||
return;
|
||||
}
|
||||
if(mmspatial) {
|
||||
if(model_needs_depth() || noshadow)
|
||||
return; // shadows break the depth testing
|
||||
@ -5177,7 +5187,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
|
||||
int fd0 = fd ? fd-1 : 0;
|
||||
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
|
||||
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd0, 0x80), PPR::TRANSPARENT), ptds.back()->subprio = c->cpdist * 4;
|
||||
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LAKE], darkena3(fcol, fd0, 0x80), PPR::TRANSPARENT), ptds.back()->subprio = -200;
|
||||
else
|
||||
draw_qfi(c, (*Vdp), darkena(fcol, fd0, 0x80), PPR::LAKELEV);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user