master #7

Merged
BRNSystems merged 95 commits from Mirrorlandia_minetest/minetest:master into master 2024-01-28 00:16:42 +01:00
2 changed files with 12 additions and 5 deletions
Showing only changes of commit a7eaee77ca - Show all commits

@ -620,6 +620,8 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
infostream << "GenericCAO::addToScene(): " << m_prop.visual << std::endl; infostream << "GenericCAO::addToScene(): " << m_prop.visual << std::endl;
m_material_type_param = 0.5f; // May cut off alpha < 128 depending on m_material_type
if (m_enable_shaders) { if (m_enable_shaders) {
IShaderSource *shader_source = m_client->getShaderSource(); IShaderSource *shader_source = m_client->getShaderSource();
MaterialType material_type; MaterialType material_type;
@ -634,8 +636,12 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
u32 shader_id = shader_source->getShader("object_shader", material_type, NDT_NORMAL); u32 shader_id = shader_source->getShader("object_shader", material_type, NDT_NORMAL);
m_material_type = shader_source->getShaderInfo(shader_id).material; m_material_type = shader_source->getShaderInfo(shader_id).material;
} else { } else {
m_material_type = (m_prop.use_texture_alpha) ? if (m_prop.use_texture_alpha) {
video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; m_material_type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
m_material_type_param = 1.0f / 256.f; // minimal alpha for texture rendering
} else {
m_material_type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
}
} }
auto grabMatrixNode = [this] { auto grabMatrixNode = [this] {
@ -1341,7 +1347,7 @@ void GenericCAO::updateTextures(std::string mod)
video::SMaterial &material = m_spritenode->getMaterial(0); video::SMaterial &material = m_spritenode->getMaterial(0);
material.MaterialType = m_material_type; material.MaterialType = m_material_type;
material.MaterialTypeParam = 0.5f; material.MaterialTypeParam = m_material_type_param;
material.setTexture(0, tsrc->getTextureForMesh(texturestring)); 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
@ -1377,7 +1383,7 @@ void GenericCAO::updateTextures(std::string mod)
// 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 = m_material_type_param;
material.TextureLayers[0].Texture = texture; material.TextureLayers[0].Texture = texture;
material.Lighting = true; material.Lighting = true;
material.BackfaceCulling = m_prop.backface_culling; material.BackfaceCulling = m_prop.backface_culling;
@ -1421,7 +1427,7 @@ void GenericCAO::updateTextures(std::string 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 = m_material_type_param;
material.Lighting = false; material.Lighting = false;
material.setTexture(0, tsrc->getTextureForMesh(texturestring)); material.setTexture(0, tsrc->getTextureForMesh(texturestring));
material.getTextureMatrix(0).makeIdentity(); material.getTextureMatrix(0).makeIdentity();

@ -130,6 +130,7 @@ private:
bool m_is_visible = false; bool m_is_visible = false;
// Material // Material
video::E_MATERIAL_TYPE m_material_type; video::E_MATERIAL_TYPE m_material_type;
f32 m_material_type_param;
// Settings // Settings
bool m_enable_shaders = false; bool m_enable_shaders = false;