mirror of
https://github.com/minetest/minetest.git
synced 2024-08-19 04:54:18 +02:00
Fixes and improvements
This commit is contained in:
parent
7473e4cafd
commit
6f0d36c41a
@ -842,7 +842,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
auto &material = buf->getMaterial();
|
||||
|
||||
// Apply filter settings
|
||||
material.forEachTexture([this] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([this] (auto &tex) {
|
||||
tex.setFiltersMinetest(m_cache_bilinear_filter, m_cache_trilinear_filter,
|
||||
m_cache_anistropic_filter);
|
||||
});
|
||||
|
@ -52,7 +52,7 @@ Clouds::Clouds(scene::ISceneManager* mgr,
|
||||
m_material.FogEnable = true;
|
||||
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
||||
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
m_material.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
|
@ -254,7 +254,7 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
||||
// Set material
|
||||
buf->getMaterial().Lighting = false;
|
||||
buf->getMaterial().BackfaceCulling = false;
|
||||
buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
|
||||
buf->getMaterial().TextureLayers[0].Texture = tsrc->getTextureForMesh("rat.png");
|
||||
buf->getMaterial().TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
buf->getMaterial().TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||
buf->getMaterial().FogEnable = true;
|
||||
@ -652,7 +652,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
||||
mat.GouraudShading = false;
|
||||
mat.NormalizeNormals = true;
|
||||
}
|
||||
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
mat.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
@ -668,7 +668,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
||||
m_matrixnode, v2f(1, 1), v3f(0,0,0), -1);
|
||||
m_spritenode->grab();
|
||||
video::ITexture *tex = tsrc->getTextureForMesh("no_texture.png");
|
||||
m_spritenode->forEachMaterial([tex] (video::SMaterial &mat) {
|
||||
m_spritenode->forEachMaterial([tex] (auto &mat) {
|
||||
mat.setTexture(0, tex);
|
||||
});
|
||||
|
||||
@ -755,7 +755,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
||||
|
||||
setSceneNodeMaterials(m_meshnode);
|
||||
|
||||
m_meshnode->forEachMaterial([this] (video::SMaterial &mat) {
|
||||
m_meshnode->forEachMaterial([this] (auto &mat) {
|
||||
mat.BackfaceCulling = m_prop.backface_culling;
|
||||
});
|
||||
} else if (m_prop.visual == "mesh") {
|
||||
@ -782,7 +782,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
||||
|
||||
setSceneNodeMaterials(m_animated_meshnode);
|
||||
|
||||
m_animated_meshnode->forEachMaterial([this] (video::SMaterial &mat) {
|
||||
m_animated_meshnode->forEachMaterial([this] (auto &mat) {
|
||||
mat.BackfaceCulling = m_prop.backface_culling;
|
||||
});
|
||||
} else
|
||||
@ -1354,7 +1354,7 @@ void GenericCAO::updateTextures(std::string mod)
|
||||
material.SpecularColor = m_prop.colors[0];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
});
|
||||
@ -1390,7 +1390,7 @@ void GenericCAO::updateTextures(std::string mod)
|
||||
use_trilinear_filter &= res > 64;
|
||||
use_bilinear_filter &= res > 64;
|
||||
|
||||
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
});
|
||||
@ -1437,7 +1437,7 @@ void GenericCAO::updateTextures(std::string mod)
|
||||
material.SpecularColor = m_prop.colors[i];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
});
|
||||
@ -1462,7 +1462,7 @@ void GenericCAO::updateTextures(std::string mod)
|
||||
material.SpecularColor = m_prop.colors[0];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
});
|
||||
@ -1491,7 +1491,7 @@ void GenericCAO::updateTextures(std::string mod)
|
||||
material.SpecularColor = m_prop.colors[0];
|
||||
}
|
||||
|
||||
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
tex.setFiltersMinetest(use_bilinear_filter, use_trilinear_filter,
|
||||
use_anisotropic_filter);
|
||||
});
|
||||
@ -1977,7 +1977,7 @@ void GenericCAO::updateMeshCulling()
|
||||
|
||||
if (m_prop.visual == "upright_sprite") {
|
||||
// upright sprite has no backface culling
|
||||
node->forEachMaterial([=] (video::SMaterial &mat) {
|
||||
node->forEachMaterial([=] (auto &mat) {
|
||||
mat.FrontfaceCulling = hidden;
|
||||
});
|
||||
return;
|
||||
@ -1987,13 +1987,13 @@ void GenericCAO::updateMeshCulling()
|
||||
// Hide the mesh by culling both front and
|
||||
// back faces. Serious hackyness but it works for our
|
||||
// purposes. This also preserves the skeletal armature.
|
||||
node->forEachMaterial([] (video::SMaterial &mat) {
|
||||
node->forEachMaterial([] (auto &mat) {
|
||||
mat.BackfaceCulling = true;
|
||||
mat.FrontfaceCulling = true;
|
||||
});
|
||||
} else {
|
||||
// Restore mesh visibility.
|
||||
node->forEachMaterial([this] (video::SMaterial &mat) {
|
||||
node->forEachMaterial([this] (auto &mat) {
|
||||
mat.BackfaceCulling = m_prop.backface_culling;
|
||||
mat.FrontfaceCulling = false;
|
||||
});
|
||||
|
@ -37,15 +37,13 @@ public:
|
||||
m_spritenode = smgr->addBillboardSceneNode(
|
||||
NULL, v2f(1,1), pos, -1);
|
||||
video::ITexture *tex = env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png");
|
||||
m_spritenode->forEachMaterial([tex] (video::SMaterial &mat) {
|
||||
mat.setTexture(0, tex);
|
||||
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
m_spritenode->forEachMaterial([tex] (auto &mat) {
|
||||
mat.TextureLayers[0].Texture = tex;
|
||||
mat.Lighting = false;
|
||||
mat.TextureLayers[0].MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
mat.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
mat.FogEnable = true;
|
||||
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
});
|
||||
m_spritenode->setColor(video::SColor(255,0,0,0));
|
||||
m_spritenode->setVisible(true);
|
||||
|
@ -767,7 +767,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
||||
material.BackfaceCulling = true;
|
||||
material.FogEnable = true;
|
||||
material.setTexture(0, p.layer.texture);
|
||||
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
|
@ -100,7 +100,7 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
|
||||
// Set default material
|
||||
buf->getMaterial().Lighting = false;
|
||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
|
||||
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
buf->getMaterial().forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
@ -410,7 +410,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) {
|
||||
buf->getMaterial().forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
|
@ -608,7 +608,7 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
|
||||
matrix.makeIdentity();
|
||||
|
||||
video::SMaterial &material = m_meshbuffer->getMaterial();
|
||||
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_LINEAR_MIPMAP_LINEAR;
|
||||
tex.MagFilter = video::ETMAGF_LINEAR;
|
||||
});
|
||||
|
@ -92,7 +92,7 @@ Particle::Particle(
|
||||
m_material.Lighting = false;
|
||||
m_material.BackfaceCulling = false;
|
||||
m_material.FogEnable = true;
|
||||
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
m_material.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
|
@ -113,7 +113,7 @@ void ShadowRenderer::disable()
|
||||
}
|
||||
|
||||
for (auto node : m_shadow_node_array)
|
||||
node.node->forEachMaterial([] (video::SMaterial &mat) {
|
||||
node.node->forEachMaterial([] (auto &mat) {
|
||||
mat.setTexture(TEXTURE_LAYER_SHADOW, nullptr);
|
||||
});
|
||||
}
|
||||
@ -185,14 +185,14 @@ void ShadowRenderer::addNodeToShadowList(
|
||||
// node should never be ClientMap
|
||||
assert(strcmp(node->getName(), "ClientMap") != 0);
|
||||
|
||||
node->forEachMaterial([this] (video::SMaterial &mat) {
|
||||
node->forEachMaterial([this] (auto &mat) {
|
||||
mat.setTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
|
||||
});
|
||||
}
|
||||
|
||||
void ShadowRenderer::removeNodeFromShadowList(scene::ISceneNode *node)
|
||||
{
|
||||
node->forEachMaterial([] (video::SMaterial &mat) {
|
||||
node->forEachMaterial([] (auto &mat) {
|
||||
mat.setTexture(TEXTURE_LAYER_SHADOW, nullptr);
|
||||
});
|
||||
for (auto it = m_shadow_node_array.begin(); it != m_shadow_node_array.end();) {
|
||||
@ -264,7 +264,7 @@ void ShadowRenderer::updateSMTextures()
|
||||
assert(shadowMapTextureFinal != nullptr);
|
||||
|
||||
for (auto &node : m_shadow_node_array)
|
||||
node.node->forEachMaterial([this] (video::SMaterial &mat) {
|
||||
node.node->forEachMaterial([this] (auto &mat) {
|
||||
mat.setTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
|
||||
});
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ static video::SMaterial baseMaterial()
|
||||
|
||||
static inline void disableTextureFiltering(video::SMaterial &mat)
|
||||
{
|
||||
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
mat.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
tex.AnisotropicFilter = 0;
|
||||
|
@ -300,7 +300,7 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
|
||||
// Enable bi/trilinear filtering only for high resolution textures
|
||||
bool bilinear_filter = dim.Width > 32 && m_bilinear_filter;
|
||||
bool trilinear_filter = dim.Width > 32 && m_trilinear_filter;
|
||||
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([=] (auto &tex) {
|
||||
tex.setFiltersMinetest(bilinear_filter, trilinear_filter,
|
||||
m_anisotropic_filter);
|
||||
});
|
||||
@ -464,7 +464,7 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
||||
material.MaterialType = m_material_type;
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
material.BackfaceCulling = cull_backface;
|
||||
material.forEachTexture([this] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([this] (auto &tex) {
|
||||
tex.setFiltersMinetest(m_bilinear_filter, m_trilinear_filter,
|
||||
m_anisotropic_filter);
|
||||
});
|
||||
@ -558,7 +558,7 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
||||
m_meshnode->setMesh(mesh);
|
||||
}
|
||||
|
||||
m_meshnode->forEachMaterial([this] (video::SMaterial &mat) {
|
||||
m_meshnode->forEachMaterial([this] (auto &mat) {
|
||||
mat.Lighting = m_lighting;
|
||||
// need to normalize normals when lighting is enabled (because of setScale())
|
||||
mat.NormalizeNormals = m_lighting;
|
||||
@ -655,7 +655,7 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
||||
video::SMaterial &material = buf->getMaterial();
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||
material.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
@ -702,8 +702,10 @@ 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_MIPMAP_NEAREST;
|
||||
material.TextureLayers[0].MagFilter = video::ETMAGF_NEAREST;
|
||||
material.forEachTexture([] (auto &tex) {
|
||||
tex.MinFilter = video::ETMINF_NEAREST_MIPMAP_NEAREST;
|
||||
tex.MagFilter = video::ETMAGF_NEAREST;
|
||||
});
|
||||
material.BackfaceCulling = true;
|
||||
material.Lighting = false;
|
||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
|
Loading…
Reference in New Issue
Block a user