- fixed: For non-persistent buffers, sprite vertices need to be recalculated in the splitter code of the translucent sorter.

This commit is contained in:
Christoph Oelckers 2018-12-16 12:05:28 +01:00
parent 6648f4e47f
commit cc52f89372
3 changed files with 14 additions and 3 deletions

View File

@ -483,7 +483,7 @@ inline double CalcIntersectionVertex(GLSprite *s, GLWall * w2)
return ((ay - cy)*(dx - cx) - (ax - cx)*(dy - cy)) / ((bx - ax)*(dy - cy) - (by - ay)*(dx - cx)); return ((ay - cy)*(dx - cx) - (ax - cx)*(dy - cy)) / ((bx - ax)*(dy - cy) - (by - ay)*(dx - cx));
} }
void HWDrawList::SortSpriteIntoWall(SortNode * head,SortNode * sort) void HWDrawList::SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort)
{ {
GLWall *wh= walls[drawitems[head->itemindex].index]; GLWall *wh= walls[drawitems[head->itemindex].index];
GLSprite * ss= sprites[drawitems[sort->itemindex].index]; GLSprite * ss= sprites[drawitems[sort->itemindex].index];
@ -560,6 +560,16 @@ void HWDrawList::SortSpriteIntoWall(SortNode * head,SortNode * sort)
head->AddToLeft(sort); head->AddToLeft(sort);
head->AddToRight(sort2); head->AddToRight(sort2);
} }
if (screen->BuffersArePersistent())
{
s->vertexindex = ss->vertexindex = -1;
}
else
{
s->CreateVertices(di);
ss->CreateVertices(di);
}
} }
} }
@ -667,7 +677,7 @@ SortNode * HWDrawList::DoSort(HWDrawInfo *di, SortNode * head)
break; break;
case GLDIT_SPRITE: case GLDIT_SPRITE:
SortSpriteIntoWall(head,node); SortSpriteIntoWall(di, head, node);
break; break;
case GLDIT_FLAT: break; case GLDIT_FLAT: break;

View File

@ -101,7 +101,7 @@ public:
void SortWallIntoPlane(SortNode * head,SortNode * sort); void SortWallIntoPlane(SortNode * head,SortNode * sort);
void SortSpriteIntoPlane(SortNode * head,SortNode * sort); void SortSpriteIntoPlane(SortNode * head,SortNode * sort);
void SortWallIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort); void SortWallIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort);
void SortSpriteIntoWall(SortNode * head,SortNode * sort); void SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort);
int CompareSprites(SortNode * a,SortNode * b); int CompareSprites(SortNode * a,SortNode * b);
SortNode * SortSpriteList(SortNode * head); SortNode * SortSpriteList(SortNode * head);
SortNode * DoSort(HWDrawInfo *di, SortNode * head); SortNode * DoSort(HWDrawInfo *di, SortNode * head);

View File

@ -244,6 +244,7 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent)
{ {
state.SetNormal(0, 0, 0); state.SetNormal(0, 0, 0);
if (screen->BuffersArePersistent()) if (screen->BuffersArePersistent())
{ {
CreateVertices(di); CreateVertices(di);