- changed the stencil cap drawer to only cover the area which is actually used by the portal.
This will now both exclude floor caps when only ceiling elements are used and everything outside the bounding box of active portal lines. Hopefully this is enough to fix the issues with portal caps but of course it is not foolproof if someone just makes the right setup.
This commit is contained in:
parent
a23d1c2d25
commit
9f6091519f
7 changed files with 83 additions and 24 deletions
|
|
@ -495,9 +495,9 @@ public:
|
|||
auto §ion = sections[i];
|
||||
auto &work = triangles[i];
|
||||
|
||||
BoundingRect bounds = { 1e32, 1e32, -1e32, -1e32 };
|
||||
BoundingRect loopBounds = { 1e32, 1e32, -1e32, -1e32 };
|
||||
BoundingRect outermostBounds = { 1e32, 1e32, -1e32, -1e32 };
|
||||
BoundingRect bounds(false);
|
||||
BoundingRect loopBounds(false);
|
||||
BoundingRect outermostBounds(false);
|
||||
unsigned outermoststart = ~0u;
|
||||
unsigned loopstart = 0;
|
||||
bool ispolyorg = false;
|
||||
|
|
@ -519,7 +519,7 @@ public:
|
|||
outermoststart = loopstart;
|
||||
loopstart = i + 1;
|
||||
}
|
||||
loopBounds = { 1e32, 1e32, -1e32, -1e32 };
|
||||
loopBounds.setEmpty();
|
||||
}
|
||||
}
|
||||
work.boundingLoopStart = outermoststart;
|
||||
|
|
@ -716,7 +716,7 @@ public:
|
|||
dest.subsectors.Set(&output.allSubsectors[numsubsectors], group.subsectors.Size());
|
||||
dest.vertexindex = -1;
|
||||
dest.vertexcount = 0;
|
||||
dest.bounds = {1e32, 1e32, -1e32, -1e32};
|
||||
dest.bounds.setEmpty();
|
||||
numsegments += group.segments.Size();
|
||||
|
||||
if (output.firstSectionForSectorPtr[dest.sector->Index()] == -1)
|
||||
|
|
|
|||
|
|
@ -25,12 +25,35 @@ struct BoundingRect
|
|||
{
|
||||
double left, top, right, bottom;
|
||||
|
||||
bool contains(const BoundingRect & other)
|
||||
BoundingRect() = default;
|
||||
BoundingRect(bool)
|
||||
{
|
||||
setEmpty();
|
||||
}
|
||||
|
||||
void setEmpty()
|
||||
{
|
||||
left = top = 1e38;
|
||||
bottom = right = -1e38;
|
||||
}
|
||||
|
||||
bool contains(const BoundingRect & other) const
|
||||
{
|
||||
return left <= other.left && top <= other.top && right >= other.right && bottom >= other.bottom;
|
||||
}
|
||||
|
||||
bool intersects(const BoundingRect & other)
|
||||
bool contains(double x, double y) const
|
||||
{
|
||||
return left <= x && top <= y && right >= x && bottom >= y;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool contains(const T &vec) const
|
||||
{
|
||||
return left <= vec.X && top <= vec.Y && right >= vec.X && bottom >= vec.Y;
|
||||
}
|
||||
|
||||
bool intersects(const BoundingRect & other) const
|
||||
{
|
||||
return !(other.left > right ||
|
||||
other.right < left ||
|
||||
|
|
@ -46,7 +69,7 @@ struct BoundingRect
|
|||
if (other.bottom > bottom) bottom = other.bottom;
|
||||
}
|
||||
|
||||
double distanceTo(const BoundingRect &other)
|
||||
double distanceTo(const BoundingRect &other) const
|
||||
{
|
||||
if (intersects(other)) return 0;
|
||||
return std::max(std::min(fabs(left - other.right), fabs(right - other.left)),
|
||||
|
|
@ -61,10 +84,11 @@ struct BoundingRect
|
|||
if (y > bottom) bottom = y;
|
||||
}
|
||||
|
||||
bool operator == (const BoundingRect &other)
|
||||
bool operator == (const BoundingRect &other) const
|
||||
{
|
||||
return left == other.left && top == other.top && right == other.right && bottom == other.bottom;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue