Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable mipmapping with image_cache #177

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configs/init.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ performance gains.
[BITMAP_HOLDS:4096]

Stonesense will try to merge all loaded sprites into a single texture, for performance reasons.
if your videocard has low memory, you may want to disable this.
if your videocard has low memory, you may want to disable this. Enabling this feature
will disable mipmapping to prevent sprites from going transparent when zooming out.
[CACHE_IMAGES:NO]

This sets the preferred size of the internal image cache. If your videocard does not support it,
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Template for new versions:
- `stonesense`: fixed glass cabinets and bookcases being misaligned by 1 pixel
- `stonesense`: vampires no longer show their true name when they shouldn't.
- `stonesense`: fixed debug performance timers to show milliseconds as intended
- `stonesense`: ``CACHE_IMAGES`` now disables mipmapping, stopping sprites from going transparent


## Misc Improvements
Expand Down
7 changes: 6 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,12 @@ static void* stonesense_thread(ALLEGRO_THREAD* main_thread, void* parms)
if(ssConfig.config.software) {
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP|_ALLEGRO_ALPHA_TEST|ALLEGRO_MIN_LINEAR|ALLEGRO_MIPMAP);
} else {
al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR|ALLEGRO_MIPMAP);
// FIXME: When we have ability to set a maximum mipmap lod,
// do so when cache_images is enabled to prevent sprites going transparent.
// Until then, disable mipmapping when using an image cache.
al_set_new_bitmap_flags(
ALLEGRO_MIN_LINEAR
|(ssConfig.config.cache_images ? 0 : ALLEGRO_MIPMAP));
}

display = al_create_display(stonesenseState.ssState.ScreenW, stonesenseState.ssState.ScreenH);
Expand Down