mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-15 04:14:41 +00:00
Worldmap overhaul, part 1
In short: - No more grid-for-alpha; everything uses generated textures now (With proper bilinear filtering so it looks like the old method) - All tiles are now shown partially uncovered at the same time; selecting one is no longer needed - Gems can now be local (associated to a tile) or global. Local games move with their tile, global ones stay where they were placed Background: Originally there were two possible implementations of how to render the world map: - One used write-alpha-to-texture to implement graual uncovering. - The other (permanently enabled) used the DrawGrid to render the map tiles as a fine grid, each little square having its own alpha value The downside of the first method was that it didn't look as good as the second, so i guess that's why it was never fully finished. The main downside of the second method was that it burned a lot of vertices just to do alpha, so only one tile at a time could show the detailed grid. I also never liked how an entire tile was effectively fully uncovered once the map was first entered, taking away a lot of the exploration feeling that could have been there if everything that hasn't been explored would be completely invisible. I've added this worldmap uncovering method as an optional config param, <WorldMap revealMethod="1"/> but i've decided to fully switch over now. Things left to be done: - create a WorldMapRender instance only once and keep the tiles across map loads - add debug option to reload/recreate worldmap at runtime - cleanup gem storage and carry over the player gem properly (ged rid of std::list) - remove "worldmap" grid render type - Add more user "pyramid" gems as world map markers. More colors! - check that gems and beacons still work as they should
This commit is contained in:
parent
97cea29235
commit
c44c67a063
19 changed files with 811 additions and 717 deletions
|
@ -100,11 +100,7 @@ void Texture::unload()
|
|||
glDeleteTextures(1, &gltexid);
|
||||
gltexid = 0;
|
||||
}
|
||||
if(_pixbuf)
|
||||
{
|
||||
free(_pixbuf);
|
||||
_pixbuf = NULL;
|
||||
}
|
||||
_freePixbuf();
|
||||
}
|
||||
|
||||
size_t Texture::sizeBytes() const
|
||||
|
@ -112,6 +108,26 @@ size_t Texture::sizeBytes() const
|
|||
return size_t(width) * size_t(height) * 4;
|
||||
}
|
||||
|
||||
bool Texture::uploadAndKeep(ImageData& img, bool mipmap)
|
||||
{
|
||||
bool ok = upload(img, mipmap); // this also clears pixbuf
|
||||
if(ok)
|
||||
{
|
||||
_pixbuf = img.pixels;
|
||||
img.pixels = NULL;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void Texture::_freePixbuf()
|
||||
{
|
||||
if(_pixbuf)
|
||||
{
|
||||
free(_pixbuf);
|
||||
_pixbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Texture::apply() const
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, gltexid);
|
||||
|
@ -223,6 +239,8 @@ bool Texture::upload(const ImageData& img, bool mipmap)
|
|||
|
||||
width = img.w;
|
||||
height = img.h;
|
||||
_mipmap = mipmap;
|
||||
_freePixbuf();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue