2021-03-18 12:32:31 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "basics.h"
|
|
|
|
|
2021-03-18 17:18:03 +01:00
|
|
|
struct HWDrawInfo;
|
2021-03-18 12:32:31 +01:00
|
|
|
class Clipper;
|
|
|
|
|
|
|
|
struct FBunch
|
|
|
|
{
|
|
|
|
int sectnum;
|
|
|
|
int startline;
|
|
|
|
int endline;
|
2021-04-06 19:25:40 +02:00
|
|
|
bool portal;
|
2021-04-07 16:09:25 +02:00
|
|
|
binangle startangle;
|
2021-03-22 23:40:25 +01:00
|
|
|
binangle endangle;
|
2021-03-18 12:32:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class BunchDrawer
|
|
|
|
{
|
2021-03-18 17:18:03 +01:00
|
|
|
HWDrawInfo *di;
|
2021-03-18 12:32:31 +01:00
|
|
|
Clipper *clipper;
|
|
|
|
int LastBunch;
|
|
|
|
int StartTime;
|
|
|
|
TArray<FBunch> Bunches;
|
|
|
|
TArray<int> CompareData;
|
|
|
|
double viewx, viewy;
|
2021-03-25 23:16:32 +01:00
|
|
|
vec2_t iview;
|
|
|
|
float gcosang, gsinang;
|
2021-03-18 12:32:31 +01:00
|
|
|
FixedBitArray<MAXSECTORS> gotsector;
|
2021-05-03 00:15:09 +02:00
|
|
|
FixedBitArray<MAXSECTORS*5/4> gotsection2;
|
2021-04-07 00:02:36 +02:00
|
|
|
FixedBitArray<MAXWALLS> gotwall;
|
2021-04-24 20:00:54 +02:00
|
|
|
FixedBitArray<MAXWALLS> blockwall;
|
2021-05-14 10:50:22 +02:00
|
|
|
binangle ang1, ang2, angrange;
|
2021-03-18 12:32:31 +01:00
|
|
|
|
2021-05-03 00:15:09 +02:00
|
|
|
int sectionstartang[MAXSECTORS*5/4], sectionendang[MAXSECTORS*5/4];
|
2021-04-24 12:08:38 +02:00
|
|
|
|
2021-03-18 12:32:31 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CL_Skip = 0,
|
|
|
|
CL_Draw = 1,
|
|
|
|
CL_Pass = 2,
|
|
|
|
};
|
|
|
|
|
2021-05-14 10:50:22 +02:00
|
|
|
binangle ClipAngle(int wal) { return wall[wal].clipangle - ang1; }
|
2021-03-18 12:32:31 +01:00
|
|
|
void StartScene();
|
2021-04-07 16:09:25 +02:00
|
|
|
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
|
|
|
|
bool AddLineToBunch(int line, binangle newan);
|
2021-03-18 12:32:31 +01:00
|
|
|
void DeleteBunch(int index);
|
|
|
|
bool CheckClip(walltype* wal);
|
2021-04-06 19:25:40 +02:00
|
|
|
int ClipLine(int line, bool portal);
|
2021-03-18 12:32:31 +01:00
|
|
|
void ProcessBunch(int bnch);
|
|
|
|
int WallInFront(int wall1, int wall2);
|
2021-05-21 14:31:12 +02:00
|
|
|
int ColinearBunchInFront(FBunch* b1, FBunch* b2);
|
2021-03-18 12:32:31 +01:00
|
|
|
int BunchInFront(FBunch* b1, FBunch* b2);
|
|
|
|
int FindClosestBunch();
|
2021-05-03 00:15:09 +02:00
|
|
|
void ProcessSection(int sectnum, bool portal);
|
2021-03-18 12:32:31 +01:00
|
|
|
|
|
|
|
public:
|
2021-04-07 00:02:36 +02:00
|
|
|
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, binangle a1, binangle a2);
|
2021-04-06 19:25:40 +02:00
|
|
|
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
|
2021-04-01 20:47:05 +02:00
|
|
|
const FixedBitArray<MAXSECTORS>& GotSector() const { return gotsector; }
|
2021-03-18 12:32:31 +01:00
|
|
|
};
|