Graf Zahl wrote:So why is this "suspicious"?
The suspicious part is the full logic in the software renderer, which looks like this:
Code: Select all
bool SWRenderLine::IsSolid() const
{
// One sided
if (mBackSector == nullptr) return true;
// Portal
if (mLineSegment->linedef->isVisualPortal() && mLineSegment->sidedef == mLineSegment->linedef->sidedef[0]) return true;
// Closed door
if (mBackCeilingZ1 <= mFrontFloorZ1 && mBackCeilingZ2 <= mFrontFloorZ2) return true;
if (mBackFloorZ1 >= mFrontCeilingZ1 && mBackFloorZ2 >= mFrontCeilingZ2) return true;
if (IsDoorClosed()) return true;
return false;
}
bool SWRenderLine::IsDoorClosed() const
{
if (!mBackSector) return false;
// Portal
if (mLineSegment->linedef->isVisualPortal() && mLineSegment->sidedef == mLineSegment->linedef->sidedef[0]) return false;
// Closed door.
if (mBackCeilingZ1 <= mFrontFloorZ1 && mBackCeilingZ2 <= mFrontFloorZ2) return false;
if (mBackFloorZ1 >= mFrontCeilingZ1 && mBackFloorZ2 >= mFrontCeilingZ2) return false;
...
}
Notice that the checks are inverted in IsDoorClosed vs the checks in IsSolid. Now, the checks in IsSolid wins because they are made first, but this strongly indicates something is rotten in the IsDoorClosed version. I don't dare fully change/fix IsDoorClosed though because other parts of the software renderer calls that one directly and I'm not sure what I might break (or fix) by making this change.
Regarding softpoly in general, since I've been working on abstracting the hardware renderer from the actual backing implementation, wouldn't it make sense to make softpoly just another backend to that instead of completely reinventing the wheel top to bottom? I think it could actually be cut down to the rasterization stuff if that was feasible and on the upside inherit all the render hack handling that is already there.
Sure, that would work and is probably a good idea long in the long run. The main catch is mostly that the hardware renderer is able to brute force itself through some of the rendering where softpoly may need a little help. Mostly that overdraw is far more expensive for softpoly as its drawers are pretty slow when compared to a GPU.