Expose all OpenGL filtering modes, use OpenGL names for them

Because of a review comment on the Irrlicht PR by numberZero.
This commit is contained in:
Gregor Parzefall 2023-06-24 23:36:36 +02:00 committed by sfan5
parent 6bf63d4b41
commit 7473e4cafd
12 changed files with 18 additions and 18 deletions

@ -858,7 +858,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
// Do not enable filter on shadow texture to avoid visual artifacts
// with colored shadows.
// Filtering is done in shader code anyway
layer.MinFilter = video::ETMINF_NEAREST;
layer.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
layer.MagFilter = video::ETMAGF_NEAREST;
layer.AnisotropicFilter = 0;
}

@ -53,7 +53,7 @@ Clouds::Clouds(scene::ISceneManager* mgr,
m_material.AntiAliasing = video::EAAM_SIMPLE;
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});

@ -255,7 +255,7 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
buf->getMaterial().Lighting = false;
buf->getMaterial().BackfaceCulling = false;
buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST;
buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
buf->getMaterial().TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
buf->getMaterial().FogEnable = true;
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
@ -653,7 +653,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
mat.NormalizeNormals = true;
}
mat.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});
};

@ -43,7 +43,7 @@ public:
mat.Lighting = false;
mat.FogEnable = true;
mat.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});
});

@ -768,7 +768,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
material.FogEnable = true;
material.setTexture(0, p.layer.texture);
material.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});

@ -101,7 +101,7 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
buf->getMaterial().Lighting = false;
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});
// Add mesh buffer to mesh
@ -411,7 +411,7 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
buf->getMaterial().Lighting = false;
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});
dst_mesh->addMeshBuffer(buf);

@ -609,8 +609,8 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
video::SMaterial &material = m_meshbuffer->getMaterial();
material.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_TRILINEAR;
tex.MagFilter = video::ETMAGF_BILINEAR;
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
tex.MagFilter = video::ETMAGF_LINEAR;
});
material.Lighting = false;
material.TextureLayers[0].Texture = minimap_texture;

@ -93,7 +93,7 @@ Particle::Particle(
m_material.BackfaceCulling = false;
m_material.FogEnable = true;
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});

@ -39,7 +39,7 @@ void PostProcessingStep::configureMaterial()
material.ZWriteEnable = video::EZW_ON;
for (u32 k = 0; k < texture_map.size(); ++k) {
material.TextureLayers[k].AnisotropicFilter = 0;
material.TextureLayers[k].MinFilter = video::ETMINF_NEAREST;
material.TextureLayers[k].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
material.TextureLayers[k].MagFilter = video::ETMAGF_NEAREST;
material.TextureLayers[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
material.TextureLayers[k].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
@ -92,8 +92,8 @@ void PostProcessingStep::run(PipelineContext &context)
void PostProcessingStep::setBilinearFilter(u8 index, bool value)
{
assert(index < video::MATERIAL_MAX_TEXTURES);
material.TextureLayers[index].MinFilter = value ? video::ETMINF_BILINEAR : video::ETMINF_NEAREST;
material.TextureLayers[index].MagFilter = value ? video::ETMAGF_BILINEAR : video::ETMAGF_NEAREST;
material.TextureLayers[index].MinFilter = value ? video::ETMINF_LINEAR_MIPMAP_NEAREST : video::ETMINF_NEAREST_MIPMAP_NEAREST;
material.TextureLayers[index].MagFilter = value ? video::ETMAGF_LINEAR : video::ETMAGF_NEAREST;
}
RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep, v2f scale, Client *client)

@ -51,7 +51,7 @@ static video::SMaterial baseMaterial()
static inline void disableTextureFiltering(video::SMaterial &mat)
{
mat.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
tex.AnisotropicFilter = 0;
});

@ -656,7 +656,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
material.MaterialTypeParam = 0.5f;
material.forEachTexture([] (video::SMaterialLayer &tex) {
tex.MinFilter = video::ETMINF_NEAREST;
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
tex.MagFilter = video::ETMAGF_NEAREST;
});
material.BackfaceCulling = cull_backface;
@ -702,7 +702,7 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial();
material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
material.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST;
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
material.BackfaceCulling = true;
material.Lighting = false;

@ -68,7 +68,7 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
material.TextureLayers[0].Texture = texture;
material.Lighting = false;
material.FogEnable = true;
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST;
material.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
material.BackfaceCulling = false;
material.ZWriteEnable = video::EZW_AUTO;