- GLFlat split into API-dependent and -independent data.

No resorting of the files yet.
This commit is contained in:
Christoph Oelckers 2018-04-28 12:34:09 +02:00
parent d694e19f01
commit c5641a0e72
15 changed files with 236 additions and 202 deletions

View file

@ -566,21 +566,21 @@ bool FDrawInfo::PutWallCompat(GLWall *wall, int passflag)
// //
//========================================================================== //==========================================================================
bool GLFlat::PutFlatCompat(bool fog) bool FDrawInfo::PutFlatCompat(GLFlat *flat, bool fog)
{ {
// are lights possible? // are lights possible?
if (mDrawer->FixedColormap != CM_DEFAULT || !gl_lights || !gltexture || renderstyle != STYLE_Translucent || alpha < 1.f - FLT_EPSILON || sector->lighthead == NULL) return false; if (FixedColormap != CM_DEFAULT || !gl_lights || !flat->gltexture || flat->renderstyle != STYLE_Translucent || flat->alpha < 1.f - FLT_EPSILON || flat->sector->lighthead == NULL) return false;
static int list_indices[2][2] = static int list_indices[2][2] =
{ { GLLDL_FLATS_PLAIN, GLLDL_FLATS_FOG },{ GLLDL_FLATS_MASKED, GLLDL_FLATS_FOGMASKED } }; { { GLLDL_FLATS_PLAIN, GLLDL_FLATS_FOG },{ GLLDL_FLATS_MASKED, GLLDL_FLATS_FOGMASKED } };
bool masked = gltexture->isMasked() && ((renderflags&SSRF_RENDER3DPLANES) || stack); bool masked = flat->gltexture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack);
bool foggy = CheckFog(&Colormap, lightlevel) || (level.flags&LEVEL_HASFADETABLE) || gl_lights_additive; bool foggy = CheckFog(&flat->Colormap, flat->lightlevel) || (level.flags&LEVEL_HASFADETABLE) || gl_lights_additive;
int list = list_indices[masked][foggy]; int list = list_indices[masked][foggy];
auto newflat = gl_drawinfo->dldrawlists[list].NewFlat(); auto newflat = gl_drawinfo->dldrawlists[list].NewFlat();
*newflat = *this; *newflat = *flat;
return true; return true;
} }
@ -645,7 +645,7 @@ void FDrawInfo::RenderFogBoundaryCompat(GLWall *wall)
// //
//========================================================================== //==========================================================================
void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass) void FDrawInfo::DrawSubsectorLights(GLFlat *flat, subsector_t * sub, int pass)
{ {
Plane p; Plane p;
FVector3 nearPt, up, right, t1; FVector3 nearPt, up, right, t1;
@ -666,14 +666,14 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
// we must do the side check here because gl_SetupLight needs the correct plane orientation // 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 // which we don't have for Legacy-style 3D-floors
double planeh = plane.plane.ZatPoint(light); double planeh = flat->plane.plane.ZatPoint(light);
if (((planeh<light->Z() && ceiling) || (planeh>light->Z() && !ceiling))) if (((planeh<light->Z() && flat->ceiling) || (planeh>light->Z() && !flat->ceiling)))
{ {
node = node->nextLight; node = node->nextLight;
continue; continue;
} }
p.Set(plane.plane.Normal(), plane.plane.fD()); p.Set(flat->plane.plane.Normal(), flat->plane.plane.fD());
if (!gl_SetupLight(sub->sector->PortalGroup, p, light, nearPt, up, right, scale, false, pass != GLPASS_LIGHTTEX)) if (!gl_SetupLight(sub->sector->PortalGroup, p, light, nearPt, up, right, scale, false, pass != GLPASS_LIGHTTEX))
{ {
node = node->nextLight; node = node->nextLight;
@ -686,7 +686,7 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
{ {
vertex_t *vt = sub->firstline[k].v1; vertex_t *vt = sub->firstline[k].v1;
ptr->x = vt->fX(); ptr->x = vt->fX();
ptr->z = plane.plane.ZatPoint(vt) + dz; ptr->z = flat->plane.plane.ZatPoint(vt) + flat->dz;
ptr->y = vt->fY(); ptr->y = vt->fY();
t1 = { ptr->x, ptr->z, ptr->y }; t1 = { ptr->x, ptr->z, ptr->y };
FVector3 nearToVert = t1 - nearPt; FVector3 nearToVert = t1 - nearPt;
@ -706,29 +706,29 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
// //
//========================================================================== //==========================================================================
void GLFlat::DrawLightsCompat(int pass) void FDrawInfo::DrawLightsCompat(GLFlat *flat, int pass)
{ {
gl_RenderState.Apply(); gl_RenderState.Apply();
// Draw the subsectors belonging to this sector // Draw the subsectors belonging to this sector
for (int i = 0; i<sector->subsectorcount; i++) for (int i = 0; i<flat->sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; subsector_t * sub = flat->sector->subsectors[i];
if (gl_drawinfo->ss_renderflags[sub->Index()] & renderflags) if (gl_drawinfo->ss_renderflags[sub->Index()] & flat->renderflags)
{ {
DrawSubsectorLights(sub, pass); DrawSubsectorLights(flat, sub, pass);
} }
} }
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
if (!(renderflags&SSRF_RENDER3DPLANES)) if (!(flat->renderflags&SSRF_RENDER3DPLANES))
{ {
gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR) ? gl_subsectorrendernode * node = (flat->renderflags&SSRF_RENDERFLOOR) ?
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : gl_drawinfo->GetOtherFloorPlanes(flat->sector->sectornum) :
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); gl_drawinfo->GetOtherCeilingPlanes(flat->sector->sectornum);
while (node) while (node)
{ {
DrawSubsectorLights(node->sub, pass); DrawSubsectorLights(flat, node->sub, pass);
node = node->next; node = node->next;
} }
} }

View file

@ -26,6 +26,7 @@
#include <string.h> #include <string.h>
#include "gl/system/gl_interface.h" #include "gl/system/gl_interface.h"
#include "r_data/matrix.h" #include "r_data/matrix.h"
#include "hwrenderer/scene//hw_drawstructs.h"
#include "hwrenderer/textures/hw_material.h" #include "hwrenderer/textures/hw_material.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "r_defs.h" #include "r_defs.h"
@ -34,6 +35,7 @@
class FVertexBuffer; class FVertexBuffer;
class FShader; class FShader;
struct GLSectorPlane;
extern TArray<VSMatrix> gl_MatrixStack; extern TArray<VSMatrix> gl_MatrixStack;
EXTERN_CVAR(Bool, gl_direct_state_change) EXTERN_CVAR(Bool, gl_direct_state_change)
@ -530,6 +532,15 @@ public:
// Backwards compatibility crap follows // Backwards compatibility crap follows
void ApplyFixedFunction(); void ApplyFixedFunction();
void DrawColormapOverlay(); void DrawColormapOverlay();
void SetPlaneTextureRotation(GLSectorPlane *plane, FMaterial *texture)
{
if (gl_SetPlaneTextureRotation(plane, texture, mTextureMatrix))
{
EnableTextureMatrix(true);
}
}
}; };
extern FRenderState gl_RenderState; extern FRenderState gl_RenderState;

View file

@ -504,8 +504,8 @@ void GLSceneDrawer::DoSubsector(subsector_t * sub)
srf |= SSRF_PROCESSED; srf |= SSRF_PROCESSED;
SetupFlat.Clock(); SetupFlat.Clock();
GLFlat flat(this); GLFlat flat;
flat.ProcessSector(fakesector); flat.ProcessSector(gl_drawinfo, fakesector);
SetupFlat.Unclock(); SetupFlat.Unclock();
} }
// mark subsector as processed - but mark for rendering only if it has an actual area. // mark subsector as processed - but mark for rendering only if it has an actual area.

View file

@ -708,7 +708,7 @@ void GLDrawList::DoDraw(int pass, int i, bool trans)
{ {
GLFlat * f= flats[drawitems[i].index]; GLFlat * f= flats[drawitems[i].index];
RenderFlat.Clock(); RenderFlat.Clock();
f->Draw(pass, trans); gl_drawinfo->DrawFlat(f, pass, trans);
RenderFlat.Unclock(); RenderFlat.Unclock();
} }
break; break;
@ -862,7 +862,7 @@ void GLDrawList::DrawFlats(int pass)
RenderFlat.Clock(); RenderFlat.Clock();
for(unsigned i=0;i<drawitems.Size();i++) for(unsigned i=0;i<drawitems.Size();i++)
{ {
flats[drawitems[i].index]->Draw(pass, false); gl_drawinfo->DrawFlat(flats[drawitems[i].index], pass, false);
} }
RenderFlat.Unclock(); RenderFlat.Unclock();
} }
@ -1154,7 +1154,7 @@ void FDrawInfo::DrawFloodedPlane(wallseg * ws, float planez, sector_t * sec, boo
float fviewy = r_viewpoint.Pos.Y; float fviewy = r_viewpoint.Pos.Y;
float fviewz = r_viewpoint.Pos.Z; float fviewz = r_viewpoint.Pos.Z;
gl_SetPlaneTextureRotation(&plane, gltexture); gl_RenderState.SetPlaneTextureRotation(&plane, gltexture);
gl_RenderState.Apply(); gl_RenderState.Apply();
float prj_fac1 = (planez-fviewz)/(ws->z1-fviewz); float prj_fac1 = (planez-fviewz)/(ws->z1-fviewz);

View file

@ -181,14 +181,19 @@ struct FDrawInfo : public HWDrawInfo
void AddMirrorSurface(GLWall *w) override; void AddMirrorSurface(GLWall *w) override;
GLDecal *AddDecal(bool onmirror) override; GLDecal *AddDecal(bool onmirror) override;
void AddPortal(GLWall *w, int portaltype) override; void AddPortal(GLWall *w, int portaltype) override;
void AddFlat(GLFlat *flat, bool fog) override;
void ProcessActorsInPortal(FLinePortalSpan *glport) override; void ProcessActorsInPortal(FLinePortalSpan *glport) override;
std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) override; std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) override;
// Legacy GL only. // Legacy GL only.
bool PutWallCompat(GLWall *wall, int passflag); bool PutWallCompat(GLWall *wall, int passflag);
bool PutFlatCompat(GLFlat *flat, bool fog);
void RenderFogBoundaryCompat(GLWall *wall); void RenderFogBoundaryCompat(GLWall *wall);
void RenderLightsCompat(GLWall *wall, int pass); void RenderLightsCompat(GLWall *wall, int pass);
void DrawSubsectorLights(GLFlat *flat, subsector_t * sub, int pass);
void DrawLightsCompat(GLFlat *flat, int pass);
void DrawDecal(GLDecal *gldecal); void DrawDecal(GLDecal *gldecal);
void DrawDecals(); void DrawDecals();
@ -209,6 +214,13 @@ struct FDrawInfo : public HWDrawInfo
void RenderTexturedWall(GLWall *wall, int rflags); void RenderTexturedWall(GLWall *wall, int rflags);
void DrawWall(GLWall *wall, int pass); void DrawWall(GLWall *wall, int pass);
// Flat drawer
void DrawFlat(GLFlat *flat, int pass, bool trans); // trans only has meaning for GLPASS_LIGHTSONLY
void DrawSkyboxSector(GLFlat *flat, int pass, bool processlights);
void DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool istrans);
void ProcessLights(GLFlat *flat, bool istrans);
void DrawSubsector(GLFlat *flat, subsector_t * sub);
// These two may be moved to the API independent part of the renderer later. // These two may be moved to the API independent part of the renderer later.
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) override; void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs) override;
@ -243,7 +255,6 @@ public:
extern FDrawInfo * gl_drawinfo; extern FDrawInfo * gl_drawinfo;
void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture);
void gl_SetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblending); void gl_SetRenderStyle(FRenderStyle style, bool drawopaque, bool allowcolorblending);
#endif #endif

View file

@ -58,7 +58,7 @@ CVAR(Int, gl_breaksec, -1, 0)
// //
//========================================================================== //==========================================================================
void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture) bool gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture, VSMatrix &dest)
{ {
// only manipulate the texture matrix if needed. // only manipulate the texture matrix if needed.
if (!secplane->Offs.isZero() || if (!secplane->Offs.isZero() ||
@ -81,13 +81,14 @@ void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * glte
float xscale2 = 64.f / gltexture->TextureWidth(); float xscale2 = 64.f / gltexture->TextureWidth();
float yscale2 = 64.f / gltexture->TextureHeight(); float yscale2 = 64.f / gltexture->TextureHeight();
gl_RenderState.mTextureMatrix.loadIdentity(); dest.loadIdentity();
gl_RenderState.mTextureMatrix.scale(xscale1, yscale1, 1.0f); dest.scale(xscale1, yscale1, 1.0f);
gl_RenderState.mTextureMatrix.translate(uoffs, voffs, 0.0f); dest.translate(uoffs, voffs, 0.0f);
gl_RenderState.mTextureMatrix.scale(xscale2, yscale2, 1.0f); dest.scale(xscale2, yscale2, 1.0f);
gl_RenderState.mTextureMatrix.rotate(angle, 0.0f, 0.0f, 1.0f); dest.rotate(angle, 0.0f, 0.0f, 1.0f);
gl_RenderState.EnableTextureMatrix(true); return true;
} }
return false;
} }
@ -156,7 +157,7 @@ void GLFlat::SetupSubsectorLights(int pass, subsector_t * sub, int *dli)
// //
//========================================================================== //==========================================================================
void GLFlat::DrawSubsector(subsector_t * sub) void FDrawInfo::DrawSubsector(GLFlat *flat, subsector_t * sub)
{ {
if (gl.buffermethod != BM_DEFERRED) if (gl.buffermethod != BM_DEFERRED)
{ {
@ -165,7 +166,7 @@ void GLFlat::DrawSubsector(subsector_t * sub)
{ {
vertex_t *vt = sub->firstline[k].v1; vertex_t *vt = sub->firstline[k].v1;
ptr->x = vt->fX(); ptr->x = vt->fX();
ptr->z = plane.plane.ZatPoint(vt) + dz; ptr->z = flat->plane.plane.ZatPoint(vt) + flat->dz;
ptr->y = vt->fY(); ptr->y = vt->fY();
ptr->u = vt->fX() / 64.f; ptr->u = vt->fX() / 64.f;
ptr->v = -vt->fY() / 64.f; ptr->v = -vt->fY() / 64.f;
@ -190,7 +191,7 @@ void GLFlat::DrawSubsector(subsector_t * sub)
for (unsigned int x = 0; x < 4; x++) for (unsigned int x = 0; x < 4; x++)
{ {
vertex_t *vt = sub->firstline[vi[x]].v1; vertex_t *vt = sub->firstline[vi[x]].v1;
qd.Set(x, vt->fX(), plane.plane.ZatPoint(vt) + dz, vt->fY(), vt->fX() / 64.f, -vt->fY() / 64.f); qd.Set(x, vt->fX(), flat->plane.plane.ZatPoint(vt) + flat->dz, vt->fY(), vt->fX() / 64.f, -vt->fY() / 64.f);
} }
qd.Render(GL_TRIANGLE_FAN); qd.Render(GL_TRIANGLE_FAN);
} }
@ -207,30 +208,30 @@ void GLFlat::DrawSubsector(subsector_t * sub)
// //
//========================================================================== //==========================================================================
void GLFlat::ProcessLights(bool istrans) void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans)
{ {
dynlightindex = GLRenderer->mLights->GetIndexPtr(); flat->dynlightindex = GLRenderer->mLights->GetIndexPtr();
// Draw the subsectors belonging to this sector // Draw the subsectors belonging to this sector
for (int i=0; i<sector->subsectorcount; i++) for (int i=0; i< flat->sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; subsector_t * sub = flat->sector->subsectors[i];
if (gl_drawinfo->ss_renderflags[sub->Index()]&renderflags || istrans) if (gl_drawinfo->ss_renderflags[sub->Index()]& flat->renderflags || istrans)
{ {
SetupSubsectorLights(GLPASS_LIGHTSONLY, sub); flat->SetupSubsectorLights(GLPASS_LIGHTSONLY, sub);
} }
} }
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
if (!(renderflags&SSRF_RENDER3DPLANES)) if (!(flat->renderflags&SSRF_RENDER3DPLANES))
{ {
gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? gl_subsectorrendernode * node = (flat->renderflags&SSRF_RENDERFLOOR)?
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : gl_drawinfo->GetOtherFloorPlanes(flat->sector->sectornum) :
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); gl_drawinfo->GetOtherCeilingPlanes(flat->sector->sectornum);
while (node) while (node)
{ {
SetupSubsectorLights(GLPASS_LIGHTSONLY, node->sub); flat->SetupSubsectorLights(GLPASS_LIGHTSONLY, node->sub);
node = node->next; node = node->next;
} }
} }
@ -243,21 +244,21 @@ void GLFlat::ProcessLights(bool istrans)
// //
//========================================================================== //==========================================================================
void GLFlat::DrawSubsectors(int pass, bool processlights, bool istrans) void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool istrans)
{ {
int dli = dynlightindex; int dli = flat->dynlightindex;
gl_RenderState.Apply(); gl_RenderState.Apply();
if (vboindex >= 0) if (flat->vboindex >= 0)
{ {
int index = vboindex; int index = flat->vboindex;
for (int i=0; i<sector->subsectorcount; i++) for (int i=0; i<flat->sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; subsector_t * sub = flat->sector->subsectors[i];
if (gl_drawinfo->ss_renderflags[sub->Index()]&renderflags || istrans) if (gl_drawinfo->ss_renderflags[sub->Index()]& flat->renderflags || istrans)
{ {
if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); if (processlights) flat->SetupSubsectorLights(GLPASS_ALL, sub, &dli);
drawcalls.Clock(); drawcalls.Clock();
glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines); glDrawArrays(GL_TRIANGLE_FAN, index, sub->numlines);
drawcalls.Unclock(); drawcalls.Unclock();
@ -271,28 +272,28 @@ void GLFlat::DrawSubsectors(int pass, bool processlights, bool istrans)
{ {
// Draw the subsectors belonging to this sector // Draw the subsectors belonging to this sector
// (can this case even happen?) // (can this case even happen?)
for (int i=0; i<sector->subsectorcount; i++) for (int i=0; i<flat->sector->subsectorcount; i++)
{ {
subsector_t * sub = sector->subsectors[i]; subsector_t * sub = flat->sector->subsectors[i];
if (gl_drawinfo->ss_renderflags[sub->Index()]&renderflags || istrans) if (gl_drawinfo->ss_renderflags[sub->Index()]& flat->renderflags || istrans)
{ {
if (processlights) SetupSubsectorLights(GLPASS_ALL, sub, &dli); if (processlights) flat->SetupSubsectorLights(GLPASS_ALL, sub, &dli);
DrawSubsector(sub); DrawSubsector(flat, sub);
} }
} }
} }
// Draw the subsectors assigned to it due to missing textures // Draw the subsectors assigned to it due to missing textures
if (!(renderflags&SSRF_RENDER3DPLANES)) if (!(flat->renderflags&SSRF_RENDER3DPLANES))
{ {
gl_subsectorrendernode * node = (renderflags&SSRF_RENDERFLOOR)? gl_subsectorrendernode * node = (flat->renderflags&SSRF_RENDERFLOOR)?
gl_drawinfo->GetOtherFloorPlanes(sector->sectornum) : gl_drawinfo->GetOtherFloorPlanes(flat->sector->sectornum) :
gl_drawinfo->GetOtherCeilingPlanes(sector->sectornum); gl_drawinfo->GetOtherCeilingPlanes(flat->sector->sectornum);
while (node) while (node)
{ {
if (processlights) SetupSubsectorLights(GLPASS_ALL, node->sub, &dli); if (processlights) flat->SetupSubsectorLights(GLPASS_ALL, node->sub, &dli);
DrawSubsector(node->sub); DrawSubsector(flat, node->sub);
node = node->next; node = node->next;
} }
} }
@ -308,13 +309,13 @@ void GLFlat::DrawSubsectors(int pass, bool processlights, bool istrans)
// //
//========================================================================== //==========================================================================
void GLFlat::DrawSkyboxSector(int pass, bool processlights) void FDrawInfo::DrawSkyboxSector(GLFlat *flat, int pass, bool processlights)
{ {
float minx = FLT_MAX, miny = FLT_MAX; float minx = FLT_MAX, miny = FLT_MAX;
float maxx = -FLT_MAX, maxy = -FLT_MAX; float maxx = -FLT_MAX, maxy = -FLT_MAX;
for (auto ln : sector->Lines) for (auto ln : flat->sector->Lines)
{ {
float x = ln->v1->fX(); float x = ln->v1->fX();
float y = ln->v1->fY(); float y = ln->v1->fY();
@ -330,10 +331,10 @@ void GLFlat::DrawSkyboxSector(int pass, bool processlights)
if (y > maxy) maxy = y; if (y > maxy) maxy = y;
} }
float z = plane.plane.ZatPoint(0., 0.) + dz; float z = flat->plane.plane.ZatPoint(0., 0.) + flat->dz;
static float uvals[] = { 0, 0, 1, 1 }; static float uvals[] = { 0, 0, 1, 1 };
static float vvals[] = { 1, 0, 0, 1 }; static float vvals[] = { 1, 0, 0, 1 };
int rot = -xs_FloorToInt(plane.Angle / 90.f); int rot = -xs_FloorToInt(flat->plane.Angle / 90.f);
FQuadDrawer qd; FQuadDrawer qd;
@ -353,7 +354,7 @@ void GLFlat::DrawSkyboxSector(int pass, bool processlights)
// //
// //
//========================================================================== //==========================================================================
void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIGHTSONLY void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has meaning for GLPASS_LIGHTSONLY
{ {
int rel = getExtraLight(); int rel = getExtraLight();
@ -364,128 +365,142 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
} }
#endif #endif
auto &plane = flat->plane;
gl_RenderState.SetNormal(plane.plane.Normal().X, plane.plane.Normal().Z, plane.plane.Normal().Y); gl_RenderState.SetNormal(plane.plane.Normal().X, plane.plane.Normal().Z, plane.plane.Normal().Y);
switch (pass) switch (pass)
{ {
case GLPASS_PLAIN: // Single-pass rendering case GLPASS_PLAIN: // Single-pass rendering
case GLPASS_ALL: // Same, but also creates the dynlight data. case GLPASS_ALL: // Same, but also creates the dynlight data.
mDrawer->SetColor(lightlevel, rel, Colormap,1.0f); mDrawer->SetColor(flat->lightlevel, rel, flat->Colormap,1.0f);
mDrawer->SetFog(lightlevel, rel, &Colormap, false); mDrawer->SetFog(flat->lightlevel, rel, &flat->Colormap, false);
if (!gltexture->tex->isFullbright()) if (!flat->gltexture->tex->isFullbright())
gl_RenderState.SetObjectColor(FlatColor | 0xff000000); gl_RenderState.SetObjectColor(flat->FlatColor | 0xff000000);
if (sector->special != GLSector_Skybox) if (flat->sector->special != GLSector_Skybox)
{ {
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false); gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false);
gl_SetPlaneTextureRotation(&plane, gltexture); gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture);
DrawSubsectors(pass, (pass == GLPASS_ALL || dynlightindex > -1), false); DrawSubsectors(flat, pass, (pass == GLPASS_ALL || flat->dynlightindex > -1), false);
gl_RenderState.EnableTextureMatrix(false); gl_RenderState.EnableTextureMatrix(false);
} }
else else
{ {
gl_RenderState.SetMaterial(gltexture, CLAMP_XY, 0, -1, false); gl_RenderState.SetMaterial(flat->gltexture, CLAMP_XY, 0, -1, false);
DrawSkyboxSector(pass, (pass == GLPASS_ALL || dynlightindex > -1)); DrawSkyboxSector(flat, pass, (pass == GLPASS_ALL || flat->dynlightindex > -1));
} }
gl_RenderState.SetObjectColor(0xffffffff); gl_RenderState.SetObjectColor(0xffffffff);
break; break;
case GLPASS_LIGHTSONLY: case GLPASS_LIGHTSONLY:
if (!trans || gltexture) if (!trans || flat->gltexture)
{ {
ProcessLights(trans); ProcessLights(flat, trans);
} }
break; break;
case GLPASS_TRANSLUCENT: case GLPASS_TRANSLUCENT:
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE); if (flat->renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
mDrawer->SetColor(lightlevel, rel, Colormap, alpha); mDrawer->SetColor(flat->lightlevel, rel, flat->Colormap, flat->alpha);
mDrawer->SetFog(lightlevel, rel, &Colormap, false); mDrawer->SetFog(flat->lightlevel, rel, &flat->Colormap, false);
if (!gltexture || !gltexture->tex->isFullbright()) if (!flat->gltexture || !flat->gltexture->tex->isFullbright())
gl_RenderState.SetObjectColor(FlatColor | 0xff000000); gl_RenderState.SetObjectColor(flat->FlatColor | 0xff000000);
if (!gltexture) if (!flat->gltexture)
{ {
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f); gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.EnableTexture(false); gl_RenderState.EnableTexture(false);
DrawSubsectors(pass, false, true); DrawSubsectors(flat, pass, false, true);
gl_RenderState.EnableTexture(true); gl_RenderState.EnableTexture(true);
} }
else else
{ {
if (!gltexture->tex->GetTranslucency()) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold); if (!flat->gltexture->tex->GetTranslucency()) gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_threshold);
else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f); else gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false); gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false);
gl_SetPlaneTextureRotation(&plane, gltexture); gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture);
DrawSubsectors(pass, !gl.legacyMode && (gl.lightmethod == LM_DIRECT || dynlightindex > -1), true); DrawSubsectors(flat, pass, !gl.legacyMode && (gl.lightmethod == LM_DIRECT || flat->dynlightindex > -1), true);
gl_RenderState.EnableTextureMatrix(false); gl_RenderState.EnableTextureMatrix(false);
} }
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (flat->renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl_RenderState.SetObjectColor(0xffffffff); gl_RenderState.SetObjectColor(0xffffffff);
break; break;
case GLPASS_LIGHTTEX: case GLPASS_LIGHTTEX:
case GLPASS_LIGHTTEX_ADDITIVE: case GLPASS_LIGHTTEX_ADDITIVE:
case GLPASS_LIGHTTEX_FOGGY: case GLPASS_LIGHTTEX_FOGGY:
DrawLightsCompat(pass); DrawLightsCompat(flat, pass);
break; break;
case GLPASS_TEXONLY: case GLPASS_TEXONLY:
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false); gl_RenderState.SetMaterial(flat->gltexture, CLAMP_NONE, 0, -1, false);
gl_SetPlaneTextureRotation(&plane, gltexture); gl_RenderState.SetPlaneTextureRotation(&plane, flat->gltexture);
DrawSubsectors(pass, false, false); DrawSubsectors(flat, pass, false, false);
gl_RenderState.EnableTextureMatrix(false); gl_RenderState.EnableTextureMatrix(false);
break; break;
} }
} }
//========================================================================== //==========================================================================
// //
// GLFlat::PutFlat // FDrawInfo::AddFlat
// //
// Checks texture, lighting and translucency settings and puts this // Checks texture, lighting and translucency settings and puts this
// plane in the appropriate render list. // plane in the appropriate render list.
// //
//========================================================================== //==========================================================================
inline void GLFlat::PutFlat(bool fog)
void FDrawInfo::AddFlat(GLFlat *flat, bool fog)
{ {
int list; int list;
if (mDrawer->FixedColormap)
{
Colormap.Clear();
}
if (gl.legacyMode) if (gl.legacyMode)
{ {
if (PutFlatCompat(fog)) return; if (PutFlatCompat(flat, fog)) return;
} }
if (renderstyle!=STYLE_Translucent || alpha < 1.f - FLT_EPSILON || fog || gltexture == NULL) if (flat->renderstyle != STYLE_Translucent || flat->alpha < 1.f - FLT_EPSILON || fog || flat->gltexture == nullptr)
{ {
// translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list. // translucent 3D floors go into the regular translucent list, translucent portals go into the translucent border list.
list = (renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER; list = (flat->renderflags&SSRF_RENDER3DPLANES) ? GLDL_TRANSLUCENT : GLDL_TRANSLUCENTBORDER;
} }
else if (gltexture->tex->GetTranslucency()) else if (flat->gltexture->tex->GetTranslucency())
{ {
if (stack) if (flat->stack)
{ {
list = GLDL_TRANSLUCENTBORDER; list = GLDL_TRANSLUCENTBORDER;
} }
else if ((renderflags&SSRF_RENDER3DPLANES) && !plane.plane.isSlope()) else if ((flat->renderflags&SSRF_RENDER3DPLANES) && !flat->plane.plane.isSlope())
{ {
list = GLDL_TRANSLUCENT; list = GLDL_TRANSLUCENT;
} }
else else
{ {
list = GLDL_PLAINFLATS; list = GLDL_PLAINFLATS;
} }
} }
else else
{ {
bool masked = gltexture->isMasked() && ((renderflags&SSRF_RENDER3DPLANES) || stack); bool masked = flat->gltexture->isMasked() && ((flat->renderflags&SSRF_RENDER3DPLANES) || flat->stack);
list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS; list = masked ? GLDL_MASKEDFLATS : GLDL_PLAINFLATS;
} }
dynlightindex = -1; // make sure this is always initialized to something proper.
auto newflat = gl_drawinfo->drawlists[list].NewFlat(); auto newflat = gl_drawinfo->drawlists[list].NewFlat();
*newflat = *this; *newflat = *flat;
}
//==========================================================================
//
// GLFlat::PutFlat
//
// submit to the renderer
//
//==========================================================================
inline void GLFlat::PutFlat(HWDrawInfo *di, bool fog)
{
if (di->FixedColormap)
{
Colormap.Clear();
}
dynlightindex = -1; // make sure this is always initialized to something proper.
di->AddFlat(this, fog);
} }
//========================================================================== //==========================================================================
@ -497,7 +512,7 @@ inline void GLFlat::PutFlat(bool fog)
// //
//========================================================================== //==========================================================================
void GLFlat::Process(sector_t * model, int whichplane, bool fog) void GLFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog)
{ {
plane.GetFromSector(model, whichplane); plane.GetFromSector(model, whichplane);
if (whichplane != int(ceiling)) if (whichplane != int(ceiling))
@ -528,7 +543,7 @@ void GLFlat::Process(sector_t * model, int whichplane, bool fog)
z = plane.plane.ZatPoint(0.f, 0.f); z = plane.plane.ZatPoint(0.f, 0.f);
PutFlat(fog); PutFlat(di, fog);
rendered_flats++; rendered_flats++;
} }
@ -578,7 +593,7 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
// //
//========================================================================== //==========================================================================
void GLFlat::ProcessSector(sector_t * frontsector) void GLFlat::ProcessSector(HWDrawInfo *di, sector_t * frontsector)
{ {
lightlist_t * light; lightlist_t * light;
FSectorPortal *port; FSectorPortal *port;
@ -595,7 +610,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
extsector_t::xfloor &x = sector->e->XFloor; extsector_t::xfloor &x = sector->e->XFloor;
dynlightindex = -1; dynlightindex = -1;
uint8_t &srf = gl_drawinfo->sectorrenderflags[sector->sectornum]; uint8_t &srf = di->sectorrenderflags[sector->sectornum];
// //
// //
@ -618,7 +633,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
{ {
if (port->mType == PORTS_STACKEDSECTORTHING) if (port->mType == PORTS_STACKEDSECTORTHING)
{ {
gl_drawinfo->AddFloorStack(sector); // stacked sector things require visplane merging. di->AddFloorStack(sector); // stacked sector things require visplane merging.
} }
alpha = frontsector->GetAlpha(sector_t::floor); alpha = frontsector->GetAlpha(sector_t::floor);
} }
@ -653,7 +668,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
Colormap.CopyFrom3DLight(light); Colormap.CopyFrom3DLight(light);
} }
renderstyle = STYLE_Translucent; renderstyle = STYLE_Translucent;
Process(frontsector, sector_t::floor, false); Process(di, frontsector, sector_t::floor, false);
} }
} }
@ -678,7 +693,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
{ {
if (port->mType == PORTS_STACKEDSECTORTHING) if (port->mType == PORTS_STACKEDSECTORTHING)
{ {
gl_drawinfo->AddCeilingStack(sector); di->AddCeilingStack(sector);
} }
alpha = frontsector->GetAlpha(sector_t::ceiling); alpha = frontsector->GetAlpha(sector_t::ceiling);
} }
@ -713,7 +728,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
Colormap.CopyFrom3DLight(light); Colormap.CopyFrom3DLight(light);
} }
renderstyle = STYLE_Translucent; renderstyle = STYLE_Translucent;
Process(frontsector, sector_t::ceiling, false); Process(di, frontsector, sector_t::ceiling, false);
} }
} }
@ -749,7 +764,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if ((rover->flags&(FF_EXISTS | FF_RENDERPLANES | FF_THISINSIDE)) == (FF_EXISTS | FF_RENDERPLANES)) if ((rover->flags&(FF_EXISTS | FF_RENDERPLANES | FF_THISINSIDE)) == (FF_EXISTS | FF_RENDERPLANES))
{ {
if (rover->flags&FF_FOG && mDrawer->FixedColormap) continue; if (rover->flags&FF_FOG && di->FixedColormap) continue;
if (!rover->top.copied && rover->flags&(FF_INVERTPLANES | FF_BOTHPLANES)) if (!rover->top.copied && rover->flags&(FF_INVERTPLANES | FF_BOTHPLANES))
{ {
double ff_top = rover->top.plane->ZatPoint(sector->centerspot); double ff_top = rover->top.plane->ZatPoint(sector->centerspot);
@ -759,7 +774,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
{ {
SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG)); SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG));
Colormap.FadeColor = frontsector->Colormap.FadeColor; Colormap.FadeColor = frontsector->Colormap.FadeColor;
Process(rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG)); Process(di, rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
} }
lastceilingheight = ff_top; lastceilingheight = ff_top;
} }
@ -773,7 +788,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
{ {
SetFrom3DFloor(rover, false, !(rover->flags&FF_FOG)); SetFrom3DFloor(rover, false, !(rover->flags&FF_FOG));
Colormap.FadeColor = frontsector->Colormap.FadeColor; Colormap.FadeColor = frontsector->Colormap.FadeColor;
Process(rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG)); Process(di, rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
} }
lastceilingheight = ff_bottom; lastceilingheight = ff_bottom;
if (rover->alpha < 255) lastceilingheight += EQUAL_EPSILON; if (rover->alpha < 255) lastceilingheight += EQUAL_EPSILON;
@ -789,7 +804,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
if ((rover->flags&(FF_EXISTS | FF_RENDERPLANES | FF_THISINSIDE)) == (FF_EXISTS | FF_RENDERPLANES)) if ((rover->flags&(FF_EXISTS | FF_RENDERPLANES | FF_THISINSIDE)) == (FF_EXISTS | FF_RENDERPLANES))
{ {
if (rover->flags&FF_FOG && mDrawer->FixedColormap) continue; if (rover->flags&FF_FOG && di->FixedColormap) continue;
if (!rover->bottom.copied && rover->flags&(FF_INVERTPLANES | FF_BOTHPLANES)) if (!rover->bottom.copied && rover->flags&(FF_INVERTPLANES | FF_BOTHPLANES))
{ {
double ff_bottom = rover->bottom.plane->ZatPoint(sector->centerspot); double ff_bottom = rover->bottom.plane->ZatPoint(sector->centerspot);
@ -806,7 +821,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
Colormap = rover->GetColormap(); Colormap = rover->GetColormap();
} }
Process(rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG)); Process(di, rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
} }
lastfloorheight = ff_bottom; lastfloorheight = ff_bottom;
} }
@ -820,7 +835,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
{ {
SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG)); SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG));
Colormap.FadeColor = frontsector->Colormap.FadeColor; Colormap.FadeColor = frontsector->Colormap.FadeColor;
Process(rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG)); Process(di, rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
} }
lastfloorheight = ff_top; lastfloorheight = ff_top;
if (rover->alpha < 255) lastfloorheight -= EQUAL_EPSILON; if (rover->alpha < 255) lastfloorheight -= EQUAL_EPSILON;

View file

@ -1185,7 +1185,7 @@ void GLHorizonPortal::DrawContents()
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false); gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
gl_RenderState.SetObjectColor(origin->specialcolor); gl_RenderState.SetObjectColor(origin->specialcolor);
gl_SetPlaneTextureRotation(sp, gltexture); gl_RenderState.SetPlaneTextureRotation(sp, gltexture);
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f); gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
gl_RenderState.BlendFunc(GL_ONE,GL_ZERO); gl_RenderState.BlendFunc(GL_ONE,GL_ZERO);
gl_RenderState.Apply(); gl_RenderState.Apply();

View file

@ -38,6 +38,7 @@
#include "gl/shaders/gl_shader.h" #include "gl/shaders/gl_shader.h"
EXTERN_CVAR(Float, skyoffset)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// //

View file

@ -34,73 +34,6 @@ struct FDynLightData;
struct FDrawInfo; struct FDrawInfo;
struct HWDrawInfo; struct HWDrawInfo;
//==========================================================================
//
// One flat plane in the draw list
//
//==========================================================================
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)
FMaterial *gltexture;
FColormap Colormap; // light and fog
PalEntry FlatColor;
ERenderStyle renderstyle;
float alpha;
GLSectorPlane plane;
int lightlevel;
bool stack;
bool ceiling;
uint8_t renderflags;
int vboindex;
//int vboheight;
int dynlightindex;
GLFlat(GLSceneDrawer *drawer)
{
mDrawer = drawer;
}
// 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 DrawSkyboxSector(int pass, bool processlights);
void DrawSubsectors(int pass, bool processlights, bool istrans);
void ProcessLights(bool istrans);
void PutFlat(bool fog = false);
void Process(sector_t * model, int whichplane, bool notexture);
void SetFrom3DFloor(F3DFloor *rover, bool top, bool underside);
void ProcessSector(sector_t * frontsector);
void Draw(int pass, bool trans);
GLFlat(const GLFlat &other)
{
memcpy(this, &other, sizeof(GLFlat));
}
GLFlat & operator=(const GLFlat &other)
{
memcpy(this, &other, sizeof(GLFlat));
return *this;
}
};
//========================================================================== //==========================================================================
// //
// One sprite in the draw list // One sprite in the draw list

View file

@ -6,6 +6,7 @@ struct FSectorPortalGroup;
struct FLinePortalSpan; struct FLinePortalSpan;
struct FFlatVertex; struct FFlatVertex;
class GLWall; class GLWall;
class GLFlat;
struct GLDecal; struct GLDecal;
//========================================================================== //==========================================================================
@ -128,6 +129,8 @@ public:
virtual void AddWall(GLWall *w) = 0; virtual void AddWall(GLWall *w) = 0;
virtual void AddPortal(GLWall *w, int portaltype) = 0; virtual void AddPortal(GLWall *w, int portaltype) = 0;
virtual void AddMirrorSurface(GLWall *w) = 0; virtual void AddMirrorSurface(GLWall *w) = 0;
virtual void AddFlat(GLFlat *flat, bool fog) = 0;
virtual GLDecal *AddDecal(bool onmirror) = 0; virtual GLDecal *AddDecal(bool onmirror) = 0;
virtual void ProcessActorsInPortal(FLinePortalSpan *glport) = 0; virtual void ProcessActorsInPortal(FLinePortalSpan *glport) = 0;
virtual std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) = 0; virtual std::pair<FFlatVertex *, unsigned int> AllocVertices(unsigned int count) = 0;

View file

@ -22,6 +22,7 @@ struct FSectorPortalGroup;
struct FFlatVertex; struct FFlatVertex;
struct FLinePortalSpan; struct FLinePortalSpan;
struct FDynLightData; struct FDynLightData;
class VSMatrix;
enum WallTypes enum WallTypes
{ {
@ -281,6 +282,59 @@ public:
}; };
//==========================================================================
//
// One flat plane in the draw list
//
//==========================================================================
class GLFlat
{
public:
sector_t * sector;
float dz; // z offset for rendering hacks
float z; // the z position of the flat (only valid for non-sloped planes)
FMaterial *gltexture;
FColormap Colormap; // light and fog
PalEntry FlatColor;
ERenderStyle renderstyle;
float alpha;
GLSectorPlane plane;
int lightlevel;
bool stack;
bool ceiling;
uint8_t renderflags;
int vboindex;
//int vboheight;
int dynlightindex;
void SetupSubsectorLights(int pass, subsector_t * sub, int *dli = NULL);
void PutFlat(HWDrawInfo *di, bool fog = false);
void Process(HWDrawInfo *di, sector_t * model, int whichplane, bool notexture);
void SetFrom3DFloor(F3DFloor *rover, bool top, bool underside);
void ProcessSector(HWDrawInfo *di, sector_t * frontsector);
GLFlat() {}
GLFlat(const GLFlat &other)
{
memcpy(this, &other, sizeof(GLFlat));
}
GLFlat & operator=(const GLFlat &other)
{
memcpy(this, &other, sizeof(GLFlat));
return *this;
}
};
@ -311,3 +365,5 @@ inline float Dist2(float x1,float y1,float x2,float y2)
{ {
return sqrtf((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); return sqrtf((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
} }
bool gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FMaterial * gltexture, VSMatrix &mat);

View file

@ -70,8 +70,6 @@
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CVAR(Float, skyoffset, 0, 0) // for testing
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// //

View file

@ -48,6 +48,7 @@
bool GLWall::SetupLights(FDynLightData &lightdata) bool GLWall::SetupLights(FDynLightData &lightdata)
{ {
if (screen->hwcaps & RFL_NO_SHADERS) return false; // useless in OpenGL 2.
if (RenderStyle == STYLE_Add && !level.lightadditivesurfaces) return false; // no lights on additively blended surfaces. if (RenderStyle == STYLE_Add && !level.lightadditivesurfaces) return false; // no lights on additively blended surfaces.
// check for wall types which cannot have dynamic lights on them (portal types never get here so they don't need to be checked.) // check for wall types which cannot have dynamic lights on them (portal types never get here so they don't need to be checked.)

View file

@ -30,6 +30,9 @@
#include "g_levellocals.h" #include "g_levellocals.h"
#include "polyrenderer/scene/poly_light.h" #include "polyrenderer/scene/poly_light.h"
EXTERN_CVAR(Float, skyoffset)
PolySkyDome::PolySkyDome() PolySkyDome::PolySkyDome()
{ {
CreateDome(); CreateDome();
@ -212,7 +215,6 @@ Mat4f PolySkyDome::GLSkyMath()
float y_offset = 0.0f; float y_offset = 0.0f;
bool mirror = false; bool mirror = false;
FTexture *tex = mCurrentSetup.frontskytex; FTexture *tex = mCurrentSetup.frontskytex;
float skyoffset = 0.0f; // skyoffset debugging CVAR in GL renderer
int texh = 0; int texh = 0;
int texw = 0; int texw = 0;

View file

@ -65,6 +65,9 @@ CUSTOM_CVAR (Int, r_skymode, 2, CVAR_ARCHIVE)
R_InitSkyMap (); R_InitSkyMap ();
} }
CVAR(Float, skyoffset, 0, 0) // for testing
int freelookviewheight; int freelookviewheight;