2017-04-17 10:27:19 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2017-01-03 06:17:54 +00:00
|
|
|
//
|
2017-04-17 10:27:19 +00:00
|
|
|
// Copyright 1993-1996 id Software
|
|
|
|
// Copyright 1999-2016 Randy Heit
|
|
|
|
// Copyright 2016 Magnus Norddahl
|
2017-01-03 06:17:54 +00:00
|
|
|
//
|
2017-04-17 10:27:19 +00:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2017-01-03 06:17:54 +00:00
|
|
|
//
|
2017-04-17 10:27:19 +00:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
2017-01-03 06:17:54 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2017-04-17 10:27:19 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
2017-01-03 06:17:54 +00:00
|
|
|
//
|
2017-04-17 10:27:19 +00:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2016-12-30 05:08:47 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-12-31 11:45:07 +00:00
|
|
|
#include "swrenderer/segments/r_portalsegment.h"
|
2017-03-12 18:43:40 +00:00
|
|
|
#include <set>
|
2016-12-30 05:08:47 +00:00
|
|
|
|
|
|
|
namespace swrenderer
|
|
|
|
{
|
2017-02-03 23:25:37 +00:00
|
|
|
class RenderThread;
|
2017-01-19 02:11:49 +00:00
|
|
|
struct VisiblePlane;
|
2017-01-03 18:25:00 +00:00
|
|
|
|
2017-01-05 03:55:26 +00:00
|
|
|
class RenderPortal
|
|
|
|
{
|
|
|
|
public:
|
2017-02-03 23:25:37 +00:00
|
|
|
RenderPortal(RenderThread *thread);
|
2017-01-05 03:55:26 +00:00
|
|
|
|
|
|
|
void SetMainPortal();
|
|
|
|
void CopyStackedViewParameters();
|
|
|
|
|
|
|
|
void RenderPlanePortals();
|
|
|
|
void RenderLinePortals();
|
2017-01-24 04:31:39 +00:00
|
|
|
|
|
|
|
void AddLinePortal(line_t *linedef, int x1, int x2, const short *topclip, const short *bottomclip);
|
2017-02-03 23:25:37 +00:00
|
|
|
|
|
|
|
RenderThread *Thread = nullptr;
|
2017-01-05 03:55:26 +00:00
|
|
|
|
|
|
|
int WindowLeft = 0;
|
|
|
|
int WindowRight = 0;
|
|
|
|
uint16_t MirrorFlags = 0;
|
2016-12-30 05:15:10 +00:00
|
|
|
|
2017-01-05 03:55:26 +00:00
|
|
|
PortalDrawseg* CurrentPortal = nullptr;
|
|
|
|
int CurrentPortalUniq = 0;
|
|
|
|
bool CurrentPortalInSkybox = false;
|
2016-12-31 13:15:06 +00:00
|
|
|
|
2017-01-05 03:55:26 +00:00
|
|
|
// These are copies of the main parameters used when drawing stacked sectors.
|
|
|
|
// When you change the main parameters, you should copy them here too *unless*
|
|
|
|
// you are changing them to draw a stacked sector. Otherwise, stacked sectors
|
|
|
|
// won't draw in skyboxes properly.
|
|
|
|
int stacked_extralight = 0;
|
|
|
|
double stacked_visibility = 0.0;
|
|
|
|
DVector3 stacked_viewpos;
|
2017-03-11 22:28:07 +00:00
|
|
|
DRotator stacked_angle;
|
2017-01-05 03:55:26 +00:00
|
|
|
|
|
|
|
int numskyboxes = 0; // For ADD_STAT(skyboxes)
|
|
|
|
|
2017-03-12 18:43:40 +00:00
|
|
|
void SetInSkyBox(FSectorPortal *portal) { SectorPortalsInSkyBox.insert(portal); }
|
|
|
|
void ClearInSkyBox(FSectorPortal *portal) { SectorPortalsInSkyBox.erase(portal); }
|
|
|
|
bool InSkyBox(FSectorPortal *portal) const { return SectorPortalsInSkyBox.find(portal) != SectorPortalsInSkyBox.end(); }
|
|
|
|
|
2017-01-05 03:55:26 +00:00
|
|
|
private:
|
|
|
|
void RenderLinePortal(PortalDrawseg* pds, int depth);
|
|
|
|
void RenderLinePortalHighlight(PortalDrawseg* pds);
|
|
|
|
|
|
|
|
TArray<DVector3> viewposStack;
|
2017-01-19 02:11:49 +00:00
|
|
|
TArray<VisiblePlane *> visplaneStack;
|
2017-01-24 04:31:39 +00:00
|
|
|
TArray<PortalDrawseg *> WallPortals;
|
2017-03-12 18:43:40 +00:00
|
|
|
|
|
|
|
std::set<FSectorPortal *> SectorPortalsInSkyBox; // Instead of portal->mFlags & PORTSF_INSKYBOX
|
2017-01-05 03:55:26 +00:00
|
|
|
};
|
2016-12-30 05:08:47 +00:00
|
|
|
}
|