mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- added dynamic light rendering with textures on flats
This commit is contained in:
parent
c9d4c68039
commit
0b2821d696
3 changed files with 56 additions and 33 deletions
|
@ -582,20 +582,12 @@ void GLWall::RenderFogBoundaryCompat()
|
|||
// Flats
|
||||
//
|
||||
//==========================================================================
|
||||
enum
|
||||
{
|
||||
LIGHTPASS_MULT,
|
||||
LIGHTPASS_ADD,
|
||||
LIGHTPASS_FOG
|
||||
};
|
||||
|
||||
void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
|
||||
{
|
||||
Plane p;
|
||||
Vector nearPt, up, right, t1;
|
||||
float scale;
|
||||
unsigned int k;
|
||||
seg_t *v;
|
||||
|
||||
FLightNode * node = sub->lighthead;
|
||||
gl_RenderState.Apply();
|
||||
|
@ -603,33 +595,13 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
|
|||
{
|
||||
ADynamicLight * light = node->lightsource;
|
||||
|
||||
if (light->flags2&MF2_DORMANT)
|
||||
if (light->flags2&MF2_DORMANT ||
|
||||
(pass == GLPASS_LIGHTTEX && light->IsAdditive()) ||
|
||||
(pass == GLPASS_LIGHTTEX_ADDITIVE && !light->IsAdditive()))
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
}
|
||||
switch (pass)
|
||||
{
|
||||
case LIGHTPASS_MULT:
|
||||
if (light->IsAdditive())
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case LIGHTPASS_ADD:
|
||||
if (!light->IsAdditive())
|
||||
{
|
||||
node = node->nextLight;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// we must do the side check here because gl_SetupLight needs the correct plane orientation
|
||||
// which we don't have for Legacy-style 3D-floors
|
||||
|
@ -666,6 +638,49 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void GLFlat::DrawLightsCompat(int pass)
|
||||
{
|
||||
gl_RenderState.Apply();
|
||||
if (sub)
|
||||
{
|
||||
// This represents a single subsector
|
||||
DrawSubsectorLights(sub, pass);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw the subsectors belonging to this sector
|
||||
for (int i = 0; i<sector->subsectorcount; i++)
|
||||
{
|
||||
subsector_t * sub = sector->subsectors[i];
|
||||
if (gl_drawinfo->ss_renderflags[sub - subsectors] & renderflags)
|
||||
{
|
||||
DrawSubsectorLights(sub, pass);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the subsectors assigned to it due to missing textures
|
||||
if (!(renderflags&SSRF_RENDER3DPLANES))
|
||||
{
|
||||
gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR) ?
|
||||
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) :
|
||||
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum);
|
||||
|
||||
while (node)
|
||||
{
|
||||
DrawSubsectorLights(sub, pass);
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -443,6 +443,11 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
}
|
||||
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
|
||||
case GLPASS_LIGHTTEX:
|
||||
case GLPASS_LIGHTTEX_ADDITIVE:
|
||||
DrawLightsCompat(pass);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -296,15 +296,18 @@ public:
|
|||
|
||||
int dynlightindex;
|
||||
|
||||
// compatibility fallback stuff.
|
||||
void DrawSubsectorLights(subsector_t * sub, int pass);
|
||||
void DrawLightsCompat(int pass);
|
||||
bool PutFlatCompat(bool fog);
|
||||
|
||||
void SetupSubsectorLights(int pass, subsector_t * sub, int *dli = NULL);
|
||||
void DrawSubsector(subsector_t * sub);
|
||||
void DrawSubsectorLights(subsector_t * sub, int pass);
|
||||
void DrawSkyboxSector(int pass, bool processlights);
|
||||
void DrawSubsectors(int pass, bool processlights, bool istrans);
|
||||
void ProcessLights(bool istrans);
|
||||
|
||||
void PutFlat(bool fog = false);
|
||||
bool PutFlatCompat(bool fog);
|
||||
void Process(sector_t * model, int whichplane, bool notexture);
|
||||
void SetFrom3DFloor(F3DFloor *rover, bool top, bool underside);
|
||||
void ProcessSector(sector_t * frontsector);
|
||||
|
|
Loading…
Reference in a new issue