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.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2017-01-03 06:17:54 +00:00
|
|
|
//
|
2017-01-01 09:28:35 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-01-12 15:21:46 +00:00
|
|
|
#include "vectors.h"
|
2017-01-24 05:50:17 +00:00
|
|
|
#include "r_wallsetup.h"
|
2017-02-04 14:51:54 +00:00
|
|
|
#include "swrenderer/segments/r_clipsegment.h"
|
2018-03-08 03:05:35 +00:00
|
|
|
#include "swrenderer/scene/r_3dfloors.h"
|
2017-01-12 15:21:46 +00:00
|
|
|
|
|
|
|
struct seg_t;
|
|
|
|
struct subsector_t;
|
|
|
|
struct sector_t;
|
|
|
|
struct side_t;
|
|
|
|
struct line_t;
|
2017-01-12 20:29:19 +00:00
|
|
|
struct FDynamicColormap;
|
2017-01-12 15:21:46 +00:00
|
|
|
|
2017-01-01 09:28:35 +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-04 04:10:16 +00:00
|
|
|
|
2017-01-01 09:28:35 +00:00
|
|
|
struct FWallCoords
|
|
|
|
{
|
|
|
|
FVector2 tleft; // coords at left of wall in view space rx1,ry1
|
|
|
|
FVector2 tright; // coords at right of wall in view space rx2,ry2
|
|
|
|
|
|
|
|
float sz1, sz2; // depth at left, right of wall in screen space yb1,yb2
|
|
|
|
short sx1, sx2; // x coords at left, right of wall in screen space xb1,xb2
|
|
|
|
|
2017-02-03 23:25:37 +00:00
|
|
|
bool Init(RenderThread *thread, const DVector2 &pt1, const DVector2 &pt2, double too_close);
|
2017-01-01 09:28:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct FWallTmapVals
|
|
|
|
{
|
|
|
|
float UoverZorg, UoverZstep;
|
|
|
|
float InvZorg, InvZstep;
|
|
|
|
|
2017-02-03 23:25:37 +00:00
|
|
|
void InitFromWallCoords(RenderThread *thread, const FWallCoords *wallc);
|
|
|
|
void InitFromLine(RenderThread *thread, const DVector2 &left, const DVector2 &right);
|
2017-01-01 09:28:35 +00:00
|
|
|
};
|
|
|
|
|
2017-02-12 05:17:38 +00:00
|
|
|
struct WallPartTexture
|
|
|
|
{
|
|
|
|
fixed_t TextureOffsetU;
|
|
|
|
double TextureMid;
|
|
|
|
double TextureScaleU;
|
|
|
|
double TextureScaleV;
|
|
|
|
FTexture *Texture;
|
|
|
|
};
|
|
|
|
|
2017-02-04 14:51:54 +00:00
|
|
|
class SWRenderLine : VisibleSegmentRenderer
|
2017-01-03 17:57:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-02-03 23:25:37 +00:00
|
|
|
SWRenderLine(RenderThread *thread);
|
2018-03-08 03:05:35 +00:00
|
|
|
void Render(seg_t *line, subsector_t *subsector, sector_t *sector, sector_t *fakebacksector, VisiblePlane *floorplane, VisiblePlane *ceilingplane, bool foggy, FDynamicColormap *basecolormap, Fake3DOpaque fake3DOpaque);
|
2017-01-03 17:57:48 +00:00
|
|
|
|
2017-02-03 23:25:37 +00:00
|
|
|
RenderThread *Thread = nullptr;
|
|
|
|
|
2017-01-03 17:57:48 +00:00
|
|
|
private:
|
2017-02-04 14:51:54 +00:00
|
|
|
bool RenderWallSegment(int x1, int x2) override;
|
2017-01-03 18:08:02 +00:00
|
|
|
void SetWallVariables(bool needlights);
|
2017-02-12 06:24:35 +00:00
|
|
|
void SetTopTexture();
|
|
|
|
void SetMiddleTexture();
|
|
|
|
void SetBottomTexture();
|
2017-02-12 05:44:03 +00:00
|
|
|
void ClipSegmentTopBottom(int x1, int x2);
|
2017-02-12 23:00:25 +00:00
|
|
|
void MarkCeilingPlane(int x1, int x2);
|
|
|
|
void MarkFloorPlane(int x1, int x2);
|
|
|
|
void Mark3DFloors(int x1, int x2);
|
|
|
|
void MarkOpaquePassClip(int x1, int x2);
|
|
|
|
void RenderTopTexture(int x1, int x2);
|
|
|
|
void RenderMiddleTexture(int x1, int x2);
|
|
|
|
void RenderBottomTexture(int x1, int x2);
|
2017-01-03 17:57:48 +00:00
|
|
|
|
2017-01-03 18:08:02 +00:00
|
|
|
bool IsFogBoundary(sector_t *front, sector_t *back) const;
|
|
|
|
bool SkyboxCompare(sector_t *frontsector, sector_t *backsector) const;
|
2017-01-03 17:57:48 +00:00
|
|
|
|
2017-02-11 19:01:23 +00:00
|
|
|
bool IsInvisibleLine() const;
|
|
|
|
bool IsDoorClosed() const;
|
|
|
|
bool IsSolid() const;
|
|
|
|
|
2017-02-11 17:52:49 +00:00
|
|
|
bool ShouldMarkFloor() const;
|
|
|
|
bool ShouldMarkCeiling() const;
|
|
|
|
bool ShouldMarkPortal() const;
|
|
|
|
|
2017-02-11 17:00:02 +00:00
|
|
|
// Line variables:
|
|
|
|
|
|
|
|
subsector_t *mSubsector;
|
|
|
|
sector_t *mFrontSector;
|
|
|
|
sector_t *mBackSector;
|
|
|
|
VisiblePlane *mFloorPlane;
|
|
|
|
VisiblePlane *mCeilingPlane;
|
|
|
|
seg_t *mLineSegment;
|
2018-03-08 03:05:35 +00:00
|
|
|
Fake3DOpaque m3DFloor;
|
2017-02-11 17:00:02 +00:00
|
|
|
|
|
|
|
double mBackCeilingZ1;
|
|
|
|
double mBackCeilingZ2;
|
|
|
|
double mBackFloorZ1;
|
|
|
|
double mBackFloorZ2;
|
|
|
|
double mFrontCeilingZ1;
|
|
|
|
double mFrontCeilingZ2;
|
|
|
|
double mFrontFloorZ1;
|
|
|
|
double mFrontFloorZ2;
|
|
|
|
|
|
|
|
bool mDoorClosed;
|
2017-01-03 17:57:48 +00:00
|
|
|
|
|
|
|
FWallCoords WallC;
|
|
|
|
FWallTmapVals WallT;
|
|
|
|
|
2017-02-11 17:00:02 +00:00
|
|
|
bool foggy;
|
|
|
|
FDynamicColormap *basecolormap;
|
|
|
|
|
|
|
|
// Wall segment variables:
|
2017-01-03 17:57:48 +00:00
|
|
|
|
|
|
|
bool rw_prepped;
|
|
|
|
|
2017-02-11 17:00:02 +00:00
|
|
|
int wallshade;
|
2017-01-03 17:57:48 +00:00
|
|
|
float rw_lightstep;
|
|
|
|
float rw_lightleft;
|
|
|
|
|
2017-02-11 17:00:02 +00:00
|
|
|
double lwallscale;
|
2017-01-03 17:57:48 +00:00
|
|
|
|
|
|
|
bool markfloor; // False if the back side is the same plane.
|
|
|
|
bool markceiling;
|
2017-02-12 05:17:38 +00:00
|
|
|
|
|
|
|
WallPartTexture mTopPart;
|
|
|
|
WallPartTexture mMiddlePart;
|
|
|
|
WallPartTexture mBottomPart;
|
2017-01-12 19:13:21 +00:00
|
|
|
|
2017-02-11 17:00:02 +00:00
|
|
|
ProjectedWallCull mCeilingClipped;
|
|
|
|
ProjectedWallCull mFloorClipped;
|
2017-01-24 06:06:47 +00:00
|
|
|
|
|
|
|
ProjectedWallLine walltop;
|
|
|
|
ProjectedWallLine wallbottom;
|
|
|
|
ProjectedWallLine wallupper;
|
|
|
|
ProjectedWallLine walllower;
|
|
|
|
ProjectedWallTexcoords walltexcoords;
|
2017-02-04 14:51:54 +00:00
|
|
|
|
|
|
|
sector_t tempsec; // killough 3/8/98: ceiling/water hack
|
2017-01-03 17:57:48 +00:00
|
|
|
};
|
2017-01-01 09:28:35 +00:00
|
|
|
}
|