mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
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:
parent
6bf63d4b41
commit
7473e4cafd
@ -858,7 +858,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||||||
// Do not enable filter on shadow texture to avoid visual artifacts
|
// Do not enable filter on shadow texture to avoid visual artifacts
|
||||||
// with colored shadows.
|
// with colored shadows.
|
||||||
// Filtering is done in shader code anyway
|
// 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.MagFilter = video::ETMAGF_NEAREST;
|
||||||
layer.AnisotropicFilter = 0;
|
layer.AnisotropicFilter = 0;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ Clouds::Clouds(scene::ISceneManager* mgr,
|
|||||||
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
||||||
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
buf->getMaterial().Lighting = false;
|
buf->getMaterial().Lighting = false;
|
||||||
buf->getMaterial().BackfaceCulling = false;
|
buf->getMaterial().BackfaceCulling = false;
|
||||||
buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
|
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().TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||||
buf->getMaterial().FogEnable = true;
|
buf->getMaterial().FogEnable = true;
|
||||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
@ -653,7 +653,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
mat.NormalizeNormals = true;
|
mat.NormalizeNormals = true;
|
||||||
}
|
}
|
||||||
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
mat.Lighting = false;
|
mat.Lighting = false;
|
||||||
mat.FogEnable = true;
|
mat.FogEnable = true;
|
||||||
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -768,7 +768,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
|||||||
material.FogEnable = true;
|
material.FogEnable = true;
|
||||||
material.setTexture(0, p.layer.texture);
|
material.setTexture(0, p.layer.texture);
|
||||||
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
|
|||||||
buf->getMaterial().Lighting = false;
|
buf->getMaterial().Lighting = false;
|
||||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||||
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
|
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
// Add mesh buffer to mesh
|
// Add mesh buffer to mesh
|
||||||
@ -411,7 +411,7 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
|
|||||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
buf->getMaterial().Lighting = false;
|
buf->getMaterial().Lighting = false;
|
||||||
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
|
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
dst_mesh->addMeshBuffer(buf);
|
dst_mesh->addMeshBuffer(buf);
|
||||||
|
@ -609,8 +609,8 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
|
|||||||
|
|
||||||
video::SMaterial &material = m_meshbuffer->getMaterial();
|
video::SMaterial &material = m_meshbuffer->getMaterial();
|
||||||
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_TRILINEAR;
|
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
|
||||||
tex.MagFilter = video::ETMAGF_BILINEAR;
|
tex.MagFilter = video::ETMAGF_LINEAR;
|
||||||
});
|
});
|
||||||
material.Lighting = false;
|
material.Lighting = false;
|
||||||
material.TextureLayers[0].Texture = minimap_texture;
|
material.TextureLayers[0].Texture = minimap_texture;
|
||||||
|
@ -93,7 +93,7 @@ Particle::Particle(
|
|||||||
m_material.BackfaceCulling = false;
|
m_material.BackfaceCulling = false;
|
||||||
m_material.FogEnable = true;
|
m_material.FogEnable = true;
|
||||||
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ void PostProcessingStep::configureMaterial()
|
|||||||
material.ZWriteEnable = video::EZW_ON;
|
material.ZWriteEnable = video::EZW_ON;
|
||||||
for (u32 k = 0; k < texture_map.size(); ++k) {
|
for (u32 k = 0; k < texture_map.size(); ++k) {
|
||||||
material.TextureLayers[k].AnisotropicFilter = 0;
|
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].MagFilter = video::ETMAGF_NEAREST;
|
||||||
material.TextureLayers[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
material.TextureLayers[k].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
||||||
material.TextureLayers[k].TextureWrapV = 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)
|
void PostProcessingStep::setBilinearFilter(u8 index, bool value)
|
||||||
{
|
{
|
||||||
assert(index < video::MATERIAL_MAX_TEXTURES);
|
assert(index < video::MATERIAL_MAX_TEXTURES);
|
||||||
material.TextureLayers[index].MinFilter = value ? video::ETMINF_BILINEAR : video::ETMINF_NEAREST;
|
material.TextureLayers[index].MinFilter = value ? video::ETMINF_LINEAR_MIPMAP_NEAREST : video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
material.TextureLayers[index].MagFilter = value ? video::ETMAGF_BILINEAR : video::ETMAGF_NEAREST;
|
material.TextureLayers[index].MagFilter = value ? video::ETMAGF_LINEAR : video::ETMAGF_NEAREST;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderStep *addPostProcessing(RenderPipeline *pipeline, RenderStep *previousStep, v2f scale, Client *client)
|
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)
|
static inline void disableTextureFiltering(video::SMaterial &mat)
|
||||||
{
|
{
|
||||||
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
tex.AnisotropicFilter = 0;
|
tex.AnisotropicFilter = 0;
|
||||||
});
|
});
|
||||||
|
@ -656,7 +656,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
tex.MinFilter = video::ETMINF_NEAREST;
|
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||||
});
|
});
|
||||||
material.BackfaceCulling = cull_backface;
|
material.BackfaceCulling = cull_backface;
|
||||||
@ -702,7 +702,7 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
|
|||||||
video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial();
|
video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial();
|
||||||
material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
material.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
||||||
material.TextureLayers[0].TextureWrapV = 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.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||||
material.BackfaceCulling = true;
|
material.BackfaceCulling = true;
|
||||||
material.Lighting = false;
|
material.Lighting = false;
|
||||||
|
@ -68,7 +68,7 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
|
|||||||
material.TextureLayers[0].Texture = texture;
|
material.TextureLayers[0].Texture = texture;
|
||||||
material.Lighting = false;
|
material.Lighting = false;
|
||||||
material.FogEnable = true;
|
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.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||||
material.BackfaceCulling = false;
|
material.BackfaceCulling = false;
|
||||||
material.ZWriteEnable = video::EZW_AUTO;
|
material.ZWriteEnable = video::EZW_AUTO;
|
||||||
|
Loading…
Reference in New Issue
Block a user