Skip to content

Commit 97bf8a4

Browse files
Remove getTexture() filterLinear arg
1 parent 17720c6 commit 97bf8a4

5 files changed

Lines changed: 19 additions & 19 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...";

CIO/CFont.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static FontAtlas& getAtlas(FontSize size)
208208
libsiedler2::ArchivItem_Bitmap_Raw tmp;
209209
tmp.create(texSize.x, texSize.y, buffer.getPixelPtr(), texSize.x, texSize.y, libsiedler2::TextureFormat::BGRA,
210210
nullptr);
211-
a.tex.load(tmp, true);
211+
a.tex.load(tmp);
212212
built[idx] = true;
213213
}
214214
return atlases[idx];

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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Texture& Texture::operator=(Texture&& other) noexcept
3838
return *this;
3939
}
4040

41-
void Texture::load(const void* bgraPixels, Extent size, bool filterLinear)
41+
void Texture::load(const void* bgraPixels, Extent size)
4242
{
4343
if(texture_)
4444
glDeleteTextures(1, &texture_);
@@ -47,17 +47,17 @@ void Texture::load(const void* bgraPixels, Extent size, bool filterLinear)
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)
@@ -259,7 +259,7 @@ void drawButtonBox(const Rect& area, bool pressed, unsigned baseTex, unsigned fa
259259
// Cache for typed-archive textures: (archive, index) → Texture
260260
static std::map<std::pair<ArchiveID, int>, std::unique_ptr<Texture>> s_typedTexCache;
261261

262-
Texture& Texture::getTexture(ArchiveID archive, int index, bool filterLinear)
262+
Texture& Texture::getTexture(ArchiveID archive, int index)
263263
{
264264
auto& archiv = global::typedArchives[archive];
265265
if(index < 0 || static_cast<unsigned>(index) >= archiv.size())
@@ -275,7 +275,7 @@ Texture& Texture::getTexture(ArchiveID archive, int index, bool filterLinear)
275275
const auto* bmp = dynamic_cast<const libsiedler2::baseArchivItem_Bitmap*>(archiv.get(index));
276276
if(bmp)
277277
{
278-
tex->load(*bmp, filterLinear);
278+
tex->load(*bmp);
279279
tex->anchor_ = {bmp->getNx(), bmp->getNy()};
280280
}
281281
it = s_typedTexCache.emplace(key, std::move(tex)).first;

Texture.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ 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
/// Create an empty texture of the given size (for use as a render-target).
37-
void createEmpty(Extent size, bool filterLinear = false);
37+
void createEmpty(Extent size);
3838

3939
/// Upload new pixel data to an existing texture (glTexSubImage2D).
4040
void upload(const void* bgraPixels);
@@ -69,15 +69,15 @@ class Texture
6969
// ---- Static bitmap-texture cache ----
7070

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

7474
private:
7575
GLuint texture_ = 0;
7676
Extent size_;
7777
Position anchor_ = {0, 0}; // sprite anchor offset, set by getTexture
7878

7979
/// Internal: create or recreate texture from raw BGRA pixel data.
80-
void load(const void* bgraPixels, Extent size, bool filterLinear);
80+
void load(const void* bgraPixels, Extent size);
8181
};
8282

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

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

0 commit comments

Comments
 (0)