mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
Fix portals draw segment indexing bug
This commit is contained in:
parent
6ed46921c8
commit
3c0d769499
4 changed files with 7 additions and 9 deletions
|
@ -71,7 +71,7 @@ namespace swrenderer
|
|||
// b) skip most of the collected drawsegs which have no portal attached.
|
||||
portaldrawsegs.Clear();
|
||||
DrawSegmentList *drawseglist = Thread->DrawSegments.get();
|
||||
for (auto index = drawseglist->BeginIndex(); index != drawseglist->EndIndex(); index++)
|
||||
for (auto index = 0; index != drawseglist->SegmentsCount(); index++)
|
||||
{
|
||||
DrawSegment *seg = drawseglist->Segment(index);
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
DrawSegmentList *drawseglist = Thread->DrawSegments.get();
|
||||
for (auto index = drawseglist->BeginIndex(); index != drawseglist->EndIndex(); index++)
|
||||
for (auto index = 0; index != drawseglist->SegmentsCount(); index++)
|
||||
{
|
||||
DrawSegment *ds = drawseglist->Segment(index);
|
||||
|
||||
|
|
|
@ -90,13 +90,13 @@ namespace swrenderer
|
|||
SegmentGroups.Clear();
|
||||
|
||||
unsigned int groupSize = 100;
|
||||
for (unsigned int index = BeginIndex(); index < EndIndex(); index += groupSize)
|
||||
for (unsigned int index = 0; index < SegmentsCount(); index += groupSize)
|
||||
{
|
||||
auto ds = Segment(index);
|
||||
|
||||
DrawSegmentGroup group;
|
||||
group.BeginIndex = index;
|
||||
group.EndIndex = MIN(index + groupSize, EndIndex());
|
||||
group.EndIndex = MIN(index + groupSize, SegmentsCount());
|
||||
group.x1 = ds->x1;
|
||||
group.x2 = ds->x2;
|
||||
group.neardepth = MIN(ds->sz1, ds->sz2);
|
||||
|
|
|
@ -64,12 +64,10 @@ namespace swrenderer
|
|||
|
||||
TArray<DrawSegmentGroup> SegmentGroups;
|
||||
|
||||
unsigned int BeginIndex() const { return StartIndices.Last(); }
|
||||
unsigned int EndIndex() const { return Segments.Size(); }
|
||||
unsigned int SegmentsCount() const { return Segments.Size() - StartIndices.Last(); }
|
||||
DrawSegment *Segment(unsigned int index) const { return Segments[Segments.Size() - 1 - index]; }
|
||||
|
||||
unsigned int BeginInterestingIndex() const { return StartInterestingIndices.Last(); }
|
||||
unsigned int EndInterestingIndex() const { return InterestingSegments.Size(); }
|
||||
unsigned int InterestingSegmentsCount() const { return InterestingSegments.Size() - StartInterestingIndices.Last(); }
|
||||
DrawSegment *InterestingSegment(unsigned int index) const { return InterestingSegments[InterestingSegments.Size() - 1 - index]; }
|
||||
|
||||
void Clear();
|
||||
|
|
|
@ -267,7 +267,7 @@ namespace swrenderer
|
|||
// Draw any masked textures behind this particle so that when the
|
||||
// particle is drawn, it will be in front of them.
|
||||
DrawSegmentList *segmentlist = thread->DrawSegments.get();
|
||||
for (unsigned int index = segmentlist->BeginInterestingIndex(); index != segmentlist->EndInterestingIndex(); index++)
|
||||
for (unsigned int index = 0; index != segmentlist->InterestingSegmentsCount(); index++)
|
||||
{
|
||||
DrawSegment *ds = segmentlist->InterestingSegment(index);
|
||||
|
||||
|
|
Loading…
Reference in a new issue