From cc52f893728b0b4eedacda7cf6ef26cc3618c3bc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 Dec 2018 12:05:28 +0100 Subject: [PATCH] - fixed: For non-persistent buffers, sprite vertices need to be recalculated in the splitter code of the translucent sorter. --- src/hwrenderer/scene/hw_drawlist.cpp | 14 ++++++++++++-- src/hwrenderer/scene/hw_drawlist.h | 2 +- src/hwrenderer/scene/hw_sprites.cpp | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/hwrenderer/scene/hw_drawlist.cpp b/src/hwrenderer/scene/hw_drawlist.cpp index 067c5dee5f..0cf6a8010f 100644 --- a/src/hwrenderer/scene/hw_drawlist.cpp +++ b/src/hwrenderer/scene/hw_drawlist.cpp @@ -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)); } -void HWDrawList::SortSpriteIntoWall(SortNode * head,SortNode * sort) +void HWDrawList::SortSpriteIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sort) { GLWall *wh= walls[drawitems[head->itemindex].index]; GLSprite * ss= sprites[drawitems[sort->itemindex].index]; @@ -560,6 +560,16 @@ void HWDrawList::SortSpriteIntoWall(SortNode * head,SortNode * sort) head->AddToLeft(sort); 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; case GLDIT_SPRITE: - SortSpriteIntoWall(head,node); + SortSpriteIntoWall(di, head, node); break; case GLDIT_FLAT: break; diff --git a/src/hwrenderer/scene/hw_drawlist.h b/src/hwrenderer/scene/hw_drawlist.h index 303da06fb9..66ae468ed0 100644 --- a/src/hwrenderer/scene/hw_drawlist.h +++ b/src/hwrenderer/scene/hw_drawlist.h @@ -101,7 +101,7 @@ public: void SortWallIntoPlane(SortNode * head,SortNode * sort); void SortSpriteIntoPlane(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); SortNode * SortSpriteList(SortNode * head); SortNode * DoSort(HWDrawInfo *di, SortNode * head); diff --git a/src/hwrenderer/scene/hw_sprites.cpp b/src/hwrenderer/scene/hw_sprites.cpp index c3911b4601..f8c716686a 100644 --- a/src/hwrenderer/scene/hw_sprites.cpp +++ b/src/hwrenderer/scene/hw_sprites.cpp @@ -244,6 +244,7 @@ void GLSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent) { state.SetNormal(0, 0, 0); + if (screen->BuffersArePersistent()) { CreateVertices(di);