Skip to content

Commit

Permalink
noggit: maptile: fix alphamap+shadow texture format for big alphamaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Adspartan committed May 24, 2024
1 parent 164d94f commit 20e017e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/noggit/MapTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,18 @@ bool MapTile::isTile(int pX, int pZ)

void MapTile::convert_alphamap(bool to_big_alpha)
{
mBigAlpha = true;
for (size_t i = 0; i < 16; i++)
if (mBigAlpha != to_big_alpha)
{
for (size_t j = 0; j < 16; j++)
mBigAlpha = to_big_alpha;
// force alphamap update
_alphamap_created = false;

for (size_t i = 0; i < 16; i++)
{
mChunks[i][j]->use_big_alphamap = to_big_alpha;
for (size_t j = 0; j < 16; j++)
{
mChunks[i][j]->use_big_alphamap = to_big_alpha;
}
}
}
}
Expand Down Expand Up @@ -1052,8 +1058,15 @@ void MapTile::create_combined_alpha_shadow_map()
}
else
{
// todo: add toggle or use GL_RGBA8 for tiles close to the camera on big alpha maps (alpha stored as 4bits otherwise)
gl.texImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB5_A1, 64, 64, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
if (mBigAlpha)
{
gl.texImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, 64, 64, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
else
{
gl.texImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB5_A1, 64, 64, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}


for (size_t i = 0; i < 16; i++)
{
Expand Down

0 comments on commit 20e017e

Please sign in to comment.