- use floats for sprite depth sorting in the hardware renderer.

Fixed point is clearly insufficient here.

# Conflicts:
#	src/hwrenderer/scene/hw_drawlist.cpp
#	src/hwrenderer/scene/hw_drawstructs.h

# Conflicts:
#	src/hwrenderer/scene/hw_drawlist.cpp
#	src/hwrenderer/scene/hw_sprites.cpp
This commit is contained in:
Christoph Oelckers 2020-02-15 09:22:30 +01:00 committed by drfrag
parent 2d1e19dc4b
commit 462368b61d
3 changed files with 7 additions and 8 deletions

View file

@ -602,10 +602,9 @@ inline int GLDrawList::CompareSprites(SortNode * a,SortNode * b)
GLSprite * s1=&sprites[drawitems[a->itemindex].index];
GLSprite * s2=&sprites[drawitems[b->itemindex].index];
int res = s1->depth - s2->depth;
if (res != 0) return -res;
else return (i_compatflags & COMPATF_SPRITESORT)? s2->index-s1->index : s1->index-s2->index;
if (s1->depth < s2->depth) return 1;
if (s1->depth > s2->depth) return -1;
return (i_compatflags & COMPATF_SPRITESORT)? s2->index-s1->index : s1->index-s2->index;
}
//==========================================================================

View file

@ -952,7 +952,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
gltexture = NULL;
}
depth = FloatToFixed((x - r_viewpoint.Pos.X) * r_viewpoint.TanCos + (y - r_viewpoint.Pos.Y) * r_viewpoint.TanSin);
depth = (float)((x - r_viewpoint.Pos.X) * r_viewpoint.TanCos + (y - r_viewpoint.Pos.Y) * r_viewpoint.TanSin);
// light calculation

View file

@ -374,7 +374,7 @@ public:
int translation;
int index;
int depth;
float depth;
float topclip;
float bottomclip;
@ -385,15 +385,15 @@ public:
float vt,vb;
float x1,y1,z1;
float x2,y2,z2;
float trans;
int dynlightindex;
FMaterial *gltexture;
float trans;
AActor * actor;
particle_t * particle;
TArray<lightlist_t> *lightlist;
DRotator Angles;
int dynlightindex;
void SplitSprite(sector_t * frontsector, bool translucent);
void SetLowerParam();