diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index 07e5c8347b..c42a2c19cb 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -413,7 +413,6 @@ static void InitVertexData() TArray * vt_sectorlists; int i,j,k; - unsigned int l; vt_sectorlists = new TArray[numvertexes]; diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 99776afbe5..7a961d2cd2 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -838,7 +838,6 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo angle_t a1 = FrustumAngle(); clipper.SafeAddClipRangeRealAngles(viewangle + a1, viewangle - a1); - GLWallLightEntryArena.FreeAll(); ProcessScene(toscreen); if (mainview) EndDrawScene(retval); // do not call this for camera textures. eye->TearDown(); diff --git a/src/gl/scene/gl_wall.h b/src/gl/scene/gl_wall.h index c9b2e12bdc..4d83e726b3 100644 --- a/src/gl/scene/gl_wall.h +++ b/src/gl/scene/gl_wall.h @@ -85,16 +85,6 @@ struct GLSectorPlane }; -struct GLWallLightEntry -{ - secplane_t *cliptop; - secplane_t *clipbottom; - int lightlevel; - FColormap colormap; -}; - -extern FMemArena GLWallLightEntryArena; - class GLWall { public: @@ -134,8 +124,7 @@ public: fixed_t viewdistance; - GLWallLightEntry *lights; - unsigned int lightsize; + TArray *lightlist; int lightlevel; BYTE type; BYTE flags; diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 6e51c2702f..ac90e6123b 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -62,8 +62,6 @@ #include "gl/shaders/gl_shader.h" -FMemArena GLWallLightEntryArena; - //========================================================================== // // Checks whether a wall should glow @@ -228,28 +226,14 @@ void GLWall::PutWall(bool translucent) void GLWall::SplitWall(sector_t * frontsector, bool translucent) { - TArray & lightlist=frontsector->e->XFloor.lightlist; if (glseg.x1==glseg.x2 && glseg.y1==glseg.y2) { return; } - ::SplitWall.Clock(); - - lightsize = lightlist.Size(); - lights = (GLWallLightEntry*)GLWallLightEntryArena.Alloc(sizeof(GLWallLightEntry)*lightsize); - secplane_t *upperplane = &topplane; - for (unsigned i = 0; i < lightlist.Size(); i++) - { - lights[i].cliptop = &lightlist[i].plane; - lights[i].clipbottom = i == lightlist.Size() - 1 ? (secplane_t*)NULL : &lightlist[i + 1].plane; - lights[i].lightlevel = lightlist[i].caster != NULL? gl_ClampLight(*lightlist[i].p_lightlevel) : lightlevel; - lights[i].colormap.FadeColor = Colormap.FadeColor; - lights[i].colormap.CopyFrom3DLight(&lightlist[i]); - } + lightlist=&frontsector->e->XFloor.lightlist; PutWall(translucent); - lights = NULL; - lightsize = 0; + lightlist = NULL; } @@ -1296,7 +1280,7 @@ void GLWall::Process(seg_t *seg, sector_t * frontsector, sector_t * backsector) Colormap = frontsector->ColorMap; flags = 0; dynlightindex = UINT_MAX; - lights = NULL; + lightlist = NULL; int rel = 0; int orglightlevel = gl_ClampLight(frontsector->lightlevel); diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index 814bc35451..cd404f4c9c 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -330,7 +330,7 @@ void GLWall::RenderTextured(int rflags) } float absalpha = fabsf(alpha); - if (lights == NULL) + if (lightlist == NULL) { gl_SetColor(lightlevel, rel, Colormap, absalpha); if (type != RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, RenderStyle == STYLE_Add); @@ -341,13 +341,19 @@ void GLWall::RenderTextured(int rflags) gl_RenderState.EnableSplit(true); glEnable(GL_CLIP_DISTANCE3); glEnable(GL_CLIP_DISTANCE4); - for (unsigned i = 0; i Size(); i++) { - gl_SetColor(lights[i].lightlevel, rel, lights[i].colormap, absalpha); - if (type != RENDERWALL_M2SNF) gl_SetFog(lights[i].lightlevel, rel, &lights[i].colormap, RenderStyle == STYLE_Add); - gl_RenderState.SetSplitPlanes(*lights[i].cliptop, lights[i].clipbottom? *lights[i].clipbottom : bottomplane); + int thisll = (*lightlist)[i].caster != NULL? gl_ClampLight(*(*lightlist)[i].p_lightlevel) : lightlevel; + 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); + gl_RenderState.SetSplitPlanes((*lightlist)[i].plane, i == (*lightlist).Size() - 1 ? bottomplane : (*lightlist)[i + 1].plane); RenderWall(rflags); } + glDisable(GL_CLIP_DISTANCE3); glDisable(GL_CLIP_DISTANCE4); gl_RenderState.EnableSplit(false); diff --git a/src/gl/utility/gl_clock.cpp b/src/gl/utility/gl_clock.cpp index 48c21dde26..545607ea13 100644 --- a/src/gl/utility/gl_clock.cpp +++ b/src/gl/utility/gl_clock.cpp @@ -16,7 +16,7 @@ #include "gl/utility/gl_convert.h" -glcycle_t RenderWall,SetupWall,ClipWall,SplitWall; +glcycle_t RenderWall,SetupWall,ClipWall; glcycle_t RenderFlat,SetupFlat; glcycle_t RenderSprite,SetupSprite; glcycle_t All, Finish, PortalAll, Bsp; @@ -91,7 +91,6 @@ void ResetProfilingData() ProcessAll.Reset(); RenderWall.Reset(); SetupWall.Reset(); - SplitWall.Reset(); ClipWall.Reset(); RenderFlat.Reset(); SetupFlat.Reset(); @@ -111,15 +110,15 @@ void ResetProfilingData() static void AppendRenderTimes(FString &str) { - double setupwall = SetupWall.TimeMS() - SplitWall.TimeMS(); + double setupwall = SetupWall.TimeMS(); double clipwall = ClipWall.TimeMS() - SetupWall.TimeMS(); double bsp = Bsp.TimeMS() - ClipWall.TimeMS() - SetupFlat.TimeMS() - SetupSprite.TimeMS(); - str.AppendFormat("W: Render=%2.3f, Split = %2.3f, Setup=%2.3f, Clip=%2.3f\n" + str.AppendFormat("W: Render=%2.3f, Setup=%2.3f, Clip=%2.3f\n" "F: Render=%2.3f, Setup=%2.3f\n" "S: Render=%2.3f, Setup=%2.3f\n" "All=%2.3f, Render=%2.3f, Setup=%2.3f, BSP = %2.3f, Portal=%2.3f, Drawcalls=%2.3f, Finish=%2.3f\n", - RenderWall.TimeMS(), SplitWall.TimeMS(), setupwall, clipwall, RenderFlat.TimeMS(), SetupFlat.TimeMS(), + RenderWall.TimeMS(), setupwall, clipwall, RenderFlat.TimeMS(), SetupFlat.TimeMS(), RenderSprite.TimeMS(), SetupSprite.TimeMS(), All.TimeMS() + Finish.TimeMS(), RenderAll.TimeMS(), ProcessAll.TimeMS(), bsp, PortalAll.TimeMS(), drawcalls.TimeMS(), Finish.TimeMS()); } diff --git a/src/gl/utility/gl_clock.h b/src/gl/utility/gl_clock.h index 46a01d1e4a..4d5163d86f 100644 --- a/src/gl/utility/gl_clock.h +++ b/src/gl/utility/gl_clock.h @@ -102,7 +102,7 @@ private: #endif // __APPLE__ -extern glcycle_t RenderWall,SetupWall,ClipWall,SplitWall; +extern glcycle_t RenderWall,SetupWall,ClipWall; extern glcycle_t RenderFlat,SetupFlat; extern glcycle_t RenderSprite,SetupSprite; extern glcycle_t All, Finish, PortalAll, Bsp;