Add new leaves style - simple (glasslike drawtype)
parent
b0784ba871
commit
39439cbd3d
|
@ -17,6 +17,17 @@
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local leaves_style_labels = {
|
||||
fgettext("Opaque Leaves"),
|
||||
fgettext("Simple Leaves"),
|
||||
fgettext("Fancy Leaves")
|
||||
}
|
||||
|
||||
local leaves_style = {
|
||||
{leaves_style_labels[1]..","..leaves_style_labels[2]..","..leaves_style_labels[3]},
|
||||
{"opaque", "simple", "fancy"},
|
||||
}
|
||||
|
||||
local dd_filter_labels = {
|
||||
fgettext("No Filter"),
|
||||
fgettext("Bilinear Filter"),
|
||||
|
@ -39,6 +50,16 @@ local mipmap = {
|
|||
{"", "mip_map", "anisotropic_filter"},
|
||||
}
|
||||
|
||||
local function getLeavesStyleSettingIndex()
|
||||
local style = core.setting_get("leaves_style")
|
||||
if (style == leaves_style[2][3]) then
|
||||
return 3
|
||||
elseif (style == leaves_style[2][2]) then
|
||||
return 2
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
local function getFilterSettingIndex()
|
||||
if (core.setting_get(filters[2][3]) == "true") then
|
||||
return 3
|
||||
|
@ -177,21 +198,21 @@ local function formspec(tabview, name, tabdata)
|
|||
end
|
||||
|
||||
local tab_string =
|
||||
"box[0,0;3.5,3.9;#999999]" ..
|
||||
"box[0,0;3.5,4.0;#999999]" ..
|
||||
"checkbox[0.25,0;cb_smooth_lighting;".. fgettext("Smooth Lighting")
|
||||
.. ";".. dump(core.setting_getbool("smooth_lighting")) .. "]"..
|
||||
"checkbox[0.25,0.5;cb_particles;".. fgettext("Enable Particles") .. ";"
|
||||
.. dump(core.setting_getbool("enable_particles")) .. "]"..
|
||||
"checkbox[0.25,1;cb_3d_clouds;".. fgettext("3D Clouds") .. ";"
|
||||
.. dump(core.setting_getbool("enable_3d_clouds")) .. "]"..
|
||||
"checkbox[0.25,1.5;cb_fancy_trees;".. fgettext("Fancy Trees") .. ";"
|
||||
.. dump(core.setting_getbool("new_style_leaves")) .. "]"..
|
||||
"checkbox[0.25,2.0;cb_opaque_water;".. fgettext("Opaque Water") .. ";"
|
||||
"checkbox[0.25,1.5;cb_opaque_water;".. fgettext("Opaque Water") .. ";"
|
||||
.. dump(core.setting_getbool("opaque_water")) .. "]"..
|
||||
"checkbox[0.25,2.5;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
|
||||
"checkbox[0.25,2.0;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
|
||||
.. dump(core.setting_getbool("connected_glass")) .. "]"..
|
||||
"checkbox[0.25,3.0;cb_node_highlighting;".. fgettext("Node Highlighting") .. ";"
|
||||
"checkbox[0.25,2.5;cb_node_highlighting;".. fgettext("Node Highlighting") .. ";"
|
||||
.. dump(core.setting_getbool("enable_node_highlighting")) .. "]"..
|
||||
"dropdown[0.25,3.2;3.3;dd_leaves_style;" .. leaves_style[1][1] .. ";"
|
||||
.. getLeavesStyleSettingIndex() .. "]" ..
|
||||
"box[3.75,0;3.75,3.45;#999999]" ..
|
||||
"label[3.85,0.1;".. fgettext("Texturing:") .. "]"..
|
||||
"dropdown[3.85,0.55;3.85;dd_filters;" .. filters[1][1] .. ";"
|
||||
|
@ -353,7 +374,18 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||
core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"])
|
||||
ddhandled = true
|
||||
end
|
||||
|
||||
if fields["dd_leaves_style"] == leaves_style_labels[3] then
|
||||
core.setting_set("leaves_style", leaves_style[2][3])
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_leaves_style"] == leaves_style_labels[2] then
|
||||
core.setting_set("leaves_style", leaves_style[2][2])
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_leaves_style"] == leaves_style_labels[1] then
|
||||
core.setting_set("leaves_style", leaves_style[2][1])
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_video_driver"] then
|
||||
core.setting_set("video_driver",
|
||||
video_driver_fname_to_name(fields["dd_video_driver"]))
|
||||
|
|
|
@ -108,8 +108,11 @@
|
|||
#liquid_queue_purge_time = 0
|
||||
# Liquid update interval in seconds
|
||||
#liquid_update = 1.0
|
||||
# Enable transparent leaf textures, disable for speed
|
||||
#new_style_leaves = true
|
||||
# Leaves style:
|
||||
# fancy - all faces visible
|
||||
# simple - only outer faces, if defined special_tiles are used
|
||||
# opaque - disable transparency
|
||||
#leaves_style = fancy
|
||||
# Connects glass if supported by node
|
||||
#connected_glass = false
|
||||
# Enable smooth lighting with simple ambient occlusion.
|
||||
|
|
|
@ -107,7 +107,7 @@ void set_default_settings(Settings *settings)
|
|||
settings->setDefault("fov", "72");
|
||||
settings->setDefault("view_bobbing", "true");
|
||||
settings->setDefault("new_style_water", "false");
|
||||
settings->setDefault("new_style_leaves", "true");
|
||||
settings->setDefault("leaves_style", "fancy");
|
||||
settings->setDefault("connected_glass", "false");
|
||||
settings->setDefault("smooth_lighting", "true");
|
||||
settings->setDefault("display_gamma", "1.8");
|
||||
|
|
|
@ -780,7 +780,6 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
|
|||
scene::IMeshManipulator* meshmanip = smgr->getMeshManipulator();
|
||||
|
||||
bool new_style_water = g_settings->getBool("new_style_water");
|
||||
bool new_style_leaves = g_settings->getBool("new_style_leaves");
|
||||
bool connected_glass = g_settings->getBool("connected_glass");
|
||||
bool opaque_water = g_settings->getBool("opaque_water");
|
||||
bool enable_shaders = g_settings->getBool("enable_shaders");
|
||||
|
@ -788,6 +787,7 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
|
|||
bool enable_parallax_occlusion = g_settings->getBool("enable_parallax_occlusion");
|
||||
bool enable_mesh_cache = g_settings->getBool("enable_mesh_cache");
|
||||
bool enable_minimap = g_settings->getBool("enable_minimap");
|
||||
std::string leaves_style = g_settings->get("leaves_style");
|
||||
|
||||
bool use_normal_texture = enable_shaders &&
|
||||
(enable_bumpmapping || enable_parallax_occlusion);
|
||||
|
@ -860,10 +860,18 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
|
|||
f->visual_solidness = 1;
|
||||
break;
|
||||
case NDT_ALLFACES_OPTIONAL:
|
||||
if (new_style_leaves) {
|
||||
if (leaves_style == "fancy") {
|
||||
f->drawtype = NDT_ALLFACES;
|
||||
f->solidness = 0;
|
||||
f->visual_solidness = 1;
|
||||
} else if (leaves_style == "simple") {
|
||||
for (u32 j = 0; j < 6; j++) {
|
||||
if (f->tiledef_special[j].name != "")
|
||||
tiledef[j].name = f->tiledef_special[j].name;
|
||||
}
|
||||
f->drawtype = NDT_GLASSLIKE;
|
||||
f->solidness = 0;
|
||||
f->visual_solidness = 1;
|
||||
} else {
|
||||
f->drawtype = NDT_NORMAL;
|
||||
f->solidness = 2;
|
||||
|
|
Loading…
Reference in New Issue