mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
- ClipWindow WIP
This commit is contained in:
parent
4364e68d05
commit
362b824775
1 changed files with 32 additions and 0 deletions
|
@ -8,6 +8,38 @@
|
|||
#include "binaryangle.h"
|
||||
#include "intvec.h"
|
||||
|
||||
class ClipWindow
|
||||
{
|
||||
FVector2 left, right; // left and right edge of the window in 2D
|
||||
FAngle leftang, rightang; // view angles of the window edges
|
||||
Plane planes[2]; // top and bottom plane of the window
|
||||
|
||||
// The inside is behind the plane defined by p1 - p4, the sides are defined by p0, pn and pn+1 respectively.
|
||||
// p1 is lower left, p2 upper left, p3 upper right and p4 lower right.
|
||||
void build(const FVector3& p0, const FVector3& p1, const FVector3& p2, const FVector3& p3, const FVector3& p4, DAngle la, DAngle ra)
|
||||
{
|
||||
left = p1.XY();
|
||||
right = p4.XY();
|
||||
planes[0].Init(p0, p2, p3); // top plane - must point inside.
|
||||
planes[1].Init(p0, p4, p1); // bottom plane - must point inside.
|
||||
}
|
||||
|
||||
bool polyInWindow(const TArrayView<FVector3>& points)
|
||||
{
|
||||
for (auto& plane : planes)
|
||||
{
|
||||
for (auto& point : points)
|
||||
{
|
||||
if (!plane.PointOnSide(point)) goto nextplane; // Too bad that C++ still has no option to continue an outer loop from here...
|
||||
}
|
||||
return false;
|
||||
nextplane:;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ClipNode
|
||||
{
|
||||
friend class Clipper;
|
||||
|
|
Loading…
Reference in a new issue