mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Drop never documented 'alpha' property from nodedef
Includes minimal support code for practical reasons. We'll need it for a slightly different purpose next commit.
This commit is contained in:
parent
e6e5910cb4
commit
edd8c3c664
@ -715,7 +715,6 @@ core.nodedef_default = {
|
|||||||
-- {name="", backface_culling=true},
|
-- {name="", backface_culling=true},
|
||||||
-- {name="", backface_culling=true},
|
-- {name="", backface_culling=true},
|
||||||
--},
|
--},
|
||||||
alpha = 255,
|
|
||||||
post_effect_color = {a=0, r=0, g=0, b=0},
|
post_effect_color = {a=0, r=0, g=0, b=0},
|
||||||
paramtype = "none",
|
paramtype = "none",
|
||||||
paramtype2 = "none",
|
paramtype2 = "none",
|
||||||
|
@ -51,23 +51,16 @@ for a=1,#alphas do
|
|||||||
groups = { dig_immediate = 3 },
|
groups = { dig_immediate = 3 },
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Transparency set via "alpha" parameter
|
-- Transparency set via texture modifier
|
||||||
minetest.register_node("testnodes:alpha_"..alpha, {
|
minetest.register_node("testnodes:alpha_"..alpha, {
|
||||||
description = S("Alpha Test Node (@1)", alpha),
|
description = S("Alpha Test Node (@1)", alpha),
|
||||||
-- It seems that only the liquid drawtype supports the alpha parameter
|
drawtype = "glasslike",
|
||||||
drawtype = "liquid",
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
tiles = {
|
tiles = {
|
||||||
"testnodes_alpha.png",
|
"testnodes_alpha.png^[opacity:" .. alpha,
|
||||||
},
|
},
|
||||||
alpha = alpha,
|
use_texture_alpha = true,
|
||||||
|
|
||||||
|
|
||||||
liquidtype = "source",
|
|
||||||
liquid_range = 0,
|
|
||||||
liquid_viscosity = 0,
|
|
||||||
liquid_alternative_source = "testnodes:alpha_"..alpha,
|
|
||||||
liquid_alternative_flowing = "testnodes:alpha_"..alpha,
|
|
||||||
groups = { dig_immediate = 3 },
|
groups = { dig_immediate = 3 },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -491,21 +491,6 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const
|
|||||||
writeU8(os, leveled_max);
|
writeU8(os, leveled_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentFeatures::correctAlpha(TileDef *tiles, int length)
|
|
||||||
{
|
|
||||||
// alpha == 0 means that the node is using texture alpha
|
|
||||||
if (alpha == 0 || alpha == 255)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
if (tiles[i].name.empty())
|
|
||||||
continue;
|
|
||||||
std::stringstream s;
|
|
||||||
s << tiles[i].name << "^[noalpha^[opacity:" << ((int)alpha);
|
|
||||||
tiles[i].name = s.str();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentFeatures::deSerialize(std::istream &is)
|
void ContentFeatures::deSerialize(std::istream &is)
|
||||||
{
|
{
|
||||||
// version detection
|
// version detection
|
||||||
@ -874,11 +859,6 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_liquid) {
|
if (is_liquid) {
|
||||||
// Vertex alpha is no longer supported, correct if necessary.
|
|
||||||
correctAlpha(tdef, 6);
|
|
||||||
correctAlpha(tdef_overlay, 6);
|
|
||||||
correctAlpha(tdef_spec, CF_SPECIAL_COUNT);
|
|
||||||
|
|
||||||
if (waving == 3) {
|
if (waving == 3) {
|
||||||
material_type = (alpha == 255) ? TILE_MATERIAL_WAVING_LIQUID_OPAQUE :
|
material_type = (alpha == 255) ? TILE_MATERIAL_WAVING_LIQUID_OPAQUE :
|
||||||
TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT;
|
TILE_MATERIAL_WAVING_LIQUID_TRANSPARENT;
|
||||||
|
@ -418,15 +418,6 @@ struct ContentFeatures
|
|||||||
void serialize(std::ostream &os, u16 protocol_version) const;
|
void serialize(std::ostream &os, u16 protocol_version) const;
|
||||||
void deSerialize(std::istream &is);
|
void deSerialize(std::istream &is);
|
||||||
|
|
||||||
/*!
|
|
||||||
* Since vertex alpha is no longer supported, this method
|
|
||||||
* adds opacity directly to the texture pixels.
|
|
||||||
*
|
|
||||||
* \param tiles array of the tile definitions.
|
|
||||||
* \param length length of tiles
|
|
||||||
*/
|
|
||||||
void correctAlpha(TileDef *tiles, int length);
|
|
||||||
|
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
/*
|
/*
|
||||||
* Checks if any tile texture has any transparent pixels.
|
* Checks if any tile texture has any transparent pixels.
|
||||||
|
@ -618,7 +618,10 @@ void read_content_features(lua_State *L, ContentFeatures &f, int index)
|
|||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
f.alpha = getintfield_default(L, index, "alpha", 255);
|
warn_if_field_exists(L, index, "alpha",
|
||||||
|
"Obsolete, only limited compatibility provided");
|
||||||
|
if (getintfield_default(L, index, "alpha", 255) != 255)
|
||||||
|
f.alpha = 0;
|
||||||
|
|
||||||
bool usealpha = getboolfield_default(L, index,
|
bool usealpha = getboolfield_default(L, index,
|
||||||
"use_texture_alpha", false);
|
"use_texture_alpha", false);
|
||||||
|
Loading…
Reference in New Issue
Block a user