mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Refactor the way you set material properties
Instead of using SMaterial::setFlag, you now set them directly on SMaterial or SMaterialLayer.
This commit is contained in:
parent
128d22e6ee
commit
307e380f30
@ -842,14 +842,12 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
|||||||
auto &material = buf->getMaterial();
|
auto &material = buf->getMaterial();
|
||||||
|
|
||||||
// Apply filter settings
|
// Apply filter settings
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER,
|
material.forEachTexture([this] (video::SMaterialLayer &tex) {
|
||||||
m_cache_trilinear_filter);
|
tex.TrilinearFilter = m_cache_trilinear_filter;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER,
|
tex.BilinearFilter = m_cache_trilinear_filter;
|
||||||
m_cache_bilinear_filter);
|
tex.AnisotropicFilter = m_cache_anistropic_filter ? 0xFF : 0;
|
||||||
material.setFlag(video::EMF_ANISOTROPIC_FILTER,
|
});
|
||||||
m_cache_anistropic_filter);
|
material.Wireframe = m_control.show_wireframe;
|
||||||
material.setFlag(video::EMF_WIREFRAME,
|
|
||||||
m_control.show_wireframe);
|
|
||||||
|
|
||||||
// pass the shadow map texture to the buffer texture
|
// pass the shadow map texture to the buffer texture
|
||||||
ShadowRenderer *shadow = m_rendering_engine->get_shadow_renderer();
|
ShadowRenderer *shadow = m_rendering_engine->get_shadow_renderer();
|
||||||
|
@ -47,14 +47,14 @@ Clouds::Clouds(scene::ISceneManager* mgr,
|
|||||||
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
|
scene::ISceneNode(mgr->getRootSceneNode(), mgr, id),
|
||||||
m_seed(seed)
|
m_seed(seed)
|
||||||
{
|
{
|
||||||
m_material.setFlag(video::EMF_LIGHTING, false);
|
m_material.Lighting = false;
|
||||||
//m_material.setFlag(video::EMF_BACK_FACE_CULLING, false);
|
m_material.BackfaceCulling = true;
|
||||||
m_material.setFlag(video::EMF_BACK_FACE_CULLING, true);
|
m_material.FogEnable = true;
|
||||||
m_material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
m_material.AntiAliasing = video::EAAM_SIMPLE;
|
||||||
m_material.setFlag(video::EMF_FOG_ENABLE, true);
|
|
||||||
m_material.setFlag(video::EMF_ANTI_ALIASING, true);
|
|
||||||
//m_material.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
|
||||||
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
m_material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
|
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
|
|
||||||
m_params.height = 120;
|
m_params.height = 120;
|
||||||
m_params.density = 0.4f;
|
m_params.density = 0.4f;
|
||||||
@ -103,7 +103,7 @@ void Clouds::render()
|
|||||||
|
|
||||||
int num_faces_to_draw = m_enable_3d ? 6 : 1;
|
int num_faces_to_draw = m_enable_3d ? 6 : 1;
|
||||||
|
|
||||||
m_material.setFlag(video::EMF_BACK_FACE_CULLING, m_enable_3d);
|
m_material.BackfaceCulling = m_enable_3d;
|
||||||
|
|
||||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||||
driver->setMaterial(m_material);
|
driver->setMaterial(m_material);
|
||||||
|
@ -252,11 +252,11 @@ void TestCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
buf->append(vertices, 4, indices, 6);
|
buf->append(vertices, 4, indices, 6);
|
||||||
// Set material
|
// Set material
|
||||||
buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
|
buf->getMaterial().Lighting = false;
|
||||||
buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
|
buf->getMaterial().BackfaceCulling = false;
|
||||||
buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
|
buf->getMaterial().setTexture(0, tsrc->getTextureForMesh("rat.png"));
|
||||||
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
|
buf->getMaterial().TextureLayer[0].BilinearFilter = false;
|
||||||
buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
|
buf->getMaterial().FogEnable = true;
|
||||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
// Add to mesh
|
// Add to mesh
|
||||||
mesh->addMeshBuffer(buf);
|
mesh->addMeshBuffer(buf);
|
||||||
@ -643,16 +643,21 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
m_matrixnode->grab();
|
m_matrixnode->grab();
|
||||||
};
|
};
|
||||||
|
|
||||||
auto setSceneNodeMaterial = [this] (scene::ISceneNode *node) {
|
auto setMaterial = [this] (video::SMaterial &mat) {
|
||||||
node->setMaterialFlag(video::EMF_LIGHTING, false);
|
mat.MaterialType = m_material_type;
|
||||||
node->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
|
mat.Lighting = false;
|
||||||
node->setMaterialFlag(video::EMF_FOG_ENABLE, true);
|
mat.FogEnable = true;
|
||||||
node->setMaterialType(m_material_type);
|
|
||||||
|
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
node->setMaterialFlag(video::EMF_GOURAUD_SHADING, false);
|
mat.GouraudShading = false;
|
||||||
node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
|
mat.NormalizeNormals = true;
|
||||||
}
|
}
|
||||||
|
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
auto setSceneNodeMaterials = [setMaterial] (scene::ISceneNode *node) {
|
||||||
|
node->forEachMaterial(setMaterial);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_prop.visual == "sprite") {
|
if (m_prop.visual == "sprite") {
|
||||||
@ -660,10 +665,12 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
m_spritenode = m_smgr->addBillboardSceneNode(
|
m_spritenode = m_smgr->addBillboardSceneNode(
|
||||||
m_matrixnode, v2f(1, 1), v3f(0,0,0), -1);
|
m_matrixnode, v2f(1, 1), v3f(0,0,0), -1);
|
||||||
m_spritenode->grab();
|
m_spritenode->grab();
|
||||||
m_spritenode->setMaterialTexture(0,
|
video::ITexture *tex = tsrc->getTextureForMesh("no_texture.png");
|
||||||
tsrc->getTextureForMesh("no_texture.png"));
|
m_spritenode->forEachMaterial([tex] (video::SMaterial &mat) {
|
||||||
|
mat.setTexture(0, tex);
|
||||||
|
});
|
||||||
|
|
||||||
setSceneNodeMaterial(m_spritenode);
|
setSceneNodeMaterials(m_spritenode);
|
||||||
|
|
||||||
m_spritenode->setSize(v2f(m_prop.visual_size.X,
|
m_spritenode->setSize(v2f(m_prop.visual_size.X,
|
||||||
m_prop.visual_size.Y) * BS);
|
m_prop.visual_size.Y) * BS);
|
||||||
@ -695,16 +702,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
}
|
}
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
buf->append(vertices, 4, indices, 6);
|
buf->append(vertices, 4, indices, 6);
|
||||||
// Set material
|
|
||||||
buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
|
|
||||||
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
|
|
||||||
buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
|
|
||||||
buf->getMaterial().MaterialType = m_material_type;
|
|
||||||
|
|
||||||
|
// Set material
|
||||||
|
setMaterial(buf->getMaterial());
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
buf->getMaterial().EmissiveColor = c;
|
buf->getMaterial().EmissiveColor = c;
|
||||||
buf->getMaterial().setFlag(video::EMF_GOURAUD_SHADING, false);
|
|
||||||
buf->getMaterial().setFlag(video::EMF_NORMALIZE_NORMALS, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to mesh
|
// Add to mesh
|
||||||
@ -726,16 +728,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
}
|
}
|
||||||
u16 indices[] = {0,1,2,2,3,0};
|
u16 indices[] = {0,1,2,2,3,0};
|
||||||
buf->append(vertices, 4, indices, 6);
|
buf->append(vertices, 4, indices, 6);
|
||||||
// Set material
|
|
||||||
buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
|
|
||||||
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
|
|
||||||
buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
|
|
||||||
buf->getMaterial().MaterialType = m_material_type;
|
|
||||||
|
|
||||||
|
// Set material
|
||||||
|
setMaterial(buf->getMaterial());
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
buf->getMaterial().EmissiveColor = c;
|
buf->getMaterial().EmissiveColor = c;
|
||||||
buf->getMaterial().setFlag(video::EMF_GOURAUD_SHADING, false);
|
|
||||||
buf->getMaterial().setFlag(video::EMF_NORMALIZE_NORMALS, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to mesh
|
// Add to mesh
|
||||||
@ -753,10 +750,12 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
mesh->drop();
|
mesh->drop();
|
||||||
|
|
||||||
m_meshnode->setScale(m_prop.visual_size);
|
m_meshnode->setScale(m_prop.visual_size);
|
||||||
m_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING,
|
|
||||||
m_prop.backface_culling);
|
|
||||||
|
|
||||||
setSceneNodeMaterial(m_meshnode);
|
setSceneNodeMaterials(m_meshnode);
|
||||||
|
|
||||||
|
m_meshnode->forEachMaterial([this] (video::SMaterial &mat) {
|
||||||
|
mat.BackfaceCulling = m_prop.backface_culling;
|
||||||
|
});
|
||||||
} else if (m_prop.visual == "mesh") {
|
} else if (m_prop.visual == "mesh") {
|
||||||
grabMatrixNode();
|
grabMatrixNode();
|
||||||
scene::IAnimatedMesh *mesh = m_client->getMesh(m_prop.mesh, true);
|
scene::IAnimatedMesh *mesh = m_client->getMesh(m_prop.mesh, true);
|
||||||
@ -779,10 +778,11 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
|
|||||||
|
|
||||||
setAnimatedMeshColor(m_animated_meshnode, video::SColor(0xFFFFFFFF));
|
setAnimatedMeshColor(m_animated_meshnode, video::SColor(0xFFFFFFFF));
|
||||||
|
|
||||||
setSceneNodeMaterial(m_animated_meshnode);
|
setSceneNodeMaterials(m_animated_meshnode);
|
||||||
|
|
||||||
m_animated_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING,
|
m_animated_meshnode->forEachMaterial([this] (video::SMaterial &mat) {
|
||||||
m_prop.backface_culling);
|
mat.BackfaceCulling = m_prop.backface_culling;
|
||||||
|
});
|
||||||
} else
|
} else
|
||||||
errorstream<<"GenericCAO::addToScene(): Could not load mesh "<<m_prop.mesh<<std::endl;
|
errorstream<<"GenericCAO::addToScene(): Could not load mesh "<<m_prop.mesh<<std::endl;
|
||||||
} else if (m_prop.visual == "wielditem" || m_prop.visual == "item") {
|
} else if (m_prop.visual == "wielditem" || m_prop.visual == "item") {
|
||||||
@ -1337,23 +1337,26 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
if (!m_prop.textures.empty())
|
if (!m_prop.textures.empty())
|
||||||
texturestring = m_prop.textures[0];
|
texturestring = m_prop.textures[0];
|
||||||
texturestring += mod;
|
texturestring += mod;
|
||||||
m_spritenode->getMaterial(0).MaterialType = m_material_type;
|
|
||||||
m_spritenode->getMaterial(0).MaterialTypeParam = 0.5f;
|
video::SMaterial &material = m_spritenode->getMaterial(0);
|
||||||
m_spritenode->setMaterialTexture(0,
|
material.MaterialType = m_material_type;
|
||||||
tsrc->getTextureForMesh(texturestring));
|
material.MaterialTypeParam = 0.5f;
|
||||||
|
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
// This allows setting per-material colors. However, until a real lighting
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
// system is added, the code below will have no effect. Once MineTest
|
||||||
// has directional lighting, it should work automatically.
|
// has directional lighting, it should work automatically.
|
||||||
if (!m_prop.colors.empty()) {
|
if (!m_prop.colors.empty()) {
|
||||||
m_spritenode->getMaterial(0).AmbientColor = m_prop.colors[0];
|
material.AmbientColor = m_prop.colors[0];
|
||||||
m_spritenode->getMaterial(0).DiffuseColor = m_prop.colors[0];
|
material.DiffuseColor = m_prop.colors[0];
|
||||||
m_spritenode->getMaterial(0).SpecularColor = m_prop.colors[0];
|
material.SpecularColor = m_prop.colors[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
m_spritenode->getMaterial(0).setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
|
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||||
m_spritenode->getMaterial(0).setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter);
|
tex.TrilinearFilter = use_trilinear_filter;
|
||||||
m_spritenode->getMaterial(0).setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter);
|
tex.BilinearFilter = use_bilinear_filter;
|
||||||
|
tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1365,20 +1368,19 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
if (texturestring.empty())
|
if (texturestring.empty())
|
||||||
continue; // Empty texture string means don't modify that material
|
continue; // Empty texture string means don't modify that material
|
||||||
texturestring += mod;
|
texturestring += mod;
|
||||||
video::ITexture* texture = tsrc->getTextureForMesh(texturestring);
|
video::ITexture *texture = tsrc->getTextureForMesh(texturestring);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
errorstream<<"GenericCAO::updateTextures(): Could not load texture "<<texturestring<<std::endl;
|
errorstream<<"GenericCAO::updateTextures(): Could not load texture "<<texturestring<<std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set material flags and texture
|
// Set material flags and texture
|
||||||
video::SMaterial& material = m_animated_meshnode->getMaterial(i);
|
video::SMaterial &material = m_animated_meshnode->getMaterial(i);
|
||||||
material.MaterialType = m_material_type;
|
material.MaterialType = m_material_type;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.TextureLayer[0].Texture = texture;
|
material.TextureLayer[0].Texture = texture;
|
||||||
material.setFlag(video::EMF_LIGHTING, true);
|
material.Lighting = true;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material.BackfaceCulling = m_prop.backface_culling;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, m_prop.backface_culling);
|
|
||||||
|
|
||||||
// don't filter low-res textures, makes them look blurry
|
// don't filter low-res textures, makes them look blurry
|
||||||
// player models have a res of 64
|
// player models have a res of 64
|
||||||
@ -1387,22 +1389,22 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
use_trilinear_filter &= res > 64;
|
use_trilinear_filter &= res > 64;
|
||||||
use_bilinear_filter &= res > 64;
|
use_bilinear_filter &= res > 64;
|
||||||
|
|
||||||
m_animated_meshnode->getMaterial(i)
|
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||||
.setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
|
tex.TrilinearFilter = use_trilinear_filter;
|
||||||
m_animated_meshnode->getMaterial(i)
|
tex.BilinearFilter = use_bilinear_filter;
|
||||||
.setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter);
|
tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0;
|
||||||
m_animated_meshnode->getMaterial(i)
|
});
|
||||||
.setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter);
|
|
||||||
}
|
}
|
||||||
for (u32 i = 0; i < m_prop.colors.size() &&
|
for (u32 i = 0; i < m_prop.colors.size() &&
|
||||||
i < m_animated_meshnode->getMaterialCount(); ++i)
|
i < m_animated_meshnode->getMaterialCount(); ++i)
|
||||||
{
|
{
|
||||||
|
video::SMaterial &material = m_animated_meshnode->getMaterial(i);
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
// This allows setting per-material colors. However, until a real lighting
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
// system is added, the code below will have no effect. Once MineTest
|
||||||
// has directional lighting, it should work automatically.
|
// has directional lighting, it should work automatically.
|
||||||
m_animated_meshnode->getMaterial(i).AmbientColor = m_prop.colors[i];
|
material.AmbientColor = m_prop.colors[i];
|
||||||
m_animated_meshnode->getMaterial(i).DiffuseColor = m_prop.colors[i];
|
material.DiffuseColor = m_prop.colors[i];
|
||||||
m_animated_meshnode->getMaterial(i).SpecularColor = m_prop.colors[i];
|
material.SpecularColor = m_prop.colors[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1417,15 +1419,12 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
texturestring = m_prop.textures[i];
|
texturestring = m_prop.textures[i];
|
||||||
texturestring += mod;
|
texturestring += mod;
|
||||||
|
|
||||||
|
|
||||||
// Set material flags and texture
|
// Set material flags and texture
|
||||||
video::SMaterial& material = m_meshnode->getMaterial(i);
|
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||||
material.MaterialType = m_material_type;
|
material.MaterialType = m_material_type;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.setFlag(video::EMF_LIGHTING, false);
|
material.Lighting = false;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material.setTexture(0, tsrc->getTextureForMesh(texturestring));
|
||||||
material.setTexture(0,
|
|
||||||
tsrc->getTextureForMesh(texturestring));
|
|
||||||
material.getTextureMatrix(0).makeIdentity();
|
material.getTextureMatrix(0).makeIdentity();
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
// This allows setting per-material colors. However, until a real lighting
|
||||||
@ -1433,14 +1432,16 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
// has directional lighting, it should work automatically.
|
// has directional lighting, it should work automatically.
|
||||||
if(m_prop.colors.size() > i)
|
if(m_prop.colors.size() > i)
|
||||||
{
|
{
|
||||||
m_meshnode->getMaterial(i).AmbientColor = m_prop.colors[i];
|
material.AmbientColor = m_prop.colors[i];
|
||||||
m_meshnode->getMaterial(i).DiffuseColor = m_prop.colors[i];
|
material.DiffuseColor = m_prop.colors[i];
|
||||||
m_meshnode->getMaterial(i).SpecularColor = m_prop.colors[i];
|
material.SpecularColor = m_prop.colors[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
m_meshnode->getMaterial(i).setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
|
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||||
m_meshnode->getMaterial(i).setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter);
|
tex.TrilinearFilter = use_trilinear_filter;
|
||||||
m_meshnode->getMaterial(i).setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter);
|
tex.BilinearFilter = use_bilinear_filter;
|
||||||
|
tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (m_prop.visual == "upright_sprite") {
|
} else if (m_prop.visual == "upright_sprite") {
|
||||||
scene::IMesh *mesh = m_meshnode->getMesh();
|
scene::IMesh *mesh = m_meshnode->getMesh();
|
||||||
@ -1449,9 +1450,9 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
if (!m_prop.textures.empty())
|
if (!m_prop.textures.empty())
|
||||||
tname = m_prop.textures[0];
|
tname = m_prop.textures[0];
|
||||||
tname += mod;
|
tname += mod;
|
||||||
auto& material = m_meshnode->getMaterial(0);
|
|
||||||
material.setTexture(0,
|
auto &material = m_meshnode->getMaterial(0);
|
||||||
tsrc->getTextureForMesh(tname));
|
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
// This allows setting per-material colors. However, until a real lighting
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
// system is added, the code below will have no effect. Once MineTest
|
||||||
@ -1462,9 +1463,11 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
material.SpecularColor = m_prop.colors[0];
|
material.SpecularColor = m_prop.colors[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
|
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter);
|
tex.TrilinearFilter = use_trilinear_filter;
|
||||||
material.setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter);
|
tex.BilinearFilter = use_bilinear_filter;
|
||||||
|
tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::string tname = "no_texture.png";
|
std::string tname = "no_texture.png";
|
||||||
@ -1473,9 +1476,9 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
else if (!m_prop.textures.empty())
|
else if (!m_prop.textures.empty())
|
||||||
tname = m_prop.textures[0];
|
tname = m_prop.textures[0];
|
||||||
tname += mod;
|
tname += mod;
|
||||||
auto& material = m_meshnode->getMaterial(1);
|
|
||||||
material.setTexture(0,
|
auto &material = m_meshnode->getMaterial(1);
|
||||||
tsrc->getTextureForMesh(tname));
|
material.setTexture(0, tsrc->getTextureForMesh(tname));
|
||||||
|
|
||||||
// This allows setting per-material colors. However, until a real lighting
|
// This allows setting per-material colors. However, until a real lighting
|
||||||
// system is added, the code below will have no effect. Once MineTest
|
// system is added, the code below will have no effect. Once MineTest
|
||||||
@ -1490,9 +1493,11 @@ void GenericCAO::updateTextures(std::string mod)
|
|||||||
material.SpecularColor = m_prop.colors[0];
|
material.SpecularColor = m_prop.colors[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, use_trilinear_filter);
|
material.forEachTexture([=] (video::SMaterialLayer &tex) {
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, use_bilinear_filter);
|
tex.TrilinearFilter = use_trilinear_filter;
|
||||||
material.setFlag(video::EMF_ANISOTROPIC_FILTER, use_anisotropic_filter);
|
tex.BilinearFilter = use_bilinear_filter;
|
||||||
|
tex.AnisotropicFilter = use_anisotropic_filter ? 0xFF : 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// Set mesh color (only if lighting is disabled)
|
// Set mesh color (only if lighting is disabled)
|
||||||
if (!m_prop.colors.empty() && m_prop.glow < 0)
|
if (!m_prop.colors.empty() && m_prop.glow < 0)
|
||||||
@ -1975,7 +1980,9 @@ void GenericCAO::updateMeshCulling()
|
|||||||
|
|
||||||
if (m_prop.visual == "upright_sprite") {
|
if (m_prop.visual == "upright_sprite") {
|
||||||
// upright sprite has no backface culling
|
// upright sprite has no backface culling
|
||||||
node->setMaterialFlag(video::EMF_FRONT_FACE_CULLING, hidden);
|
node->forEachMaterial([=] (video::SMaterial &mat) {
|
||||||
|
mat.FrontfaceCulling = hidden;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1983,16 +1990,16 @@ void GenericCAO::updateMeshCulling()
|
|||||||
// Hide the mesh by culling both front and
|
// Hide the mesh by culling both front and
|
||||||
// back faces. Serious hackyness but it works for our
|
// back faces. Serious hackyness but it works for our
|
||||||
// purposes. This also preserves the skeletal armature.
|
// purposes. This also preserves the skeletal armature.
|
||||||
node->setMaterialFlag(video::EMF_BACK_FACE_CULLING,
|
node->forEachMaterial([] (video::SMaterial &mat) {
|
||||||
true);
|
mat.BackfaceCulling = true;
|
||||||
node->setMaterialFlag(video::EMF_FRONT_FACE_CULLING,
|
mat.FrontfaceCulling = true;
|
||||||
true);
|
});
|
||||||
} else {
|
} else {
|
||||||
// Restore mesh visibility.
|
// Restore mesh visibility.
|
||||||
node->setMaterialFlag(video::EMF_BACK_FACE_CULLING,
|
node->forEachMaterial([this] (video::SMaterial &mat) {
|
||||||
m_prop.backface_culling);
|
mat.BackfaceCulling = m_prop.backface_culling;
|
||||||
node->setMaterialFlag(video::EMF_FRONT_FACE_CULLING,
|
mat.FrontfaceCulling = false;
|
||||||
false);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,13 +36,16 @@ public:
|
|||||||
infostream<<"SmokePuffCSO: constructing"<<std::endl;
|
infostream<<"SmokePuffCSO: constructing"<<std::endl;
|
||||||
m_spritenode = smgr->addBillboardSceneNode(
|
m_spritenode = smgr->addBillboardSceneNode(
|
||||||
NULL, v2f(1,1), pos, -1);
|
NULL, v2f(1,1), pos, -1);
|
||||||
m_spritenode->setMaterialTexture(0,
|
video::ITexture *tex = env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png");
|
||||||
env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png"));
|
m_spritenode->forEachMaterial([tex] (video::SMaterial &mat) {
|
||||||
m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
|
mat.setTexture(0, tex);
|
||||||
m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
|
mat.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
//m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
|
mat.Lighting = false;
|
||||||
m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
|
mat.FogEnable = true;
|
||||||
m_spritenode->setMaterialFlag(video::EMF_FOG_ENABLE, true);
|
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
m_spritenode->setColor(video::SColor(255,0,0,0));
|
m_spritenode->setColor(video::SColor(255,0,0,0));
|
||||||
m_spritenode->setVisible(true);
|
m_spritenode->setVisible(true);
|
||||||
m_spritenode->setSize(size);
|
m_spritenode->setSize(size);
|
||||||
|
@ -112,7 +112,7 @@ Hud::Hud(Client *client, LocalPlayer *player,
|
|||||||
rangelim(g_settings->getS16("selectionbox_width"), 1, 5);
|
rangelim(g_settings->getS16("selectionbox_width"), 1, 5);
|
||||||
} else if (m_mode == HIGHLIGHT_HALO) {
|
} else if (m_mode == HIGHLIGHT_HALO) {
|
||||||
m_selection_material.setTexture(0, tsrc->getTextureForMesh("halo.png"));
|
m_selection_material.setTexture(0, tsrc->getTextureForMesh("halo.png"));
|
||||||
m_selection_material.setFlag(video::EMF_BACK_FACE_CULLING, true);
|
m_selection_material.BackfaceCulling = true;
|
||||||
} else {
|
} else {
|
||||||
m_selection_material.MaterialType = video::EMT_SOLID;
|
m_selection_material.MaterialType = video::EMT_SOLID;
|
||||||
}
|
}
|
||||||
|
@ -763,11 +763,13 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
|
|||||||
|
|
||||||
// Create material
|
// Create material
|
||||||
video::SMaterial material;
|
video::SMaterial material;
|
||||||
material.setFlag(video::EMF_LIGHTING, false);
|
material.Lighting = false;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
|
material.BackfaceCulling = true;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material.FogEnable = true;
|
||||||
material.setFlag(video::EMF_FOG_ENABLE, true);
|
|
||||||
material.setTexture(0, p.layer.texture);
|
material.setTexture(0, p.layer.texture);
|
||||||
|
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
|
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
material.MaterialType = m_shdrsrc->getShaderInfo(
|
material.MaterialType = m_shdrsrc->getShaderInfo(
|
||||||
|
@ -98,9 +98,11 @@ scene::IAnimatedMesh* createCubeMesh(v3f scale)
|
|||||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
buf->append(vertices + 4 * i, 4, indices, 6);
|
buf->append(vertices + 4 * i, 4, indices, 6);
|
||||||
// Set default material
|
// Set default material
|
||||||
buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
|
buf->getMaterial().Lighting = false;
|
||||||
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, 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) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
// Add mesh buffer to mesh
|
// Add mesh buffer to mesh
|
||||||
mesh->addMeshBuffer(buf);
|
mesh->addMeshBuffer(buf);
|
||||||
buf->drop();
|
buf->drop();
|
||||||
@ -406,8 +408,10 @@ scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
|
|||||||
for (u16 j = 0; j < 6; j++)
|
for (u16 j = 0; j < 6; j++)
|
||||||
{
|
{
|
||||||
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
scene::IMeshBuffer *buf = new scene::SMeshBuffer();
|
||||||
buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
|
buf->getMaterial().Lighting = false;
|
||||||
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
|
buf->getMaterial().forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
dst_mesh->addMeshBuffer(buf);
|
dst_mesh->addMeshBuffer(buf);
|
||||||
buf->drop();
|
buf->drop();
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,9 @@ void Minimap::drawMinimap(core::rect<s32> rect) {
|
|||||||
matrix.makeIdentity();
|
matrix.makeIdentity();
|
||||||
|
|
||||||
video::SMaterial &material = m_meshbuffer->getMaterial();
|
video::SMaterial &material = m_meshbuffer->getMaterial();
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, true);
|
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.TrilinearFilter = true;
|
||||||
|
});
|
||||||
material.Lighting = false;
|
material.Lighting = false;
|
||||||
material.TextureLayer[0].Texture = minimap_texture;
|
material.TextureLayer[0].Texture = minimap_texture;
|
||||||
material.TextureLayer[1].Texture = data->heightmap_texture;
|
material.TextureLayer[1].Texture = data->heightmap_texture;
|
||||||
|
@ -89,13 +89,15 @@ Particle::Particle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Texture
|
// Texture
|
||||||
m_material.setFlag(video::EMF_LIGHTING, false);
|
m_material.Lighting = false;
|
||||||
m_material.setFlag(video::EMF_BACK_FACE_CULLING, false);
|
m_material.BackfaceCulling = false;
|
||||||
m_material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
m_material.FogEnable = true;
|
||||||
m_material.setFlag(video::EMF_FOG_ENABLE, true);
|
m_material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
|
tex.BilinearFilter = false;
|
||||||
|
});
|
||||||
|
|
||||||
// correctly render layered transparent particles -- see #10398
|
// correctly render layered transparent particles -- see #10398
|
||||||
m_material.setFlag(video::EMF_ZWRITE_ENABLE, true);
|
m_material.ZWriteEnable = video::EZW_AUTO;
|
||||||
|
|
||||||
// enable alpha blending and set blend mode
|
// enable alpha blending and set blend mode
|
||||||
m_material.MaterialType = video::EMT_ONETEXTURE_BLEND;
|
m_material.MaterialType = video::EMT_ONETEXTURE_BLEND;
|
||||||
|
@ -113,7 +113,9 @@ void ShadowRenderer::disable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto node : m_shadow_node_array)
|
for (auto node : m_shadow_node_array)
|
||||||
node.node->setMaterialTexture(TEXTURE_LAYER_SHADOW, nullptr);
|
node.node->forEachMaterial([] (video::SMaterial &mat) {
|
||||||
|
mat.setTexture(TEXTURE_LAYER_SHADOW, nullptr);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowRenderer::initialize()
|
void ShadowRenderer::initialize()
|
||||||
@ -183,12 +185,16 @@ void ShadowRenderer::addNodeToShadowList(
|
|||||||
// node should never be ClientMap
|
// node should never be ClientMap
|
||||||
assert(strcmp(node->getName(), "ClientMap") != 0);
|
assert(strcmp(node->getName(), "ClientMap") != 0);
|
||||||
|
|
||||||
node->setMaterialTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
|
node->forEachMaterial([this] (video::SMaterial &mat) {
|
||||||
|
mat.setTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowRenderer::removeNodeFromShadowList(scene::ISceneNode *node)
|
void ShadowRenderer::removeNodeFromShadowList(scene::ISceneNode *node)
|
||||||
{
|
{
|
||||||
node->setMaterialTexture(TEXTURE_LAYER_SHADOW, nullptr);
|
node->forEachMaterial([] (video::SMaterial &mat) {
|
||||||
|
mat.setTexture(TEXTURE_LAYER_SHADOW, nullptr);
|
||||||
|
});
|
||||||
for (auto it = m_shadow_node_array.begin(); it != m_shadow_node_array.end();) {
|
for (auto it = m_shadow_node_array.begin(); it != m_shadow_node_array.end();) {
|
||||||
if (it->node == node) {
|
if (it->node == node) {
|
||||||
it = m_shadow_node_array.erase(it);
|
it = m_shadow_node_array.erase(it);
|
||||||
@ -258,7 +264,9 @@ void ShadowRenderer::updateSMTextures()
|
|||||||
assert(shadowMapTextureFinal != nullptr);
|
assert(shadowMapTextureFinal != nullptr);
|
||||||
|
|
||||||
for (auto &node : m_shadow_node_array)
|
for (auto &node : m_shadow_node_array)
|
||||||
node.node->setMaterialTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
|
node.node->forEachMaterial([this] (video::SMaterial &mat) {
|
||||||
|
mat.setTexture(TEXTURE_LAYER_SHADOW, shadowMapTextureFinal);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_shadow_node_array.empty()) {
|
if (!m_shadow_node_array.empty()) {
|
||||||
|
@ -50,9 +50,11 @@ static video::SMaterial baseMaterial()
|
|||||||
|
|
||||||
static inline void disableTextureFiltering(video::SMaterial &mat)
|
static inline void disableTextureFiltering(video::SMaterial &mat)
|
||||||
{
|
{
|
||||||
mat.setFlag(video::E_MATERIAL_FLAG::EMF_BILINEAR_FILTER, false);
|
mat.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
mat.setFlag(video::E_MATERIAL_FLAG::EMF_TRILINEAR_FILTER, false);
|
tex.BilinearFilter = false;
|
||||||
mat.setFlag(video::E_MATERIAL_FLAG::EMF_ANISOTROPIC_FILTER, false);
|
tex.TrilinearFilter = false;
|
||||||
|
tex.AnisotropicFilter = 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Sky::Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShaderSource *ssrc) :
|
Sky::Sky(s32 id, RenderingEngine *rendering_engine, ITextureSource *tsrc, IShaderSource *ssrc) :
|
||||||
|
@ -296,18 +296,15 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
|
|||||||
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
|
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
|
||||||
material.MaterialType = m_material_type;
|
material.MaterialType = m_material_type;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
|
material.BackfaceCulling = true;
|
||||||
// Enable bi/trilinear filtering only for high resolution textures
|
// Enable bi/trilinear filtering only for high resolution textures
|
||||||
if (dim.Width > 32) {
|
material.forEachTexture([this, &dim] (video::SMaterialLayer &tex) {
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, m_bilinear_filter);
|
tex.BilinearFilter = dim.Width > 32 && m_bilinear_filter;
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, m_trilinear_filter);
|
tex.TrilinearFilter = dim.Width > 32 && m_trilinear_filter;
|
||||||
} else {
|
tex.AnisotropicFilter = m_anisotropic_filter ? 0xFF : 0;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
});
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, false);
|
|
||||||
}
|
|
||||||
material.setFlag(video::EMF_ANISOTROPIC_FILTER, m_anisotropic_filter);
|
|
||||||
// mipmaps cause "thin black line" artifacts
|
// mipmaps cause "thin black line" artifacts
|
||||||
material.setFlag(video::EMF_USE_MIP_MAPS, false);
|
material.UseMipMaps = false;
|
||||||
if (m_enable_shaders) {
|
if (m_enable_shaders) {
|
||||||
material.setTexture(2, tsrc->getShaderFlagsTexture(false));
|
material.setTexture(2, tsrc->getShaderFlagsTexture(false));
|
||||||
}
|
}
|
||||||
@ -465,9 +462,11 @@ void WieldMeshSceneNode::setItem(const ItemStack &item, Client *client, bool che
|
|||||||
video::SMaterial &material = m_meshnode->getMaterial(i);
|
video::SMaterial &material = m_meshnode->getMaterial(i);
|
||||||
material.MaterialType = m_material_type;
|
material.MaterialType = m_material_type;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, cull_backface);
|
material.BackfaceCulling = cull_backface;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, m_bilinear_filter);
|
material.forEachTexture([this] (video::SMaterialLayer &tex) {
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, m_trilinear_filter);
|
tex.BilinearFilter = m_bilinear_filter;
|
||||||
|
tex.TrilinearFilter = m_trilinear_filter;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the color
|
// initialize the color
|
||||||
@ -558,9 +557,11 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh)
|
|||||||
m_meshnode->setMesh(mesh);
|
m_meshnode->setMesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_meshnode->setMaterialFlag(video::EMF_LIGHTING, m_lighting);
|
m_meshnode->forEachMaterial([this] (video::SMaterial &mat) {
|
||||||
// need to normalize normals when lighting is enabled (because of setScale())
|
mat.Lighting = m_lighting;
|
||||||
m_meshnode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, m_lighting);
|
// need to normalize normals when lighting is enabled (because of setScale())
|
||||||
|
mat.NormalizeNormals = m_lighting;
|
||||||
|
});
|
||||||
m_meshnode->setVisible(true);
|
m_meshnode->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,10 +654,12 @@ void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result)
|
|||||||
video::SMaterial &material = buf->getMaterial();
|
video::SMaterial &material = buf->getMaterial();
|
||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material.forEachTexture([] (video::SMaterialLayer &tex) {
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, false);
|
tex.BilinearFilter = false;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, cull_backface);
|
tex.TrilinearFilter = false;
|
||||||
material.setFlag(video::EMF_LIGHTING, false);
|
});
|
||||||
|
material.BackfaceCulling = cull_backface;
|
||||||
|
material.Lighting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rotateMeshXZby(mesh, -45);
|
rotateMeshXZby(mesh, -45);
|
||||||
@ -698,10 +701,10 @@ scene::SMesh *getExtrudedMesh(ITextureSource *tsrc,
|
|||||||
video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial();
|
video::SMaterial &material = mesh->getMeshBuffer(layer)->getMaterial();
|
||||||
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
material.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
|
||||||
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
|
material.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material.TextureLayer[0].BilinearFilter = false;
|
||||||
material.setFlag(video::EMF_TRILINEAR_FILTER, false);
|
material.TextureLayer[0].TrilinearFilter = false;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, true);
|
material.BackfaceCulling = true;
|
||||||
material.setFlag(video::EMF_LIGHTING, false);
|
material.Lighting = false;
|
||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ private:
|
|||||||
scene::IMeshSceneNode *m_meshnode = nullptr;
|
scene::IMeshSceneNode *m_meshnode = nullptr;
|
||||||
video::E_MATERIAL_TYPE m_material_type;
|
video::E_MATERIAL_TYPE m_material_type;
|
||||||
|
|
||||||
// True if EMF_LIGHTING should be enabled.
|
// True if SMaterial::Lighting should be enabled.
|
||||||
bool m_lighting;
|
bool m_lighting;
|
||||||
|
|
||||||
bool m_enable_shaders;
|
bool m_enable_shaders;
|
||||||
|
@ -66,11 +66,11 @@ void GUIScene::setTexture(u32 idx, video::ITexture *texture)
|
|||||||
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||||
material.MaterialTypeParam = 0.5f;
|
material.MaterialTypeParam = 0.5f;
|
||||||
material.TextureLayer[0].Texture = texture;
|
material.TextureLayer[0].Texture = texture;
|
||||||
material.setFlag(video::EMF_LIGHTING, false);
|
material.Lighting = false;
|
||||||
material.setFlag(video::EMF_FOG_ENABLE, true);
|
material.FogEnable = true;
|
||||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
material.TextureLayer[0].BilinearFilter = false;
|
||||||
material.setFlag(video::EMF_BACK_FACE_CULLING, false);
|
material.BackfaceCulling = false;
|
||||||
material.setFlag(video::EMF_ZWRITE_ENABLE, true);
|
material.ZWriteEnable = video::EZW_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIScene::draw()
|
void GUIScene::draw()
|
||||||
|
@ -1125,9 +1125,9 @@ core::array<scene::ISceneNode*> CGUITTFont::addTextSceneNode(const wchar_t* text
|
|||||||
|
|
||||||
// the default font material
|
// the default font material
|
||||||
SMaterial mat;
|
SMaterial mat;
|
||||||
mat.setFlag(video::EMF_LIGHTING, true);
|
mat.Lighting = true;
|
||||||
mat.setFlag(video::EMF_ZWRITE_ENABLE, false);
|
mat.ZWriteEnable = video::EZW_OFF;
|
||||||
mat.setFlag(video::EMF_NORMALIZE_NORMALS, true);
|
mat.NormalizeNormals = true;
|
||||||
mat.ColorMaterial = video::ECM_NONE;
|
mat.ColorMaterial = video::ECM_NONE;
|
||||||
mat.MaterialType = use_transparency ? video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_SOLID;
|
mat.MaterialType = use_transparency ? video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_SOLID;
|
||||||
mat.MaterialTypeParam = 0.01f;
|
mat.MaterialTypeParam = 0.01f;
|
||||||
|
Loading…
Reference in New Issue
Block a user