mirror of
https://github.com/DrBeef/Raze.git
synced 2024-12-03 09:32:19 +00:00
be08a2f800
* let the clipper work on relative angles to simplify the math. * properly initialize the initial visible range and preserve it for multiple invocations. * track the maximum visible angular range per sector. While possibly not sufficient to handle every edge case imaginable it has low overhead and is still useful to eliminate obvious cases that do not need more complex checks. It is enough to fix the blue door in Duke E3L4. * removed unused elements of the clipper.
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "tarray.h"
|
|
#include "basics.h"
|
|
|
|
struct HWDrawInfo;
|
|
class Clipper;
|
|
|
|
struct FBunch
|
|
{
|
|
int sectnum;
|
|
int startline;
|
|
int endline;
|
|
bool portal;
|
|
binangle startangle;
|
|
binangle endangle;
|
|
};
|
|
|
|
class BunchDrawer
|
|
{
|
|
HWDrawInfo *di;
|
|
Clipper *clipper;
|
|
int LastBunch;
|
|
int StartTime;
|
|
TArray<FBunch> Bunches;
|
|
TArray<int> CompareData;
|
|
double viewx, viewy;
|
|
vec2_t iview;
|
|
float gcosang, gsinang;
|
|
FixedBitArray<MAXSECTORS> gotsector;
|
|
FixedBitArray<MAXSECTORS> gotsector2;
|
|
FixedBitArray<MAXWALLS> gotwall;
|
|
binangle ang1, ang2;
|
|
|
|
int sectstartang[MAXSECTORS], sectendang[MAXSECTORS];
|
|
|
|
private:
|
|
|
|
enum
|
|
{
|
|
CL_Skip = 0,
|
|
CL_Draw = 1,
|
|
CL_Pass = 2,
|
|
};
|
|
|
|
void StartScene();
|
|
bool StartBunch(int sectnum, int linenum, binangle startan, binangle endan, bool portal);
|
|
bool AddLineToBunch(int line, binangle newan);
|
|
void DeleteBunch(int index);
|
|
bool CheckClip(walltype* wal);
|
|
int ClipLine(int line, bool portal);
|
|
void ProcessBunch(int bnch);
|
|
int WallInFront(int wall1, int wall2);
|
|
int BunchInFront(FBunch* b1, FBunch* b2);
|
|
int FindClosestBunch();
|
|
void ProcessSector(int sectnum, bool portal);
|
|
|
|
public:
|
|
void Init(HWDrawInfo* _di, Clipper* c, vec2_t& view, binangle a1, binangle a2);
|
|
void RenderScene(const int* viewsectors, unsigned sectcount, bool portal);
|
|
const FixedBitArray<MAXSECTORS>& GotSector() const { return gotsector; }
|
|
};
|