From 6fcb6fa1d584b0d0881db5ba69936c409d34700c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 29 Mar 2021 22:34:46 +0200 Subject: [PATCH] - sky positioning tweaks. It does not use the panning info of the wall and needs a texture height relative adjustment. --- source/core/rendering/scene/hw_sky.cpp | 9 ++------- source/core/rendering/scene/hw_skyportal.cpp | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/source/core/rendering/scene/hw_sky.cpp b/source/core/rendering/scene/hw_sky.cpp index 523657396..a7792fac2 100644 --- a/source/core/rendering/scene/hw_sky.cpp +++ b/source/core/rendering/scene/hw_sky.cpp @@ -42,8 +42,6 @@ FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilema void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane, PalEntry FadeColor) { int picnum = plane == plane_ceiling ? sector->ceilingpicnum : sector->floorpicnum; - float xpanning = plane == plane_ceiling ? sector->ceilingxpan_ : sector->floorxpan_; - float ypanning = plane == plane_ceiling ? sector->ceilingypan_ : sector->floorypan_; int32_t dapyscale = 0, dapskybits = 0, dapyoffs = 0, daptileyscale = 0; FGameTexture* skytex = nullptr; @@ -58,13 +56,10 @@ void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane, else skytex = tileGetTexture(picnum); } - float t = (float)((1 << (sizeToBits(tileWidth(picnum)))) << dapskybits); - int ti = (1 << (sizeToBits(tileHeight(picnum)))); if (ti != tileHeight(picnum)) ti += ti; - // dapyscale is not relvant for a sky dome. sky->y_scale = FixedToFloat(daptileyscale); - sky->y_offset = dapyoffs*2 + (ypanning * ti / 64.f); - sky->x_offset = xpanning / (1 << (realskybits - dapskybits)); + sky->y_offset = dapyoffs*2; + sky->x_offset = 0;// xpanning / (1 << (realskybits - dapskybits)); sky->fadecolor = FadeColor; sky->shade = 0;// clamp(plane == plane_ceiling ? sector->ceilingshade : sector->floorshade, 0, numshades - 1); sky->texture = skytex; diff --git a/source/core/rendering/scene/hw_skyportal.cpp b/source/core/rendering/scene/hw_skyportal.cpp index 4b2c5d862..1bb5f382e 100644 --- a/source/core/rendering/scene/hw_skyportal.cpp +++ b/source/core/rendering/scene/hw_skyportal.cpp @@ -69,7 +69,7 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state) modelMatrix.loadIdentity(); modelMatrix.rotate(-180.0f + origin->x_offset, 0.f, 1.f, 0.f); - modelMatrix.translate(0.f, (-40 + texskyoffset) * skyoffsetfactor, 0.f); + modelMatrix.translate(0.f, -40 + texskyoffset + (tex->GetTexelHeight() - 300) / 2 * skyoffsetfactor, 0.f); //modelMatrix.scale(1.f, 0.8f * 1.17f, 1.f); textureMatrix.loadIdentity(); textureMatrix.scale(-1.f, 0.5, 1.f);