- moved gl_fixedcolormap into GLSceneDrawer.

This means that one of the most extensively used global variables is gone.
This commit is contained in:
Christoph Oelckers 2017-03-12 21:57:39 +01:00
parent 61c91f05fc
commit 4c61048278
24 changed files with 184 additions and 199 deletions

View File

@ -318,7 +318,7 @@ void FRenderState::DrawColormapOverlay()
float r, g, b;
if (mColormapState > CM_DEFAULT && mColormapState < CM_MAXCOLORMAP)
{
FSpecialColormap *scm = &SpecialColormaps[gl_fixedcolormap - CM_FIRSTSPECIALCOLORMAP];
FSpecialColormap *scm = &SpecialColormaps[mColormapState - CM_FIRSTSPECIALCOLORMAP];
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
@ -453,7 +453,7 @@ bool GLWall::PutWallCompat(int passflag)
{ { GLLDL_WALLS_PLAIN, GLLDL_WALLS_FOG },{ GLLDL_WALLS_MASKED, GLLDL_WALLS_FOGMASKED } };
// are lights possible?
if (gl_fixedcolormap != CM_DEFAULT || !gl_lights || seg->sidedef == nullptr || type == RENDERWALL_M2SNF || !gltexture) return false;
if (mDrawer->FixedColormap != CM_DEFAULT || !gl_lights || seg->sidedef == nullptr || type == RENDERWALL_M2SNF || !gltexture) return false;
// multipassing these is problematic.
if ((flags&GLWF_SKYHACK && type == RENDERWALL_M2S)) return false;
@ -486,7 +486,7 @@ bool GLWall::PutWallCompat(int passflag)
bool GLFlat::PutFlatCompat(bool fog)
{
// are lights possible?
if (gl_fixedcolormap != CM_DEFAULT || !gl_lights || !gltexture || renderstyle != STYLE_Translucent || alpha < 1.f - FLT_EPSILON || sector->lighthead == NULL) return false;
if (mDrawer->FixedColormap != CM_DEFAULT || !gl_lights || !gltexture || renderstyle != STYLE_Translucent || alpha < 1.f - FLT_EPSILON || sector->lighthead == NULL) return false;
static int list_indices[2][2] =
{ { GLLDL_FLATS_PLAIN, GLLDL_FLATS_FOG },{ GLLDL_FLATS_MASKED, GLLDL_FLATS_FOGMASKED } };
@ -699,8 +699,8 @@ void GLWall::RenderLightsCompat(int pass)
FLightNode * node;
// black fog is diminishing light and should affect lights less than the rest!
if (pass == GLPASS_LIGHTTEX) gl_SetFog((255 + lightlevel) >> 1, 0, NULL, false);
else gl_SetFog(lightlevel, 0, &Colormap, true);
if (pass == GLPASS_LIGHTTEX) mDrawer->SetFog((255 + lightlevel) >> 1, 0, NULL, false);
else mDrawer->SetFog(lightlevel, 0, &Colormap, true);
if (seg->sidedef == NULL)
{
@ -785,7 +785,7 @@ void GLSceneDrawer::RenderMultipassStuff()
// second pass: draw lights
glDepthMask(false);
if (GLRenderer->mLightCount && !gl_fixedcolormap)
if (GLRenderer->mLightCount && !FixedColormap)
{
if (gl_SetupLightTexture())
{

View File

@ -437,7 +437,7 @@ void F2DDrawer::Draw()
FColormap cm;
cm = dsp->mColormap;
gl_SetColor(dsp->mLightLevel, 0, cm, 1.f);
gl_SetColor(dsp->mLightLevel, 0, false, cm, 1.f);
gl_RenderState.SetMaterial(dsp->mTexture, CLAMP_NONE, 0, -1, false);
gl_RenderState.SetObjectColor(dsp->mFlatColor|0xff000000);
gl_RenderState.Apply();

View File

@ -5,8 +5,6 @@
#include "v_palette.h"
#include "r_data/colormaps.h"
extern int gl_fixedcolormap;
struct lightlist_t;
enum EColorManipulation

View File

@ -260,9 +260,9 @@ static PalEntry gl_CalcLightColor(int light, PalEntry pe, int blendfactor)
// set current light color
//
//==========================================================================
void gl_SetColor(int sectorlightlevel, int rellight, const FColormap &cm, float alpha, bool weapon)
void gl_SetColor(int sectorlightlevel, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon)
{
if (gl_fixedcolormap != CM_DEFAULT)
if (fullbright)
{
gl_RenderState.SetColorAlpha(0xffffff, alpha, 0);
gl_RenderState.SetSoftLightLevel(255);
@ -390,7 +390,6 @@ bool gl_CheckFog(FColormap *cm, int lightlevel)
bool gl_CheckFog(sector_t *frontsector, sector_t *backsector)
{
if (gl_fixedcolormap) return false;
if (frontsector == backsector) return false; // there can't be a boundary if both sides are in the same sector.
// Check for fog boundaries. This needs a few more checks for the sectors
@ -479,7 +478,7 @@ void gl_SetShaderLight(float level, float olight)
//
//==========================================================================
void gl_SetFog(int lightlevel, int rellight, const FColormap *cmap, bool isadditive)
void gl_SetFog(int lightlevel, int rellight, bool fullbright, const FColormap *cmap, bool isadditive)
{
PalEntry fogcolor;
float fogdensity;
@ -489,7 +488,7 @@ void gl_SetFog(int lightlevel, int rellight, const FColormap *cmap, bool isaddit
fogdensity=70;
fogcolor=0x808080;
}
else if (cmap != NULL && gl_fixedcolormap == 0)
else if (cmap != NULL && !fullbright)
{
fogcolor = cmap->FadeColor;
fogdensity = gl_GetFogDensity(lightlevel, fogcolor, cmap->fogdensity);

View File

@ -16,14 +16,14 @@ void gl_GetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblend
void gl_SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog);
int gl_CalcLightLevel(int lightlevel, int rellight, bool weapon);
void gl_SetColor(int light, int rellight, const FColormap &cm, float alpha, bool weapon=false);
void gl_SetColor(int light, int rellight, bool fullbright, const FColormap &cm, float alpha, bool weapon=false);
float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity);
struct sector_t;
bool gl_CheckFog(FColormap *cm, int lightlevel);
bool gl_CheckFog(sector_t *frontsector, sector_t *backsector);
void gl_SetFog(int lightlevel, int rellight, const FColormap *cm, bool isadditive);
void gl_SetFog(int lightlevel, int rellight, bool fullbright, const FColormap *cm, bool isadditive);
inline bool gl_isBlack(PalEntry color)
{
@ -35,13 +35,6 @@ inline bool gl_isWhite(PalEntry color)
return color.r + color.g + color.b == 3*0xff;
}
extern int gl_fixedcolormap;
inline bool gl_isFullbright(PalEntry color, int lightlevel)
{
return gl_fixedcolormap || (gl_isWhite(color) && lightlevel==255);
}
extern int fogdensity;
extern int outsidefogdensity;
extern int skyfog;

View File

@ -157,13 +157,13 @@ void FGLRenderer::RenderScreenQuad()
GLRenderer->mVBO->RenderArray(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
}
void FGLRenderer::PostProcessScene()
void FGLRenderer::PostProcessScene(int fixedcm)
{
mBuffers->BlitSceneToTexture();
UpdateCameraExposure();
BloomScene();
BloomScene(fixedcm);
TonemapScene();
ColormapScene();
ColormapScene(fixedcm);
LensDistortScene();
ApplyFXAA();
}
@ -382,10 +382,10 @@ void FGLRenderer::UpdateCameraExposure()
//
//-----------------------------------------------------------------------------
void FGLRenderer::BloomScene()
void FGLRenderer::BloomScene(int fixedcm)
{
// Only bloom things if enabled and no special fixed light mode is active
if (!gl_bloom || gl_fixedcolormap != CM_DEFAULT || gl_ssao_debug)
if (!gl_bloom || fixedcm != CM_DEFAULT || gl_ssao_debug)
return;
FGLDebug::PushGroup("BloomScene");
@ -559,9 +559,9 @@ void FGLRenderer::ClearTonemapPalette()
//
//-----------------------------------------------------------------------------
void FGLRenderer::ColormapScene()
void FGLRenderer::ColormapScene(int fixedcm)
{
if (gl_fixedcolormap < CM_FIRSTSPECIALCOLORMAP || gl_fixedcolormap >= CM_MAXCOLORMAP)
if (fixedcm < CM_FIRSTSPECIALCOLORMAP || fixedcm >= CM_MAXCOLORMAP)
return;
FGLDebug::PushGroup("ColormapScene");
@ -572,7 +572,7 @@ void FGLRenderer::ColormapScene()
mBuffers->BindCurrentTexture(0);
mColormapShader->Bind();
FSpecialColormap *scm = &SpecialColormaps[gl_fixedcolormap - CM_FIRSTSPECIALCOLORMAP];
FSpecialColormap *scm = &SpecialColormaps[fixedcm - CM_FIRSTSPECIALCOLORMAP];
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };

View File

@ -361,55 +361,6 @@ void FGLRenderer::Begin2D()
//
//===========================================================================
void FGLRenderer::ProcessLowerMiniseg(seg_t *seg, sector_t * frontsector, sector_t * backsector)
{
GLWall wall;
wall.ProcessLowerMiniseg(seg, frontsector, backsector);
rendered_lines++;
}
//===========================================================================
//
//
//
//===========================================================================
void FGLRenderer::ProcessSprite(AActor *thing, sector_t *sector, bool thruportal)
{
GLSprite glsprite;
glsprite.Process(thing, sector, thruportal);
}
//===========================================================================
//
//
//
//===========================================================================
void FGLRenderer::ProcessParticle(particle_t *part, sector_t *sector)
{
GLSprite glsprite;
glsprite.ProcessParticle(part, sector);//, 0, 0);
}
//===========================================================================
//
//
//
//===========================================================================
void FGLRenderer::ProcessSector(sector_t *fakesector)
{
GLFlat glflat;
glflat.ProcessSector(fakesector);
}
//===========================================================================
//
//
//
//===========================================================================
void FGLRenderer::FlushTextures()
{
FMaterial::FlushAll();

View File

@ -160,29 +160,20 @@ public:
void Initialize(int width, int height);
void DrawPSprite (player_t * player,DPSprite *psp,float sx, float sy, bool hudModelStep, int OverrideShader, bool alphatexture);
void DrawPlayerSprites(sector_t * viewsector, bool hudModelStep);
void DrawTargeterSprites();
void Begin2D();
void ClearBorders();
void ProcessLowerMiniseg(seg_t *seg, sector_t * frontsector, sector_t * backsector);
void ProcessSprite(AActor *thing, sector_t *sector, bool thruportal);
void ProcessParticle(particle_t *part, sector_t *sector);
void ProcessSector(sector_t *fakesector);
void FlushTextures();
unsigned char *GetTextureBuffer(FTexture *tex, int &w, int &h);
void SetupLevel();
void RenderScreenQuad();
void PostProcessScene();
void PostProcessScene(int fixedcm);
void AmbientOccludeScene();
void UpdateCameraExposure();
void BloomScene();
void BloomScene(int fixedcm);
void TonemapScene();
void ColormapScene();
void ColormapScene(int fixedcm);
void CreateTonemapPalette();
void ClearTonemapPalette();
void LensDistortScene();

View File

@ -226,7 +226,7 @@ bool FRenderState::ApplyShader()
}
else
{
FSpecialColormap *scm = &SpecialColormaps[gl_fixedcolormap - CM_FIRSTSPECIALCOLORMAP];
FSpecialColormap *scm = &SpecialColormaps[mColormapState - CM_FIRSTSPECIALCOLORMAP];
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };

View File

@ -173,7 +173,7 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
{
SetupWall.Clock();
GLWall wall;
GLWall wall(this);
wall.sub = currentsubsector;
wall.Process(seg, currentsector, backsector);
rendered_lines++;
@ -371,7 +371,8 @@ void GLSceneDrawer::RenderThings(subsector_t * sub, sector_t * sector)
}
}
GLRenderer->ProcessSprite(thing, sector, false);
GLSprite sprite(this);
sprite.Process(thing, sector, false);
}
for (msecnode_t *node = sec->sectorportal_thinglist; node; node = node->m_snext)
@ -388,7 +389,8 @@ void GLSceneDrawer::RenderThings(subsector_t * sub, sector_t * sector)
}
}
GLRenderer->ProcessSprite(thing, sector, true);
GLSprite sprite(this);
sprite.Process(thing, sector, true);
}
SetupSprite.Unclock();
}
@ -460,7 +462,8 @@ void GLSceneDrawer::DoSubsector(subsector_t * sub)
for (i = ParticlesInSubsec[uint32_t(sub-subsectors)]; i != NO_PARTICLE; i = Particles[i].snext)
{
GLRenderer->ProcessParticle(&Particles[i], fakesector);
GLSprite sprite(this);
sprite.ProcessParticle(&Particles[i], fakesector);
}
SetupSprite.Unclock();
}
@ -508,7 +511,8 @@ void GLSceneDrawer::DoSubsector(subsector_t * sub)
srf |= SSRF_PROCESSED;
SetupFlat.Clock();
GLRenderer->ProcessSector(fakesector);
GLFlat flat(this);
flat.ProcessSector(fakesector);
SetupFlat.Unclock();
}
// mark subsector as processed - but mark for rendering only if it has an actual area.

View File

@ -37,6 +37,7 @@
#include "gl/renderer/gl_lightdata.h"
#include "gl/renderer/gl_renderstate.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_texture.h"
#include "gl/textures/gl_material.h"
@ -282,7 +283,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
}
// calculate dynamic light effect.
if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && gl_light_sprites)
if (gl_lights && GLRenderer->mLightCount && !mDrawer->FixedColormap && gl_light_sprites)
{
// Note: This should be replaced with proper shader based lighting.
double x, y;
@ -308,7 +309,7 @@ void GLWall::DrawDecal(DBaseDecal *decal)
else gl_RenderState.AlphaFunc(GL_GREATER, 0.f);
gl_SetColor(light, rel, p, a);
mDrawer->SetColor(light, rel, p, a);
// for additively drawn decals we must temporarily set the fog color to black.
PalEntry fc = gl_RenderState.GetFogColor();
if (decal->RenderStyle.BlendOp == STYLEOP_Add && decal->RenderStyle.DestAlpha == STYLEALPHA_One)
@ -344,9 +345,9 @@ void GLWall::DrawDecal(DBaseDecal *decal)
FColormap thiscm;
thiscm.FadeColor = Colormap.FadeColor;
thiscm.CopyFrom3DLight(&(*lightlist)[k]);
gl_SetColor(thisll, rel, thiscm, a);
mDrawer->SetColor(thisll, rel, thiscm, a);
if (glset.nocoloredspritelighting) thiscm.Decolorize();
gl_SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
mDrawer->SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
gl_RenderState.SetSplitPlanes((*lightlist)[k].plane, lowplane);
gl_RenderState.Apply();
@ -378,7 +379,7 @@ void GLWall::DoDrawDecals()
}
else
{
gl_SetFog(lightlevel, rellight + getExtraLight(), &Colormap, false);
mDrawer->SetFog(lightlevel, rellight + getExtraLight(), &Colormap, false);
}
DBaseDecal *decal = seg->sidedef->AttachedDecals;

View File

@ -39,6 +39,7 @@
#include "gl/data/gl_vertexbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/renderer/gl_lightdata.h"
#include "gl/renderer/gl_renderstate.h"
#include "gl/textures/gl_material.h"
@ -1034,9 +1035,10 @@ FDrawInfo::~FDrawInfo()
// Sets up a new drawinfo struct
//
//==========================================================================
void FDrawInfo::StartDrawInfo()
void FDrawInfo::StartDrawInfo(GLSceneDrawer *drawer)
{
FDrawInfo *di=di_list.GetNew();
di->mDrawer = drawer;
di->StartScene();
}
@ -1165,7 +1167,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
gltexture=FMaterial::ValidateTexture(plane.texture, false, true);
if (!gltexture) return;
if (gl_fixedcolormap)
if (mDrawer->FixedColormap)
{
Colormap.Clear();
lightlevel=255;
@ -1182,8 +1184,8 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
}
int rel = getExtraLight();
gl_SetColor(lightlevel, rel, Colormap, 1.0f);
gl_SetFog(lightlevel, rel, &Colormap, false);
mDrawer->SetColor(lightlevel, rel, Colormap, 1.0f);
mDrawer->SetFog(lightlevel, rel, &Colormap, false);
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
float fviewx = r_viewpoint.Pos.X;

View File

@ -206,6 +206,8 @@ struct FDrawInfo
uint8_t flags;
};
GLSceneDrawer *mDrawer;
TArray<uint8_t> sectorrenderflags;
TArray<uint8_t> ss_renderflags;
TArray<uint8_t> no_renderflags;
@ -266,7 +268,7 @@ struct FDrawInfo
void FloodUpperGap(seg_t * seg);
void FloodLowerGap(seg_t * seg);
static void StartDrawInfo();
static void StartDrawInfo(GLSceneDrawer *drawer);
static void EndDrawInfo();
gl_subsectorrendernode * GetOtherFloorPlanes(unsigned int sector)

View File

@ -50,6 +50,7 @@
#include "gl/dynlights/gl_lightbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/shaders/gl_shader.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h"
#include "gl/utility/gl_convert.h"
@ -378,8 +379,8 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
{
case GLPASS_PLAIN: // Single-pass rendering
case GLPASS_ALL: // Same, but also creates the dynlight data.
gl_SetColor(lightlevel, rel, Colormap,1.0f);
gl_SetFog(lightlevel, rel, &Colormap, false);
mDrawer->SetColor(lightlevel, rel, Colormap,1.0f);
mDrawer->SetFog(lightlevel, rel, &Colormap, false);
if (!gltexture->tex->isFullbright())
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (sector->special != GLSector_Skybox)
@ -406,8 +407,8 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
case GLPASS_TRANSLUCENT:
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
gl_SetColor(lightlevel, rel, Colormap, alpha);
gl_SetFog(lightlevel, rel, &Colormap, false);
mDrawer->SetColor(lightlevel, rel, Colormap, alpha);
mDrawer->SetFog(lightlevel, rel, &Colormap, false);
if (!gltexture || !gltexture->tex->isFullbright())
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (!gltexture)
@ -458,7 +459,7 @@ inline void GLFlat::PutFlat(bool fog)
{
int list;
if (gl_fixedcolormap)
if (mDrawer->FixedColormap)
{
Colormap.Clear();
}
@ -755,7 +756,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if ((rover->flags&(FF_EXISTS | FF_RENDERPLANES | FF_THISINSIDE)) == (FF_EXISTS | FF_RENDERPLANES))
{
if (rover->flags&FF_FOG && gl_fixedcolormap) continue;
if (rover->flags&FF_FOG && mDrawer->FixedColormap) continue;
if (!rover->top.copied && rover->flags&(FF_INVERTPLANES | FF_BOTHPLANES))
{
double ff_top = rover->top.plane->ZatPoint(sector->centerspot);
@ -795,7 +796,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if ((rover->flags&(FF_EXISTS | FF_RENDERPLANES | FF_THISINSIDE)) == (FF_EXISTS | FF_RENDERPLANES))
{
if (rover->flags&FF_FOG && gl_fixedcolormap) continue;
if (rover->flags&FF_FOG && mDrawer->FixedColormap) continue;
if (!rover->bottom.copied && rover->flags&(FF_INVERTPLANES | FF_BOTHPLANES))
{
double ff_bottom = rover->bottom.plane->ZatPoint(sector->centerspot);

View File

@ -91,8 +91,6 @@ UniqueList<GLHorizonInfo> UniqueHorizons;
UniqueList<secplane_t> UniquePlaneMirrors;
UniqueList<FGLLinePortal> UniqueLineToLines;
void gl_RenderActorsInPortal(FGLLinePortal *glport);
//==========================================================================
//
//
@ -246,7 +244,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
return false;
}
}
FDrawInfo::StartDrawInfo();
FDrawInfo::StartDrawInfo(drawer);
}
else
{
@ -274,7 +272,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
{
if (NeedDepthBuffer())
{
FDrawInfo::StartDrawInfo();
FDrawInfo::StartDrawInfo(drawer);
}
else
{
@ -1061,7 +1059,7 @@ void GLLineToLinePortal::DrawContents()
void GLLineToLinePortal::RenderAttached()
{
gl_RenderActorsInPortal(glport);
drawer->RenderActorsInPortal(glport);
}
//-----------------------------------------------------------------------------
@ -1172,14 +1170,14 @@ void GLHorizonPortal::DrawContents()
if (gltexture && gltexture->tex->isFullbright())
{
// glowing textures are always drawn full bright without color
gl_SetColor(255, 0, origin->colormap, 1.f);
gl_SetFog(255, 0, &origin->colormap, false);
drawer->SetColor(255, 0, origin->colormap, 1.f);
drawer->SetFog(255, 0, &origin->colormap, false);
}
else
{
int rel = getExtraLight();
gl_SetColor(origin->lightlevel, rel, origin->colormap, 1.0f);
gl_SetFog(origin->lightlevel, rel, &origin->colormap, false);
drawer->SetColor(origin->lightlevel, rel, origin->colormap, 1.0f);
drawer->SetFog(origin->lightlevel, rel, &origin->colormap, false);
}

View File

@ -962,7 +962,9 @@ void FDrawInfo::HandleHackedSubsectors()
if (inview) for(unsigned int j=0;j<lowersegs.Size();j++)
{
seg_t * seg=lowersegs[j];
GLRenderer->ProcessLowerMiniseg (seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
GLWall wall(mDrawer);
wall.ProcessLowerMiniseg(seg, seg->Subsector->render_sector, seg->PartnerSeg->Subsector->render_sector);
rendered_lines++;
}
lowershcount+=HandledSubsectors.Size();
}

View File

@ -88,7 +88,6 @@ EXTERN_CVAR (Float, underwater_fade_scalar)
extern int viewpitch;
extern bool NoInterpolateView;
int gl_fixedcolormap;
area_t in_area;
TArray<uint8_t> currentmapsection;
int camtexcount;
@ -318,7 +317,7 @@ void GLSceneDrawer::RenderScene(int recursion)
// if we don't have a persistently mapped buffer, we have to process all the dynamic lights up front,
// so that we don't have to do repeated map/unmap calls on the buffer.
bool haslights = GLRenderer->mLightCount > 0 && gl_fixedcolormap == CM_DEFAULT && gl_lights;
bool haslights = GLRenderer->mLightCount > 0 && FixedColormap == CM_DEFAULT && gl_lights;
if (gl.lightmethod == LM_DEFERRED && haslights)
{
GLRenderer->mLights->Begin();
@ -549,7 +548,7 @@ void GLSceneDrawer::DrawBlend(sector_t * viewsector)
}
// don't draw sector based blends when an invulnerability colormap is active
if (!gl_fixedcolormap)
if (!FixedColormap)
{
if (!viewsector->e->XFloor.ffloors.Size())
{
@ -678,7 +677,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector)
{
// [BB] The HUD model should be drawn over everything else already drawn.
glClear(GL_DEPTH_BUFFER_BIT);
GLRenderer->DrawPlayerSprites (viewsector, true);
DrawPlayerSprites (viewsector, true);
}
glDisable(GL_STENCIL_TEST);
@ -690,7 +689,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector)
// [BB] Only draw the sprites if we didn't render a HUD model before.
if ( renderHUDModel == false )
{
GLRenderer->DrawPlayerSprites (viewsector, false);
DrawPlayerSprites (viewsector, false);
}
if (gl.legacyMode)
{
@ -699,7 +698,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector)
gl_RenderState.SetFixedColormap(CM_DEFAULT);
gl_RenderState.SetSoftLightLevel(-1);
GLRenderer->DrawTargeterSprites();
DrawTargeterSprites();
if (!FGLRenderBuffers::IsEnabled())
{
DrawBlend(viewsector);
@ -721,7 +720,7 @@ void GLSceneDrawer::EndDrawScene(sector_t * viewsector)
void GLSceneDrawer::ProcessScene(bool toscreen)
{
FDrawInfo::StartDrawInfo();
FDrawInfo::StartDrawInfo(this);
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
GLPortal::BeginScene();
@ -741,7 +740,7 @@ void GLSceneDrawer::ProcessScene(bool toscreen)
void GLSceneDrawer::SetFixedColormap (player_t *player)
{
gl_fixedcolormap=CM_DEFAULT;
FixedColormap=CM_DEFAULT;
// check for special colormaps
player_t * cplayer = player->camera->player;
@ -749,12 +748,12 @@ void GLSceneDrawer::SetFixedColormap (player_t *player)
{
if (cplayer->extralight == INT_MIN)
{
gl_fixedcolormap=CM_FIRSTSPECIALCOLORMAP + INVERSECOLORMAP;
FixedColormap=CM_FIRSTSPECIALCOLORMAP + INVERSECOLORMAP;
r_viewpoint.extralight=0;
}
else if (cplayer->fixedcolormap != NOFIXEDCOLORMAP)
{
gl_fixedcolormap = CM_FIRSTSPECIALCOLORMAP + cplayer->fixedcolormap;
FixedColormap = CM_FIRSTSPECIALCOLORMAP + cplayer->fixedcolormap;
}
else if (cplayer->fixedlightlevel != -1)
{
@ -767,16 +766,16 @@ void GLSceneDrawer::SetFixedColormap (player_t *player)
// Need special handling for light amplifiers
if (in->IsKindOf(torchtype))
{
gl_fixedcolormap = cplayer->fixedlightlevel + CM_TORCH;
FixedColormap = cplayer->fixedlightlevel + CM_TORCH;
}
else if (in->IsKindOf(litetype))
{
gl_fixedcolormap = CM_LITE;
FixedColormap = CM_LITE;
}
}
}
}
gl_RenderState.SetFixedColormap(gl_fixedcolormap);
gl_RenderState.SetFixedColormap(FixedColormap);
}
//-----------------------------------------------------------------------------
@ -848,7 +847,7 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
if (mainview && toscreen) EndDrawScene(lviewsector); // do not call this for camera textures.
if (mainview && FGLRenderBuffers::IsEnabled())
{
GLRenderer->PostProcessScene();
GLRenderer->PostProcessScene(FixedColormap);
// This should be done after postprocessing, not before.
GLRenderer->mBuffers->BindCurrentFB();
@ -1147,7 +1146,7 @@ void FGLInterface::RenderTextureView (FCanvasTexture *tex, AActor *Viewpoint, in
bounds.height=FHardwareTexture::GetTexDimension(gltex->GetHeight());
GLSceneDrawer drawer;
gl_fixedcolormap = CM_DEFAULT;
drawer.FixedColormap = CM_DEFAULT;
gl_RenderState.SetFixedColormap(CM_DEFAULT);
drawer.RenderViewpoint(Viewpoint, &bounds, FOV, (float)width/height, (float)width/height, false, false);

View File

@ -4,6 +4,7 @@
#include "m_fixed.h"
#include "gl_clipper.h"
#include "gl_portal.h"
#include "gl/renderer/gl_lightdata.h"
class GLSceneDrawer
{
@ -13,7 +14,7 @@ class GLSceneDrawer
sector_t *currentsector;
void RenderMultipassStuff();
void UnclipSubsector(subsector_t *sub);
void AddLine (seg_t *seg, bool portalclip);
void PolySubsector(subsector_t * sub);
@ -37,6 +38,7 @@ public:
}
Clipper clipper;
int FixedColormap;
angle_t FrustumAngle();
void SetViewMatrix(float vx, float vy, float vz, bool mirror, bool planemirror);
@ -51,11 +53,16 @@ public:
void ProcessScene(bool toscreen = false);
void DrawBlend(sector_t * viewsector);
void EndDrawScene(sector_t * viewsector);
void RenderActorsInPortal(FGLLinePortal *glport);
sector_t *RenderViewpoint(AActor * camera, GL_IRECT * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen);
void RenderView(player_t *player);
void WriteSavePic(player_t *player, FileWriter *file, int width, int height);
void DrawPSprite(player_t * player, DPSprite *psp, float sx, float sy, bool hudModelStep, int OverrideShader, bool alphatexture);
void DrawPlayerSprites(sector_t * viewsector, bool hudModelStep);
void DrawTargeterSprites();
void InitClipper(angle_t a1, angle_t a2)
{
clipper.SafeAddClipRangeRealAngles(a1, a2);
@ -66,4 +73,25 @@ public:
viewx = FLOAT2FIXED(r_viewpoint.Pos.X);
viewy = FLOAT2FIXED(r_viewpoint.Pos.Y);
}
void SetColor(int light, int rellight, const FColormap &cm, float alpha, bool weapon = false)
{
gl_SetColor(light, rellight, FixedColormap != CM_DEFAULT, cm, alpha, weapon);
}
bool CheckFog(sector_t *frontsector, sector_t *backsector)
{
if (FixedColormap != CM_DEFAULT) return false;
return gl_CheckFog(frontsector, backsector);
}
void SetFog(int lightlevel, int rellight, const FColormap *cmap, bool isadditive)
{
gl_SetFog(lightlevel, rellight, FixedColormap != CM_DEFAULT, cmap, isadditive);
}
inline bool isFullbright(PalEntry color, int lightlevel)
{
return FixedColormap != CM_DEFAULT || (gl_isWhite(color) && lightlevel == 255);
}
};

View File

@ -545,7 +545,7 @@ void GLSkyPortal::DrawContents()
RenderDome(origin->texture[1], origin->x_offset[1], origin->y_offset, false, FSkyVertexBuffer::SKYMODE_SECONDLAYER);
}
if (skyfog>0 && gl_fixedcolormap == CM_DEFAULT && (origin->fadecolor & 0xffffff) != 0)
if (skyfog>0 && drawer->FixedColormap == CM_DEFAULT && (origin->fadecolor & 0xffffff) != 0)
{
PalEntry FadeColor = origin->fadecolor;
FadeColor.a = clamp<int>(skyfog, 0, 255);

View File

@ -49,6 +49,7 @@
#include "gl/data/gl_data.h"
#include "gl/dynlights/gl_glow.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/scene/gl_portal.h"
#include "gl/models/gl_models.h"
#include "gl/shaders/gl_shader.h"
@ -277,7 +278,7 @@ void GLSprite::Draw(int pass)
gl_SetRenderStyle(RenderStyle, false,
// The rest of the needed checks are done inside gl_SetRenderStyle
trans > 1.f - FLT_EPSILON && gl_usecolorblending && gl_fixedcolormap == CM_DEFAULT && actor &&
trans > 1.f - FLT_EPSILON && gl_usecolorblending && mDrawer->FixedColormap == CM_DEFAULT && actor &&
fullbright && gltexture && !gltexture->GetTransparent());
if (hw_styleflags == STYLEHW_NoAlphaTest)
@ -323,7 +324,7 @@ void GLSprite::Draw(int pass)
}
if (RenderStyle.BlendOp != STYLEOP_Shadow)
{
if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && !fullbright)
if (gl_lights && GLRenderer->mLightCount && mDrawer->FixedColormap == CM_DEFAULT && !fullbright)
{
gl_SetDynSpriteLight(gl_light_sprites ? actor : NULL, gl_light_particles ? particle : NULL);
}
@ -337,7 +338,7 @@ void GLSprite::Draw(int pass)
gl_RenderState.SetObjectColor(finalcol);
}
gl_SetColor(lightlevel, rel, Colormap, trans);
mDrawer->SetColor(lightlevel, rel, Colormap, trans);
}
@ -364,7 +365,7 @@ void GLSprite::Draw(int pass)
else RenderStyle.BlendOp = STYLEOP_Fuzz; // subtractive with models is not going to work.
}
if (!foglayer) gl_SetFog(foglevel, rel, &Colormap, additivefog);
if (!foglayer) mDrawer->SetFog(foglevel, rel, &Colormap, additivefog);
else
{
gl_RenderState.EnableFog(false);
@ -374,7 +375,7 @@ void GLSprite::Draw(int pass)
if (gltexture) gl_RenderState.SetMaterial(gltexture, CLAMP_XY, translation, OverrideShader, !!(RenderStyle.Flags & STYLEF_RedIsAlpha));
else if (!modelframe) gl_RenderState.EnableTexture(false);
//gl_SetColor(lightlevel, rel, Colormap, trans);
//mDrawer->SetColor(lightlevel, rel, Colormap, trans);
unsigned int iter = lightlist? lightlist->Size() : 1;
bool clipping = false;
@ -406,10 +407,10 @@ void GLSprite::Draw(int pass)
thiscm.Decolorize();
}
gl_SetColor(thisll, rel, thiscm, trans);
mDrawer->SetColor(thisll, rel, thiscm, trans);
if (!foglayer)
{
gl_SetFog(thislight, rel, &thiscm, additivefog);
mDrawer->SetFog(thislight, rel, &thiscm, additivefog);
}
gl_RenderState.SetSplitPlanes(*topplane, *lowplane);
}
@ -436,7 +437,7 @@ void GLSprite::Draw(int pass)
if (foglayer)
{
// If we get here we know that we have colored fog and no fixed colormap.
gl_SetFog(foglevel, rel, &Colormap, additivefog);
mDrawer->SetFog(foglevel, rel, &Colormap, additivefog);
gl_RenderState.SetFixedColormap(CM_FOGLAYER);
gl_RenderState.BlendEquation(GL_FUNC_ADD);
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -507,7 +508,7 @@ inline void GLSprite::PutSprite(bool translucent)
//==========================================================================
void GLSprite::SplitSprite(sector_t * frontsector, bool translucent)
{
GLSprite copySprite;
GLSprite copySprite(mDrawer);
double lightbottom;
unsigned int i;
bool put=false;
@ -674,7 +675,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
if (thing->renderflags & RF_INVISIBLE || !thing->RenderStyle.IsVisible(thing->Alpha))
{
if (!(thing->flags & MF_STEALTH) || !gl_fixedcolormap || !gl_enhanced_nightvision || thing == camera)
if (!(thing->flags & MF_STEALTH) || !mDrawer->FixedColormap || !gl_enhanced_nightvision || thing == camera)
return;
}
int spritenum = thing->sprite;
@ -903,16 +904,16 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
RenderStyle = thing->RenderStyle;
// colormap stuff is a little more complicated here...
if (gl_fixedcolormap)
if (mDrawer->FixedColormap)
{
if ((gl_enhanced_nv_stealth > 0 && gl_fixedcolormap == CM_LITE) // Infrared powerup only
|| (gl_enhanced_nv_stealth == 2 && gl_fixedcolormap >= CM_TORCH)// Also torches
if ((gl_enhanced_nv_stealth > 0 && mDrawer->FixedColormap == CM_LITE) // Infrared powerup only
|| (gl_enhanced_nv_stealth == 2 && mDrawer->FixedColormap >= CM_TORCH)// Also torches
|| (gl_enhanced_nv_stealth == 3)) // Any fixed colormap
enhancedvision=true;
Colormap.Clear();
if (gl_fixedcolormap==CM_LITE)
if (mDrawer->FixedColormap==CM_LITE)
{
if (gl_enhanced_nightvision &&
(thing->IsKindOf(RUNTIME_CLASS(AInventory)) || thing->flags3&MF3_ISMONSTER || thing->flags&MF_MISSILE || thing->flags&MF_CORPSE))
@ -1049,7 +1050,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
// 3. any bright object
// 4. any with render style shadow (which doesn't use the sector light)
// 5. anything with render style reverse subtract (light effect is not what would be desired here)
if (thing->Sector->e->XFloor.lightlist.Size() != 0 && gl_fixedcolormap == CM_DEFAULT && !fullbright &&
if (thing->Sector->e->XFloor.lightlist.Size() != 0 && mDrawer->FixedColormap == CM_DEFAULT && !fullbright &&
RenderStyle.BlendOp != STYLEOP_Shadow && RenderStyle.BlendOp != STYLEOP_RevSub)
{
if (gl.flags & RFL_NO_CLIP_PLANES) // on old hardware we are rather limited...
@ -1097,7 +1098,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
sector->GetCeilingLight() : sector->GetFloorLight());
foglevel = (uint8_t)clamp<short>(sector->lightlevel, 0, 255);
if (gl_fixedcolormap)
if (mDrawer->FixedColormap)
{
Colormap.Clear();
}
@ -1199,7 +1200,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
if (gl_particles_style != 2 && trans>=1.0f-FLT_EPSILON) hw_styleflags = STYLEHW_Solid;
else hw_styleflags = STYLEHW_NoAlphaTest;
if (sector->e->XFloor.lightlist.Size() != 0 && gl_fixedcolormap == CM_DEFAULT && !fullbright)
if (sector->e->XFloor.lightlist.Size() != 0 && mDrawer->FixedColormap == CM_DEFAULT && !fullbright)
lightlist = &sector->e->XFloor.lightlist;
else
lightlist = NULL;
@ -1214,7 +1215,7 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
//
//==========================================================================
void gl_RenderActorsInPortal(FGLLinePortal *glport)
void GLSceneDrawer::RenderActorsInPortal(FGLLinePortal *glport)
{
TMap<AActor*, bool> processcheck;
if (glport->validcount == validcount) return; // only process once per frame
@ -1257,7 +1258,7 @@ void gl_RenderActorsInPortal(FGLLinePortal *glport)
th->SetXYZ(newpos);
th->Prev += newpos - savedpos;
GLSprite spr;
GLSprite spr(this);
spr.Process(th, gl_FakeFlat(th->Sector, &fakesector, false), 2);
th->Angles.Yaw = savedangle;
th->SetXYZ(savedpos);

View File

@ -23,6 +23,7 @@ struct FTexCoordInfo;
struct FPortal;
struct FFlatVertex;
struct FGLLinePortal;
class GLSceneDrawer;
enum
{
@ -147,6 +148,7 @@ public:
friend struct GLDrawList;
friend class GLPortal;
GLSceneDrawer *mDrawer;
GLSeg glseg;
vertex_t * vertexes[2]; // required for polygon splitting
float ztop[2],zbottom[2];
@ -271,6 +273,11 @@ private:
public:
GLWall(GLSceneDrawer *drawer)
{
mDrawer = drawer;
}
void Process(seg_t *seg, sector_t *frontsector, sector_t *backsector);
void ProcessLowerMiniseg(seg_t *seg, sector_t *frontsector, sector_t *backsector);
void Draw(int pass);
@ -303,6 +310,7 @@ class GLFlat
public:
friend struct GLDrawList;
GLSceneDrawer *mDrawer;
sector_t * sector;
float dz; // z offset for rendering hacks
float z; // the z position of the flat (only valid for non-sloped planes)
@ -323,6 +331,10 @@ public:
int dynlightindex;
GLFlat(GLSceneDrawer *drawer)
{
mDrawer = drawer;
}
// compatibility fallback stuff.
void DrawSubsectorLights(subsector_t * sub, int pass);
void DrawLightsCompat(int pass);
@ -355,6 +367,7 @@ public:
friend struct GLDrawList;
friend void Mod_RenderModel(GLSprite * spr, model_t * mdl, int framenumber);
GLSceneDrawer *mDrawer;
int lightlevel;
uint8_t foglevel;
uint8_t hw_styleflags;
@ -393,6 +406,10 @@ public:
public:
GLSprite(GLSceneDrawer *drawer)
{
mDrawer = drawer;
}
void Draw(int pass);
void PutSprite(bool translucent);
void Process(AActor* thing,sector_t * sector, int thruportal = false);
@ -412,6 +429,5 @@ inline float Dist2(float x1,float y1,float x2,float y2)
void gl_SetDynSpriteLight(AActor *self, float x, float y, float z, subsector_t *subsec);
void gl_SetDynSpriteLight(AActor *actor, particle_t *particle);
void gl_RenderActorsInPortal(FGLLinePortal *glport);
#endif

View File

@ -42,6 +42,7 @@
#include "gl/dynlights/gl_glow.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h"
#include "gl/utility/gl_geometric.h"
@ -77,13 +78,13 @@ void GLWall::PutWall(bool translucent)
translucent = true;
}
if (gl_fixedcolormap)
if (mDrawer->FixedColormap)
{
// light planes don't get drawn with fullbright rendering
if (gltexture == NULL) return;
Colormap.Clear();
}
if (gl_isFullbright(Colormap.LightColor, lightlevel)) flags &= ~GLWF_GLOW;
if (mDrawer->isFullbright(Colormap.LightColor, lightlevel)) flags &= ~GLWF_GLOW;
if (translucent) // translucent walls
{
@ -180,7 +181,7 @@ void GLWall::PutPortal(int ptype)
line_t *otherside = lineportal->lines[0]->mDestination;
if (otherside != NULL && otherside->portalindex < linePortals.Size())
{
gl_RenderActorsInPortal(linePortalToGL[otherside->portalindex]);
mDrawer->RenderActorsInPortal(linePortalToGL[otherside->portalindex]);
}
portal = new GLLineToLinePortal(lineportal);
}
@ -223,8 +224,6 @@ void GLWall::Put3DWall(lightlist_t * lightlist, bool translucent)
bool GLWall::SplitWallComplex(sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright)
{
GLWall copyWall1, copyWall2;
// check for an intersection with the upper plane
if ((maplightbottomleft<ztop[0] && maplightbottomright>ztop[1]) ||
(maplightbottomleft>ztop[0] && maplightbottomright<ztop[1]))
@ -247,7 +246,7 @@ bool GLWall::SplitWallComplex(sector_t * frontsector, bool translucent, float& m
else
{
// split the wall in two at the intersection and recursively split both halves
copyWall1 = copyWall2 = *this;
GLWall copyWall1 = *this, copyWall2 = *this;
copyWall1.glseg.x2 = copyWall2.glseg.x1 = glseg.x1 + coeff * (glseg.x2 - glseg.x1);
copyWall1.glseg.y2 = copyWall2.glseg.y1 = glseg.y1 + coeff * (glseg.y2 - glseg.y1);
@ -288,7 +287,7 @@ bool GLWall::SplitWallComplex(sector_t * frontsector, bool translucent, float& m
else
{
// split the wall in two at the intersection and recursively split both halves
copyWall1 = copyWall2 = *this;
GLWall copyWall1 = *this, copyWall2 = *this;
copyWall1.glseg.x2 = copyWall2.glseg.x1 = glseg.x1 + coeff * (glseg.x2 - glseg.x1);
copyWall1.glseg.y2 = copyWall2.glseg.y1 = glseg.y1 + coeff * (glseg.y2 - glseg.y1);
@ -311,7 +310,6 @@ bool GLWall::SplitWallComplex(sector_t * frontsector, bool translucent, float& m
void GLWall::SplitWall(sector_t * frontsector, bool translucent)
{
GLWall copyWall1;
float maplightbottomleft;
float maplightbottomright;
unsigned int i;
@ -385,7 +383,7 @@ void GLWall::SplitWall(sector_t * frontsector, bool translucent)
if (maplightbottomleft<=ztop[0] && maplightbottomright<=ztop[1] &&
(maplightbottomleft!=ztop[0] || maplightbottomright!=ztop[1]))
{
copyWall1=*this;
GLWall copyWall1 = *this;
copyWall1.flags |= GLWF_NOSPLITLOWER;
flags |= GLWF_NOSPLITUPPER;
@ -453,7 +451,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
hi.colormap.LightColor = (light->extra_colormap)->Color;
}
if (gl_fixedcolormap) hi.colormap.Clear();
if (mDrawer->FixedColormap) hi.colormap.Clear();
horizon = &hi;
PutPortal(PORTALTYPE_HORIZON);
}
@ -481,7 +479,7 @@ bool GLWall::DoHorizon(seg_t * seg,sector_t * fs, vertex_t * v1,vertex_t * v2)
hi.colormap.LightColor = (light->extra_colormap)->Color;
}
if (gl_fixedcolormap) hi.colormap.Clear();
if (mDrawer->FixedColormap) hi.colormap.Clear();
horizon = &hi;
PutPortal(PORTALTYPE_HORIZON);
}
@ -749,7 +747,7 @@ void GLWall::DoTexture(int _type,seg_t * seg, int peg,
// Add this wall to the render list
sector_t * sec = sub ? sub->sector : seg->frontsector;
if (sec->e->XFloor.lightlist.Size()==0 || gl_fixedcolormap) PutWall(false);
if (sec->e->XFloor.lightlist.Size()==0 || mDrawer->FixedColormap) PutWall(false);
else SplitWall(sec, false);
}
@ -1020,7 +1018,6 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
if (v>0 && !drawfogboundary && !(seg->linedef->flags&ML_WRAP_MIDTEX))
{
// split the poly!
GLWall split;
int i,t=0;
float v_factor=(zbottom[0]-ztop[0])/(tcs[LOLFT].v-tcs[UPLFT].v);
// only split the vertical area of the polygon that does not contain slopes.
@ -1039,7 +1036,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
// the current segment is above the top line of the splittable area
if (splitbot<=splittopv) continue;
split=*this;
GLWall split = *this;
// the top line of the current segment is inside the splittable area
// use the splitrect's top as top of this segment
@ -1062,7 +1059,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
// Draw the stuff
//
//
if (realfront->e->XFloor.lightlist.Size()==0 || gl_fixedcolormap) split.PutWall(translucent);
if (realfront->e->XFloor.lightlist.Size()==0 || mDrawer->FixedColormap) split.PutWall(translucent);
else split.SplitWall(realfront, translucent);
t=1;
@ -1076,7 +1073,7 @@ void GLWall::DoMidTexture(seg_t * seg, bool drawfogboundary,
// Draw the stuff without splitting
//
//
if (realfront->e->XFloor.lightlist.Size()==0 || gl_fixedcolormap) PutWall(translucent);
if (realfront->e->XFloor.lightlist.Size()==0 || mDrawer->FixedColormap) PutWall(translucent);
else SplitWall(realfront, translucent);
}
alpha=1.0f;
@ -1108,7 +1105,7 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover,
if (rover->flags&FF_FOG)
{
if (!gl_fixedcolormap)
if (!mDrawer->FixedColormap)
{
// this may not yet be done
light = P_GetPlaneLight(rover->target, rover->top.plane, true);
@ -1187,7 +1184,7 @@ void GLWall::BuildFFBlock(seg_t * seg, F3DFloor * rover,
sector_t * sec = sub ? sub->sector : seg->frontsector;
if (sec->e->XFloor.lightlist.Size() == 0 || gl_fixedcolormap) PutWall(translucent);
if (sec->e->XFloor.lightlist.Size() == 0 || mDrawer->FixedColormap) PutWall(translucent);
else SplitWall(sec, translucent);
alpha = 1.0f;

View File

@ -41,6 +41,7 @@
#include "gl/dynlights/gl_lightbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_material.h"
#include "gl/utility/gl_clock.h"
@ -227,12 +228,12 @@ void GLWall::RenderWall(int textured)
void GLWall::RenderFogBoundary()
{
if (gl_fogmode && gl_fixedcolormap == 0)
if (gl_fogmode && mDrawer->FixedColormap == 0)
{
if (!gl.legacyMode)
{
int rel = rellight + getExtraLight();
gl_SetFog(lightlevel, rel, &Colormap, false);
mDrawer->SetFog(lightlevel, rel, &Colormap, false);
gl_RenderState.EnableDrawBuffers(1);
gl_RenderState.SetEffect(EFF_FOGBOUNDARY);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
@ -281,8 +282,8 @@ void GLWall::RenderMirrorSurface()
// Use sphere mapping for this
gl_RenderState.SetEffect(EFF_SPHEREMAP);
gl_SetColor(lightlevel, 0, Colormap ,0.1f);
gl_SetFog(lightlevel, 0, &Colormap, true);
mDrawer->SetColor(lightlevel, 0, Colormap ,0.1f);
mDrawer->SetFog(lightlevel, 0, &Colormap, true);
gl_RenderState.BlendFunc(GL_SRC_ALPHA,GL_ONE);
gl_RenderState.AlphaFunc(GL_GREATER,0);
glDepthFunc(GL_LEQUAL);
@ -342,7 +343,7 @@ void GLWall::RenderTextured(int rflags)
{
if (tmode == TM_MODULATE) gl_RenderState.SetTextureMode(TM_CLAMPY);
}
gl_SetFog(255, 0, NULL, false);
mDrawer->SetFog(255, 0, NULL, false);
}
gl_RenderState.SetObjectColor(seg->frontsector->SpecialColors[sector_t::walltop] | 0xff000000);
gl_RenderState.SetObjectColor2(seg->frontsector->SpecialColors[sector_t::wallbottom] | 0xff000000);
@ -350,8 +351,8 @@ void GLWall::RenderTextured(int rflags)
float absalpha = fabsf(alpha);
if (lightlist == NULL)
{
if (type != RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, RenderStyle == STYLE_Add);
gl_SetColor(lightlevel, rel, Colormap, absalpha);
if (type != RENDERWALL_M2SNF) mDrawer->SetFog(lightlevel, rel, &Colormap, RenderStyle == STYLE_Add);
mDrawer->SetColor(lightlevel, rel, Colormap, absalpha);
RenderWall(rflags);
}
else
@ -371,8 +372,8 @@ void GLWall::RenderTextured(int rflags)
FColormap thiscm;
thiscm.FadeColor = Colormap.FadeColor;
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
gl_SetColor(thisll, rel, thiscm, absalpha);
if (type != RENDERWALL_M2SNF) gl_SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
mDrawer->SetColor(thisll, rel, thiscm, absalpha);
if (type != RENDERWALL_M2SNF) mDrawer->SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
gl_RenderState.SetSplitPlanes((*lightlist)[i].plane, lowplane);
RenderWall(rflags);
}
@ -397,7 +398,7 @@ void GLWall::RenderTranslucentWall()
{
if (gltexture)
{
if (gl_fixedcolormap == CM_DEFAULT && gl_lights && gl.lightmethod == LM_DIRECT)
if (mDrawer->FixedColormap == CM_DEFAULT && gl_lights && gl.lightmethod == LM_DIRECT)
{
SetupLights();
}
@ -410,8 +411,8 @@ void GLWall::RenderTranslucentWall()
else
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_SetColor(lightlevel, 0, Colormap, fabsf(alpha));
gl_SetFog(lightlevel, 0, &Colormap, RenderStyle == STYLE_Add);
mDrawer->SetColor(lightlevel, 0, Colormap, fabsf(alpha));
mDrawer->SetFog(lightlevel, 0, &Colormap, RenderStyle == STYLE_Add);
gl_RenderState.EnableTexture(false);
RenderWall(RWF_NOSPLIT);
gl_RenderState.EnableTexture(true);

View File

@ -43,6 +43,7 @@
#include "gl/data/gl_vertexbuffer.h"
#include "gl/dynlights/gl_glow.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/models/gl_models.h"
#include "gl/shaders/gl_shader.h"
#include "gl/textures/gl_material.h"
@ -62,7 +63,7 @@ EXTERN_CVAR (Bool, r_deathcamera)
//
//==========================================================================
void FGLRenderer::DrawPSprite (player_t * player,DPSprite *psp, float sx, float sy, bool hudModelStep, int OverrideShader, bool alphatexture)
void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, float sy, bool hudModelStep, int OverrideShader, bool alphatexture)
{
float fU1,fV1;
float fU2,fV2;
@ -189,7 +190,7 @@ static bool isBright(DPSprite *psp)
//
//==========================================================================
void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
{
bool brightflash = false;
unsigned int i;
@ -236,7 +237,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
wy = 0;
}
if (gl_fixedcolormap)
if (FixedColormap)
{
lightlevel=255;
cm.Clear();
@ -415,11 +416,11 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
}
else
{
if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && gl_light_sprites)
if (gl_lights && GLRenderer->mLightCount && FixedColormap == CM_DEFAULT && gl_light_sprites)
{
gl_SetDynSpriteLight(playermo, NULL);
}
gl_SetColor(ll, 0, cmc, trans, true);
SetColor(ll, 0, cmc, trans, true);
}
if (psp->firstTic)
@ -460,13 +461,13 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
//
//==========================================================================
void FGLRenderer::DrawTargeterSprites()
void GLSceneDrawer::DrawTargeterSprites()
{
AActor * playermo=players[consoleplayer].camera;
player_t * player=playermo->player;
if(!player || playermo->renderflags&RF_INVISIBLE || !r_drawplayersprites ||
mViewActor!=playermo) return;
GLRenderer->mViewActor!=playermo) return;
gl_RenderState.EnableBrightmap(false);
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);