area_store_custom_ids = true,
add_entity_with_staticdata = true,
no_chat_message_prediction = true,
+ object_use_texture_alpha = true,
}
function core.has_feature(arg)
chat_send_player_param3 = true,
get_all_craft_recipes_works = true,
use_texture_alpha = true,
- -- ^ The transparency channel of textures can be used optionally
+ -- ^ The transparency channel of textures can optionally be used on nodes
no_legacy_abms = true,
-- ^ Tree and grass ABMs are no longer done from C++
texture_names_parens = true,
-- ^ add_entity supports passing initial staticdata to on_activate
no_chat_message_prediction = true,
-- ^ Chat messages are no longer predicted
+ object_use_texture_alpha = true
+ -- ^ The transparency channel of textures can optionally be used on
+ -- objects (ie: players and lua entities)
}
* `minetest.has_feature(arg)`: returns `boolean, missing_features`
* `arg`: string or table in format `{foo=true, bar=true}`
-- ^ "wielditem" expects 'textures = {itemname}' (see 'visual' above).
colors = {},
-- ^ Number of required colors depends on visual.
+ use_texture_alpha = false,
+ -- ^ Use texture's alpha channel, excludes "upright_sprite" and "wielditem"
+ -- ^ Note: currently causes visual issues when viewed through other
+ -- ^ semi-transparent materials such as water.
spritediv = {x = 1, y = 1},
-- ^ Used with spritesheet textures for animation and/or frame selection
-- according to position relative to player.
return;
}
+ video::E_MATERIAL_TYPE material_type = (m_prop.use_texture_alpha) ?
+ video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+
if (m_prop.visual == "sprite") {
infostream<<"GenericCAO::addToScene(): single_sprite"<<std::endl;
m_spritenode = RenderingEngine::get_scene_manager()->addBillboardSceneNode(
tsrc->getTextureForMesh("unknown_node.png"));
m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
- m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
+ m_spritenode->setMaterialType(material_type);
m_spritenode->setMaterialFlag(video::EMF_FOG_ENABLE, true);
u8 li = m_last_light;
m_spritenode->setColor(video::SColor(255,li,li,li));
m_meshnode->setMaterialFlag(video::EMF_LIGHTING, false);
m_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
- m_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
+ m_meshnode->setMaterialType(material_type);
m_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true);
}
else if(m_prop.visual == "mesh") {
setAnimatedMeshColor(m_animated_meshnode, video::SColor(255,li,li,li));
- bool backface_culling = m_prop.backface_culling;
- if (m_is_player)
- backface_culling = false;
-
m_animated_meshnode->setMaterialFlag(video::EMF_LIGHTING, true);
m_animated_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
- m_animated_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
+ m_animated_meshnode->setMaterialType(material_type);
m_animated_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true);
- m_animated_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING, backface_culling);
+ m_animated_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING,
+ m_prop.backface_culling);
}
else
errorstream<<"GenericCAO::addToScene(): Could not load mesh "<<m_prop.mesh<<std::endl;
m_current_texture_modifier = mod;
m_glow = m_prop.glow;
+ video::E_MATERIAL_TYPE material_type = (m_prop.use_texture_alpha) ?
+ video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+
if (m_spritenode) {
if (m_prop.visual == "sprite") {
std::string texturestring = "unknown_node.png";
if (!m_prop.textures.empty())
texturestring = m_prop.textures[0];
texturestring += mod;
+ m_spritenode->getMaterial(0).MaterialType = material_type;
m_spritenode->setMaterialTexture(0,
tsrc->getTextureForMesh(texturestring));
// Set material flags and texture
video::SMaterial& material = m_animated_meshnode->getMaterial(i);
+ material.MaterialType = material_type;
material.TextureLayer[0].Texture = texture;
material.setFlag(video::EMF_LIGHTING, true);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
+ material.setFlag(video::EMF_BACK_FACE_CULLING, m_prop.backface_culling);
// don't filter low-res textures, makes them look blurry
// player models have a res of 64
// Set material flags and texture
video::SMaterial& material = m_meshnode->getMaterial(i);
+ material.MaterialType = material_type;
material.setFlag(video::EMF_LIGHTING, false);
material.setFlag(video::EMF_BILINEAR_FILTER, false);
material.setTexture(0,
m_prop.eye_height = 1.625f;
// End of default appearance
m_prop.is_visible = true;
+ m_prop.backface_culling = false;
m_prop.makes_footstep_sound = true;
m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT * BS;
m_hp = m_prop.hp_max;
os << ", static_save=" << static_save;
os << ", eye_height=" << eye_height;
os << ", zoom_fov=" << zoom_fov;
+ os << ", use_texture_alpha=" << use_texture_alpha;
return os.str();
}
writeU16(os, breath_max);
writeF1000(os, eye_height);
writeF1000(os, zoom_fov);
+ writeU8(os, use_texture_alpha);
// Add stuff only at the bottom.
// Never remove anything, because we don't want new versions of this
breath_max = readU16(is);
eye_height = readF1000(is);
zoom_fov = readF1000(is);
+ use_texture_alpha = readU8(is);
}
bool static_save = true;
float eye_height = 1.625f;
float zoom_fov = 0.0f;
+ bool use_texture_alpha = false;
ObjectProperties();
std::string dump();
lua_pop(L, 1);
getfloatfield(L, -1, "zoom_fov", prop->zoom_fov);
+ getboolfield(L, -1, "use_texture_alpha", prop->use_texture_alpha);
}
/******************************************************************************/
lua_setfield(L, -2, "wield_item");
lua_pushnumber(L, prop->zoom_fov);
lua_setfield(L, -2, "zoom_fov");
+ lua_pushboolean(L, prop->use_texture_alpha);
+ lua_setfield(L, -2, "use_texture_alpha");
}
/******************************************************************************/