1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-03 18:14:01 +00:00

undo parts of prev commits; move old fudge from font atlas code to tile rendering.

this should now be correct and much simpler to maintain from now on.
downside is that it breaks the appearance of quads with tex repeat on,
but i don't think anyone ever used this ever since i've added the Lua functions;
so i'm just calling it broken in older versions and move on.
This commit is contained in:
fgenesis 2023-10-20 02:04:21 +02:00
parent b33080b0ea
commit f1796475f1
4 changed files with 8 additions and 21 deletions

View file

@ -3528,10 +3528,6 @@ bool DSQ::loadTileset(std::string pack, const unsigned char *usedIdx, size_t use
et->tc.u2 = et->tc.u1 + cell;
et->tc.v2 = et->tc.v1 + cell;
/*et->tc.v2 = 1 - et->tc.v2;
et->tc.v1 = 1 - et->tc.v1;
std::swap(et->tc.v1,et->tc.v2);*/
et->w = 512*cell;
et->h = 512*cell;

View file

@ -43,21 +43,6 @@ void TexCoordBox::setStandard()
v2 = 1;
}
void TexCoordBox::fixflip()
{
// HACK: partially repeated textures have a weird Y axis. assuming a repeat factor of 0.4,
// instead of texcoords from 0 -> 0.4 everything is biased towards the opposite end, ie. 0.6 -> 1.
// This is especially true for partial repeats, we always need to bias towards the other end.
// I have no idea why this has to be like this for tiles, but this is NOT the case for fonts.
// And NOTE: without this, maps may look deceivingly correct, but they really are not.
const float percentY = v2 - v1;
const float remainder = 1.0f - fmodf(percentY, 1.0f);
v1 += remainder; // bias towards next int
v2 += remainder;
}
Texture::Texture()
{
gltexid = 0;

View file

@ -31,7 +31,6 @@ struct TexCoordBox
bool isStandard() const;
void setStandard();
void fixflip(); // call this after setting up, in case flip is desired
};
enum TextureLoadResult

View file

@ -630,7 +630,14 @@ TexCoordBox TileRepeatData::calcTexCoords(const TileData& t) const
tc.v1 = texOffY;
tc.u2 = (et.w*t.scalex*texscaleX)/tw + texOffX;
tc.v2 = (et.h*t.scaley*texscaleY)/th + texOffY;
//tc.fixflip();
// HACK: partially repeated textures have a weird Y axis. assuming a repeat factor of 0.4,
// instead of texcoords from 0 -> 0.4 everything is biased towards the opposite end, ie. 0.6 -> 1.
// This is especially true for partial repeats, we always need to bias towards the other end.
// And NOTE: without this, maps may look deceivingly correct, but they really are not.
tc.v2 = 1 - tc.v2;
tc.v1 = 1 - tc.v1;
std::swap(tc.v1, tc.v2);
return tc;
}