- some Transfer_Heights related optimizations.

* only call hw_CheckViewArea if the result is not known yet.
* check the map up front if it even contains heightsecs. This allows to shortcut the above check entirely for maps without sector transfers and will allow further optimizations.

(cherry picked from commit 3c49804c6c)

# Conflicts:
#	src/gl/scene/gl_bsp.cpp
#	src/gl/scene/gl_fakeflat.cpp
#	src/hwrenderer/scene/hw_fakeflat.h
This commit is contained in:
Christoph Oelckers 2018-05-01 09:02:24 +02:00 committed by drfrag666
parent 84b261d947
commit e5aca6dfa4
7 changed files with 12 additions and 6 deletions

View file

@ -1472,6 +1472,7 @@ void G_InitLevelLocals ()
level.Music = info->Music;
level.musicorder = info->musicorder;
level.MusicVolume = 1.f;
level.HasHeightSecs = false;
level.LevelName = level.info->LookupLevelName();
level.NextMap = info->NextMap;

View file

@ -141,6 +141,7 @@ struct FLevelLocals
int8_t WallHorizLight;
bool FromSnapshot; // The current map was restored from a snapshot
bool HasHeightSecs; // true if some Transfer_Heights effects are present in the map. If this is false, some checks in the renderer can be shortcut.
double teamdamage;

View file

@ -147,7 +147,7 @@ void GLSceneDrawer::AddLine (seg_t *seg, bool portalclip)
else
{
// clipping checks are only needed when the backsector is not the same as the front sector
CheckViewArea(seg->v1, seg->v2, seg->frontsector, seg->backsector);
if (in_area == area_default) in_area = CheckViewArea(seg->v1, seg->v2, seg->frontsector, seg->backsector);
backsector = gl_FakeFlat(seg->backsector, &bs, in_area, true);

View file

@ -156,13 +156,14 @@ bool gl_CheckClip(side_t * sidedef, sector_t * frontsector, sector_t * backsecto
//==========================================================================
//
// check for levels with exposed lower areas
// check for levels with exposed lower areas. May only be called if actual
// state is not known yet!
//
//==========================================================================
void GLSceneDrawer::CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_t *backsector)
area_t GLSceneDrawer::CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_t *backsector)
{
if (in_area == area_default &&
if (
(backsector->heightsec && !(backsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC)) &&
(!frontsector->heightsec || frontsector->heightsec->MoreFlags & SECF_IGNOREHEIGHTSEC))
{
@ -179,6 +180,7 @@ void GLSceneDrawer::CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsec
else
in_area = area_normal;
}
return area_default;
}

View file

@ -133,7 +133,7 @@ void GLSceneDrawer::SetViewArea()
}
else
{
in_area = area_default; // depends on exposed lower sectors
in_area = level.HasHeightSecs? area_default : area_normal; // depends on exposed lower sectors, if map contains heightsecs.
}
}

View file

@ -62,7 +62,7 @@ public:
void DrawEndScene2D(sector_t * viewsector);
void RenderActorsInPortal(FGLLinePortal *glport);
void CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_t *backsector);
area_t CheckViewArea(vertex_t *v1, vertex_t *v2, sector_t *frontsector, sector_t *backsector);
sector_t *RenderViewpoint(AActor * camera, GL_IRECT * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen);
void RenderView(player_t *player);

View file

@ -1361,6 +1361,7 @@ void P_SpawnSpecials (void)
case Transfer_Heights:
{
sec = line.frontsector;
if (line.args[1] & 2)
{
sec->MoreFlags |= SECF_FAKEFLOORONLY;
@ -1381,6 +1382,7 @@ void P_SpawnSpecials (void)
{
sec->MoreFlags |= SECF_IGNOREHEIGHTSEC;
}
else level.HasHeightSecs = true;
if (line.args[1] & 32)
{
sec->MoreFlags |= SECF_NOFAKELIGHT;