mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 16:07:40 +00:00
- support dynamic lights on translucent and 3d floor walls
This commit is contained in:
parent
7168466c28
commit
a478cf9a96
5 changed files with 21 additions and 22 deletions
|
@ -884,7 +884,7 @@ namespace swrenderer
|
||||||
texcoords.ProjectTop(Thread->Viewport.get(), mFrontSector, mBackSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mTopTexture);
|
texcoords.ProjectTop(Thread->Viewport.get(), mFrontSector, mBackSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mTopTexture);
|
||||||
|
|
||||||
RenderWallPart renderWallpart(Thread);
|
RenderWallPart renderWallpart(Thread);
|
||||||
renderWallpart.Render(mFrontSector, mLineSegment, WallC, mTopTexture, x1, x2, walltop.ScreenY, wallupper.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mBackCeilingZ1, mBackCeilingZ2), false, false, OPAQUE, GetLightList());
|
renderWallpart.Render(mFrontSector, mLineSegment, WallC, mTopTexture, x1, x2, walltop.ScreenY, wallupper.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mBackCeilingZ1, mBackCeilingZ2), false, false, OPAQUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWRenderLine::RenderMiddleTexture(int x1, int x2)
|
void SWRenderLine::RenderMiddleTexture(int x1, int x2)
|
||||||
|
@ -896,7 +896,7 @@ namespace swrenderer
|
||||||
texcoords.ProjectMid(Thread->Viewport.get(), mFrontSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mMiddleTexture);
|
texcoords.ProjectMid(Thread->Viewport.get(), mFrontSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mMiddleTexture);
|
||||||
|
|
||||||
RenderWallPart renderWallpart(Thread);
|
RenderWallPart renderWallpart(Thread);
|
||||||
renderWallpart.Render(mFrontSector, mLineSegment, WallC, mMiddleTexture, x1, x2, walltop.ScreenY, wallbottom.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE, GetLightList());
|
renderWallpart.Render(mFrontSector, mLineSegment, WallC, mMiddleTexture, x1, x2, walltop.ScreenY, wallbottom.ScreenY, texcoords, MAX(mFrontCeilingZ1, mFrontCeilingZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWRenderLine::RenderBottomTexture(int x1, int x2)
|
void SWRenderLine::RenderBottomTexture(int x1, int x2)
|
||||||
|
@ -909,18 +909,7 @@ namespace swrenderer
|
||||||
texcoords.ProjectBottom(Thread->Viewport.get(), mFrontSector, mBackSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mBottomTexture);
|
texcoords.ProjectBottom(Thread->Viewport.get(), mFrontSector, mBackSector, mLineSegment, WallC.sx1, WallC.sx2, WallT, mBottomTexture);
|
||||||
|
|
||||||
RenderWallPart renderWallpart(Thread);
|
RenderWallPart renderWallpart(Thread);
|
||||||
renderWallpart.Render(mFrontSector, mLineSegment, WallC, mBottomTexture, x1, x2, walllower.ScreenY, wallbottom.ScreenY, texcoords, MAX(mBackFloorZ1, mBackFloorZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE, GetLightList());
|
renderWallpart.Render(mFrontSector, mLineSegment, WallC, mBottomTexture, x1, x2, walllower.ScreenY, wallbottom.ScreenY, texcoords, MAX(mBackFloorZ1, mBackFloorZ2), MIN(mFrontFloorZ1, mFrontFloorZ2), false, false, OPAQUE);
|
||||||
}
|
|
||||||
|
|
||||||
FLightNode *SWRenderLine::GetLightList()
|
|
||||||
{
|
|
||||||
CameraLight *cameraLight = CameraLight::Instance();
|
|
||||||
if ((cameraLight->FixedLightLevel() >= 0) || cameraLight->FixedColormap())
|
|
||||||
return nullptr; // [SP] Don't draw dynlights if invul/lightamp active
|
|
||||||
else if (mLineSegment && mLineSegment->sidedef)
|
|
||||||
return mLineSegment->sidedef->lighthead;
|
|
||||||
else
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -74,8 +74,6 @@ namespace swrenderer
|
||||||
void RenderMiddleTexture(int x1, int x2);
|
void RenderMiddleTexture(int x1, int x2);
|
||||||
void RenderBottomTexture(int x1, int x2);
|
void RenderBottomTexture(int x1, int x2);
|
||||||
|
|
||||||
FLightNode *GetLightList();
|
|
||||||
|
|
||||||
bool IsFogBoundary(sector_t *front, sector_t *back) const;
|
bool IsFogBoundary(sector_t *front, sector_t *back) const;
|
||||||
bool SkyboxCompare(sector_t *frontsector, sector_t *backsector) const;
|
bool SkyboxCompare(sector_t *frontsector, sector_t *backsector) const;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ namespace swrenderer
|
||||||
bool additive = (curline->linedef->flags & ML_ADDTRANS) != 0;
|
bool additive = (curline->linedef->flags & ML_ADDTRANS) != 0;
|
||||||
|
|
||||||
RenderWallPart renderWallpart(Thread);
|
RenderWallPart renderWallpart(Thread);
|
||||||
renderWallpart.Render(lightsector, curline, ds->WallC, tex, x1, x2, mceilingclip, mfloorclip, ds->texcoords, top, bot, true, additive, alpha, nullptr);
|
renderWallpart.Render(lightsector, curline, ds->WallC, tex, x1, x2, mceilingclip, mfloorclip, ds->texcoords, top, bot, true, additive, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderDrawSegment::Render3DFloorWall(DrawSegment *ds, int x1, int x2, F3DFloor *rover, double clipTop, double clipBottom, FSoftwareTexture *rw_pic)
|
void RenderDrawSegment::Render3DFloorWall(DrawSegment *ds, int x1, int x2, F3DFloor *rover, double clipTop, double clipBottom, FSoftwareTexture *rw_pic)
|
||||||
|
@ -227,7 +227,7 @@ namespace swrenderer
|
||||||
GetMaskedWallTopBottom(ds, top, bot);
|
GetMaskedWallTopBottom(ds, top, bot);
|
||||||
|
|
||||||
RenderWallPart renderWallpart(Thread);
|
RenderWallPart renderWallpart(Thread);
|
||||||
renderWallpart.Render(lightsector, curline, ds->WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, walltexcoords, top, bot, true, (rover->flags & FF_ADDITIVETRANS) != 0, Alpha, nullptr);
|
renderWallpart.Render(lightsector, curline, ds->WallC, rw_pic, x1, x2, wallupper.ScreenY, walllower.ScreenY, walltexcoords, top, bot, true, (rover->flags & FF_ADDITIVETRANS) != 0, Alpha);
|
||||||
|
|
||||||
ProjectedWallLight walllight;
|
ProjectedWallLight walllight;
|
||||||
walllight.SetColormap(lightsector, curline);
|
walllight.SetColormap(lightsector, curline);
|
||||||
|
|
|
@ -528,19 +528,31 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderWallPart::Render(const sector_t *lightsector, seg_t *curline, const FWallCoords &WallC, FSoftwareTexture *pic, int x1, int x2, const short *walltop, const short *wallbottom, const ProjectedWallTexcoords& texcoords, double top, double bottom, bool mask, bool additive, fixed_t alpha, FLightNode *light_list)
|
FLightNode* RenderWallPart::GetLightList()
|
||||||
|
{
|
||||||
|
CameraLight* cameraLight = CameraLight::Instance();
|
||||||
|
if ((cameraLight->FixedLightLevel() >= 0) || cameraLight->FixedColormap())
|
||||||
|
return nullptr; // [SP] Don't draw dynlights if invul/lightamp active
|
||||||
|
else if (curline && curline->sidedef)
|
||||||
|
return curline->sidedef->lighthead;
|
||||||
|
else
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderWallPart::Render(const sector_t *lightsector, seg_t *curline, const FWallCoords &WallC, FSoftwareTexture *pic, int x1, int x2, const short *walltop, const short *wallbottom, const ProjectedWallTexcoords& texcoords, double top, double bottom, bool mask, bool additive, fixed_t alpha)
|
||||||
{
|
{
|
||||||
this->x1 = x1;
|
this->x1 = x1;
|
||||||
this->x2 = x2;
|
this->x2 = x2;
|
||||||
this->lightsector = lightsector;
|
this->lightsector = lightsector;
|
||||||
this->curline = curline;
|
this->curline = curline;
|
||||||
this->WallC = WallC;
|
this->WallC = WallC;
|
||||||
this->light_list = light_list;
|
|
||||||
this->rw_pic = pic;
|
this->rw_pic = pic;
|
||||||
this->mask = mask;
|
this->mask = mask;
|
||||||
this->additive = additive;
|
this->additive = additive;
|
||||||
this->alpha = alpha;
|
this->alpha = alpha;
|
||||||
|
|
||||||
|
light_list = GetLightList();
|
||||||
|
|
||||||
mLight.SetColormap(lightsector, curline);
|
mLight.SetColormap(lightsector, curline);
|
||||||
mLight.SetLightLeft(Thread, WallC);
|
mLight.SetLightLeft(Thread, WallC);
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,7 @@ namespace swrenderer
|
||||||
double bottom,
|
double bottom,
|
||||||
bool mask,
|
bool mask,
|
||||||
bool additive,
|
bool additive,
|
||||||
fixed_t alpha,
|
fixed_t alpha);
|
||||||
FLightNode *light_list);
|
|
||||||
|
|
||||||
RenderThread *Thread = nullptr;
|
RenderThread *Thread = nullptr;
|
||||||
|
|
||||||
|
@ -70,6 +69,7 @@ namespace swrenderer
|
||||||
void ProcessStripedWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords);
|
void ProcessStripedWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords);
|
||||||
void ProcessNormalWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords);
|
void ProcessNormalWall(const short *uwal, const short *dwal, const ProjectedWallTexcoords& texcoords);
|
||||||
void SetLights(WallDrawerArgs &drawerargs, int x, int y1);
|
void SetLights(WallDrawerArgs &drawerargs, int x, int y1);
|
||||||
|
FLightNode* GetLightList();
|
||||||
|
|
||||||
int x1 = 0;
|
int x1 = 0;
|
||||||
int x2 = 0;
|
int x2 = 0;
|
||||||
|
|
Loading…
Reference in a new issue