mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- fixed cases of small textures being used for the sky.
Case in Point: DukeDC uses a 64x64 texture with palette remap for the sky.
This commit is contained in:
parent
6fcb6fa1d5
commit
4647a0b2bc
4 changed files with 16 additions and 6 deletions
|
@ -37,7 +37,7 @@ static_assert(sizeof(vec3d_t) == sizeof(double) * 3);
|
|||
|
||||
|
||||
int skiptile = -1;
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap);
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap, int remap = 0);
|
||||
|
||||
int checkTranslucentReplacement(FTextureID picnum, int pal);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "cmdlib.h"
|
||||
|
||||
CVAR(Bool,gl_noskyboxes, false, 0)
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap);
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap, int remap);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -49,8 +49,11 @@ void initSkyInfo(HWDrawInfo *di, HWSkyInfo* sky, sectortype* sector, int plane,
|
|||
// todo: check for skybox replacement.
|
||||
if (!skytex)
|
||||
{
|
||||
int palette = plane == plane_ceiling ? sector->ceilingpal : sector->floorpal;
|
||||
int remap = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||
|
||||
int16_t const* dapskyoff = getpsky(picnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
|
||||
skytex = GetSkyTexture(picnum, dapskybits, dapskyoff);
|
||||
skytex = GetSkyTexture(picnum, dapskybits, dapskyoff, remap);
|
||||
realskybits = dapskybits;
|
||||
if (skytex) dapskybits = 0;
|
||||
else skytex = tileGetTexture(picnum);
|
||||
|
|
|
@ -67,12 +67,18 @@ void HWSkyPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
|
|||
auto& textureMatrix = state.mTextureMatrix;
|
||||
auto texskyoffset = tex->GetSkyOffset() + origin->y_offset + skyoffsettest;
|
||||
|
||||
int repeat_fac = 1;
|
||||
if (texh <= 192)
|
||||
{
|
||||
repeat_fac = 384 / texh;
|
||||
texh *= repeat_fac;
|
||||
}
|
||||
modelMatrix.loadIdentity();
|
||||
modelMatrix.rotate(-180.0f + origin->x_offset, 0.f, 1.f, 0.f);
|
||||
modelMatrix.translate(0.f, -40 + texskyoffset + (tex->GetTexelHeight() - 300) / 2 * skyoffsetfactor, 0.f);
|
||||
modelMatrix.translate(0.f, -40 + texskyoffset + (texh - 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);
|
||||
textureMatrix.scale(-1.f, 0.5*repeat_fac, 1.f);
|
||||
textureMatrix.translate(1.f, 0/*origin->y_offset / texh*/, 1.f);
|
||||
vertexBuffer->RenderDome(state, origin->texture, FSkyVertexBuffer::SKYMODE_MAINLAYER);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "texturemanager.h"
|
||||
#include "buildtiles.h"
|
||||
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilemap)
|
||||
FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilemap, int remap)
|
||||
{
|
||||
char synthname[60];
|
||||
|
||||
|
@ -70,6 +70,7 @@ FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t *tilema
|
|||
if (!tex || !tex->isValid() || tex->GetTexture() == 0) return nullptr;
|
||||
build[i].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
||||
build[i].OriginX = tilewidth * i;
|
||||
build[i].Translation = GPalette.GetTranslation(GetTranslationType(remap), GetTranslationIndex(remap));
|
||||
}
|
||||
auto tt = MakeGameTexture(new FImageTexture(new FMultiPatchTexture(tilewidth*numtiles, tileHeight(basetile), build, false, false)), synthname, ETextureType::Override);
|
||||
TexMan.AddGameTexture(tt, true);
|
||||
|
|
Loading…
Reference in a new issue