From 2c655322c3aaa82a93c2c0a993aec518540a6b9d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Jun 2018 11:21:32 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=A6=20and=20in=20gl=5Fsprites.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gl/scene/gl_sprite.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index cc988ec730..cfdbbdae73 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -79,6 +79,7 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass) bool additivefog = false; bool foglayer = false; int rel = sprite->fullbright? 0 : getExtraLight(); + auto &vp = r_viewpoint; if (pass==GLPASS_TRANSLUCENT) { @@ -112,7 +113,7 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass) // fog + fuzz don't work well without some fiddling with the alpha value! if (!sprite->Colormap.FadeColor.isBlack()) { - float dist=Dist2(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, sprite->x, sprite->y); + float dist=Dist2(vp.Pos.X, vp.Pos.Y, sprite->x, sprite->y); int fogd = hw_GetFogDensity(sprite->lightlevel, sprite->Colormap.FadeColor, sprite->Colormap.FogDensity); // this value was determined by trial and error and is scale dependent! @@ -221,7 +222,7 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass) secplane_t *lowplane = i == (*lightlist).Size() - 1 ? &bottomp : &(*lightlist)[i + 1].plane; int thislight = (*lightlist)[i].caster != nullptr ? hw_ClampLight(*(*lightlist)[i].p_lightlevel) : sprite->lightlevel; - int thisll = sprite->actor == nullptr? thislight : (uint8_t)sprite->actor->Sector->CheckSpriteGlow(thislight, sprite->actor->InterpolatedPosition(r_viewpoint.TicFrac)); + int thisll = sprite->actor == nullptr? thislight : (uint8_t)sprite->actor->Sector->CheckSpriteGlow(thislight, sprite->actor->InterpolatedPosition(vp.TicFrac)); FColormap thiscm; thiscm.CopyFog(sprite->Colormap); @@ -249,7 +250,8 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass) FVector3 v[4]; gl_RenderState.SetNormal(0, 0, 0); - if (sprite->CalculateVertices(this, v)) + + if (sprite->CalculateVertices(this, v, &vp.Pos)) { glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.0f, -128.0f); @@ -277,7 +279,7 @@ void FDrawInfo::DrawSprite(GLSprite *sprite, int pass) else { FGLModelRenderer renderer(sprite->dynlightindex); - renderer.RenderModel(sprite->x, sprite->y, sprite->z, sprite->modelframe, sprite->actor, r_viewpoint.TicFrac); + renderer.RenderModel(sprite->x, sprite->y, sprite->z, sprite->modelframe, sprite->actor, vp.TicFrac); } }