Convert r_clipsegment into a class

This commit is contained in:
Magnus Norddahl 2017-01-15 22:57:42 +01:00
commit f6cc75fad5
6 changed files with 33 additions and 23 deletions

View file

@ -17,8 +17,23 @@ namespace swrenderer
{
typedef bool(*VisibleSegmentCallback)(int x1, int x2);
void R_ClearClipSegs(short left, short right);
bool R_ClipWallSegment(int x1, int x2, bool solid, VisibleSegmentCallback callback);
bool R_CheckClipWallSegment(int first, int last);
bool R_IsWallSegmentVisible(int x1, int x2);
class RenderClipSegment
{
public:
static RenderClipSegment *Instance();
void Clear(short left, short right);
bool Clip(int x1, int x2, bool solid, VisibleSegmentCallback callback);
bool Check(int first, int last);
bool IsVisible(int x1, int x2);
private:
struct cliprange_t
{
short first, last;
};
cliprange_t *newend; // newend is one past the last valid seg
cliprange_t solidsegs[MAXWIDTH / 2 + 2];
};
}