Skip to content

Commit b13d98f

Browse files
Remove getTexture() filterLinear arg
1 parent cf24b91 commit b13d98f

4 files changed

Lines changed: 16 additions & 17 deletions

File tree

CGame_Init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ bool CGame::Init()
173173
auto& archiv = global::typedArchives[ArchiveID::SETUP997];
174174
auto* bmp = dynamic_cast<const libsiedler2::baseArchivItem_Bitmap*>(archiv.get(0));
175175
if(bmp)
176-
splashBg_.load(*bmp, true);
176+
splashBg_.load(*bmp);
177177
}
178178

179179
// std::cout << "\nShow loading screen...";

CSurface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static const AnimFrames* getAnimFrames(const TerrainDesc& td, MapType mapType)
510510
libsiedler2::ArchivItem_Bitmap_Raw tmpBmp;
511511
tmpBmp.create(texSize.x, texSize.y, bgraBuf.getPixelPtr(), texSize.x, texSize.y,
512512
libsiedler2::TextureFormat::BGRA, nullptr);
513-
tex.load(tmpBmp, false);
513+
tex.load(tmpBmp);
514514
result.frames.push_back(std::move(tex));
515515

516516
curPal = std::move(pal);

Texture.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ void Texture::load(const uint8_t* bgraPixels, Extent size)
4747

4848
glGenTextures(1, &texture_);
4949
glBindTexture(GL_TEXTURE_2D, texture_);
50-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterLinear ? GL_LINEAR : GL_NEAREST);
51-
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterLinear ? GL_LINEAR : GL_NEAREST);
50+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
51+
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
5252
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
5353
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
5454
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.x, size.y, 0, GL_BGRA, GL_UNSIGNED_BYTE, bgraPixels);
5555
size_ = size;
5656
}
5757

58-
void Texture::createEmpty(Extent size, bool filterLinear)
58+
void Texture::createEmpty(Extent size)
5959
{
60-
load(nullptr, size, filterLinear);
60+
load(nullptr, size);
6161
}
6262

6363
void Texture::upload(const void* bgraPixels)
@@ -68,7 +68,7 @@ void Texture::upload(const void* bgraPixels)
6868
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size_.x, size_.y, GL_BGRA, GL_UNSIGNED_BYTE, bgraPixels);
6969
}
7070

71-
bool Texture::load(const libsiedler2::baseArchivItem_Bitmap& bitmap, bool filterLinear)
71+
bool Texture::load(const libsiedler2::baseArchivItem_Bitmap& bitmap)
7272
{
7373
const auto w = bitmap.getWidth();
7474
const auto h = bitmap.getHeight();
@@ -103,7 +103,7 @@ bool Texture::load(const libsiedler2::baseArchivItem_Bitmap& bitmap, bool filter
103103
return false;
104104
}
105105

106-
load(bgra.data(), Extent(w, h), filterLinear);
106+
load(bgra.data(), Extent(w, h));
107107
return true;
108108
}
109109

@@ -224,9 +224,9 @@ void drawRect(const Rect& rect, unsigned color)
224224
glColor4f(1, 1, 1, 1);
225225
}
226226

227-
Texture& getTexture(ArchiveID archive, int index, bool filterLinear)
227+
Texture& getTexture(ArchiveID archive, int index)
228228
{
229-
return Texture::getTexture(archive, index, filterLinear);
229+
return Texture::getTexture(archive, index);
230230
}
231231

232232
void drawButtonBox(const Rect& area, bool pressed, unsigned baseTex, unsigned faceTex)
@@ -256,7 +256,7 @@ void drawButtonBox(const Rect& area, bool pressed, unsigned baseTex, unsigned fa
256256
// Cache for typed-archive textures: (archive, index) → Texture
257257
static std::map<std::pair<ArchiveID, int>, std::unique_ptr<Texture>> s_typedTexCache;
258258

259-
Texture& Texture::getTexture(ArchiveID archive, int index, bool filterLinear)
259+
Texture& Texture::getTexture(ArchiveID archive, int index)
260260
{
261261
auto& archiv = global::typedArchives[archive];
262262
if(index < 0 || static_cast<unsigned>(index) >= archiv.size())
@@ -272,7 +272,7 @@ Texture& Texture::getTexture(ArchiveID archive, int index, bool filterLinear)
272272
const auto* bmp = dynamic_cast<const libsiedler2::baseArchivItem_Bitmap*>(archiv.get(index));
273273
if(bmp)
274274
{
275-
tex->load(*bmp, filterLinear);
275+
tex->load(*bmp);
276276
tex->anchor_ = {bmp->getNx(), bmp->getNy()};
277277
}
278278
it = s_typedTexCache.emplace(key, std::move(tex)).first;

Texture.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class Texture
3131
Texture& operator=(const Texture&) = delete;
3232

3333
/// Load from a libsiedler2 bitmap (paletted or BGRA).
34-
bool load(const libsiedler2::baseArchivItem_Bitmap& bitmap, bool filterLinear = false);
34+
bool load(const libsiedler2::baseArchivItem_Bitmap& bitmap);
3535

3636
/// Load raw BGRA pixel data directly.
3737
void load(const uint8_t* bgraPixels, Extent size);
3838

3939
/// Create an empty texture of the given size (for use as a render-target).
40-
void createEmpty(Extent size, bool filterLinear = false);
40+
void createEmpty(Extent size);
4141

4242
/// Upload new pixel data to an existing texture (glTexSubImage2D).
4343
void upload(const void* bgraPixels);
@@ -72,13 +72,12 @@ class Texture
7272
// Static bitmap-texture cache
7373

7474
/// Return (or create on first use) a cached GL texture from a typed archive.
75-
static Texture& getTexture(ArchiveID archive, int index, bool filterLinear = false);
75+
static Texture& getTexture(ArchiveID archive, int index);
7676

7777
private:
7878
GLuint texture_ = 0;
7979
Extent size_;
8080
Position anchor_ = {0, 0}; // sprite anchor offset, set by getTexture
81-
8281
};
8382

8483
/// Draw a filled rectangle with a 32-bit ARGB colour.
@@ -89,4 +88,4 @@ void drawRect(const Rect& rect, unsigned color);
8988
void drawButtonBox(const Rect& area, bool pressed, unsigned baseTex, unsigned faceTex);
9089

9190
/// Get or create the cached OpenGL texture from a typed archive.
92-
Texture& getTexture(ArchiveID archive, int index, bool filterLinear = false);
91+
Texture& getTexture(ArchiveID archive, int index);

0 commit comments

Comments
 (0)