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
|
|
|
|
{
|
2021-12-02 00:01:45 +01:00
|
|
|
int sectornum;
|
2021-03-18 12:32:31 +01:00
|
|
|
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-12-06 20:08:32 +01:00
|
|
|
BitArray gotsector;
|
2021-12-06 20:54:21 +01:00
|
|
|
BitArray gotsection2;
|
2021-11-21 00:03:56 +01:00
|
|
|
BitArray gotwall;
|
|
|
|
BitArray blockwall;
|
2021-05-14 10:50:22 +02:00
|
|
|
binangle ang1, ang2, angrange;
|
2021-12-19 18:53:53 +01:00
|
|
|
float viewz;
|
2021-03-18 12:32:31 +01:00
|
|
|
|
2021-12-06 20:54:21 +01:00
|
|
|
TArray<int> sectionstartang, sectionendang;
|
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);
|
2021-12-19 18:53:53 +01:00
|
|
|
bool CheckClip(walltype* wal, float* topclip, float* bottomclip);
|
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-12-06 20:08:32 +01:00
|
|
|
const BitArray& GotSector() const { return gotsector; }
|
2021-03-18 12:32:31 +01:00
|
|
|
};
|