Add optional framed glasslike drawtype

This commit is contained in:
BlockMen 2014-09-27 18:16:26 +02:00
parent e9c9b66ae9
commit f48f686930
9 changed files with 37 additions and 14 deletions

View File

@ -132,18 +132,18 @@ local function formspec(tabview, name, tabdata)
local tab_string = local tab_string =
"vertlabel[0,-0.25;" .. fgettext("SETTINGS") .. "]" .. "vertlabel[0,-0.25;" .. fgettext("SETTINGS") .. "]" ..
"box[0.75,0;3.25,4;#999999]" .. "box[0.75,0;3.25,4;#999999]" ..
"checkbox[1,0;cb_fancy_trees;".. fgettext("Fancy Trees") .. ";" "checkbox[1,0;cb_smooth_lighting;".. fgettext("Smooth Lighting")
.. dump(core.setting_getbool("new_style_leaves")) .. "]"..
"checkbox[1,0.5;cb_smooth_lighting;".. fgettext("Smooth Lighting")
.. ";".. dump(core.setting_getbool("smooth_lighting")) .. "]".. .. ";".. dump(core.setting_getbool("smooth_lighting")) .. "]"..
"checkbox[1,0.5;cb_particles;".. fgettext("Enable Particles") .. ";"
.. dump(core.setting_getbool("enable_particles")) .. "]"..
"checkbox[1,1;cb_3d_clouds;".. fgettext("3D Clouds") .. ";" "checkbox[1,1;cb_3d_clouds;".. fgettext("3D Clouds") .. ";"
.. dump(core.setting_getbool("enable_3d_clouds")) .. "]".. .. dump(core.setting_getbool("enable_3d_clouds")) .. "]"..
"checkbox[1,1.5;cb_opaque_water;".. fgettext("Opaque Water") .. ";" "checkbox[1,1.5;cb_fancy_trees;".. fgettext("Fancy Trees") .. ";"
.. dump(core.setting_getbool("new_style_leaves")) .. "]"..
"checkbox[1,2.0;cb_opaque_water;".. fgettext("Opaque Water") .. ";"
.. dump(core.setting_getbool("opaque_water")) .. "]".. .. dump(core.setting_getbool("opaque_water")) .. "]"..
"checkbox[1,2.0;cb_pre_ivis;".. fgettext("Preload item visuals") .. ";" "checkbox[1,2.5;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
.. dump(core.setting_getbool("preload_item_visuals")) .. "]".. .. dump(core.setting_getbool("connected_glass")) .. "]"..
"checkbox[1,2.5;cb_particles;".. fgettext("Enable Particles") .. ";"
.. dump(core.setting_getbool("enable_particles")) .. "]"..
"dropdown[1,3.25;3;dd_video_driver;" "dropdown[1,3.25;3;dd_video_driver;"
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" .. .. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
"tooltip[dd_video_driver;" .. "tooltip[dd_video_driver;" ..
@ -259,8 +259,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
end end
return true return true
end end
if fields["cb_pre_ivis"] then if fields["cb_connected_glass"] then
core.setting_set("preload_item_visuals", fields["cb_pre_ivis"]) core.setting_set("connected_glass", fields["cb_connected_glass"])
return true return true
end end
if fields["cb_particles"] then if fields["cb_particles"] then

View File

@ -406,8 +406,7 @@ Nodes can also contain extra data. See "Node Metadata".
Node drawtypes Node drawtypes
--------------- ---------------
There are a bunch of different looking node types. These are mostly just There are a bunch of different looking node types.
copied from Minetest 0.3; more may be made in the future.
Look for examples in games/minimal or games/minetest_game. Look for examples in games/minimal or games/minetest_game.
@ -417,6 +416,7 @@ Look for examples in games/minimal or games/minetest_game.
- flowingliquid - flowingliquid
- glasslike - glasslike
- glasslike_framed - glasslike_framed
- glasslike_framed_optional
- allfaces - allfaces
- allfaces_optional - allfaces_optional
- torchlike - torchlike
@ -427,6 +427,8 @@ Look for examples in games/minimal or games/minetest_game.
- raillike - raillike
- nodebox -- See below. EXPERIMENTAL - nodebox -- See below. EXPERIMENTAL
*_optional drawtypes need less rendering time if deactivated (always client side)
Node boxes Node boxes
----------- -----------
Node selection boxes are defined using "node boxes" Node selection boxes are defined using "node boxes"

View File

@ -101,6 +101,8 @@
#liquid_update = 1.0 #liquid_update = 1.0
# Enable nice leaves; disable for speed # Enable nice leaves; disable for speed
#new_style_leaves = true #new_style_leaves = true
# Connects glass if supported by node
#connected_glass = false
# Enable smooth lighting with simple ambient occlusion; # Enable smooth lighting with simple ambient occlusion;
# disable for speed or for different looks. # disable for speed or for different looks.
#smooth_lighting = true #smooth_lighting = true

View File

@ -794,6 +794,10 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
collector.append(tile, vertices, 4, indices, 6); collector.append(tile, vertices, 4, indices, 6);
} }
break;} break;}
case NDT_GLASSLIKE_FRAMED_OPTIONAL:
// This is always pre-converted to something else
assert(0);
break;
case NDT_GLASSLIKE_FRAMED: case NDT_GLASSLIKE_FRAMED:
{ {
static const v3s16 dirs[6] = { static const v3s16 dirs[6] = {

View File

@ -100,6 +100,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("view_bobbing", "true"); settings->setDefault("view_bobbing", "true");
settings->setDefault("new_style_water", "false"); settings->setDefault("new_style_water", "false");
settings->setDefault("new_style_leaves", "true"); settings->setDefault("new_style_leaves", "true");
settings->setDefault("connected_glass", "false");
settings->setDefault("smooth_lighting", "true"); settings->setDefault("smooth_lighting", "true");
settings->setDefault("texture_path", ""); settings->setDefault("texture_path", "");
settings->setDefault("shader_path", ""); settings->setDefault("shader_path", "");

View File

@ -607,6 +607,7 @@ public:
bool new_style_water = g_settings->getBool("new_style_water"); bool new_style_water = g_settings->getBool("new_style_water");
bool new_style_leaves = g_settings->getBool("new_style_leaves"); 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 opaque_water = g_settings->getBool("opaque_water");
bool enable_shaders = g_settings->getBool("enable_shaders"); bool enable_shaders = g_settings->getBool("enable_shaders");
bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping"); bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
@ -666,6 +667,15 @@ public:
f->solidness = 0; f->solidness = 0;
f->visual_solidness = 1; f->visual_solidness = 1;
break; break;
case NDT_GLASSLIKE_FRAMED_OPTIONAL:
f->solidness = 0;
f->visual_solidness = 1;
if (connected_glass) {
f->drawtype = NDT_GLASSLIKE_FRAMED;
} else {
f->drawtype = NDT_GLASSLIKE;
}
break;
case NDT_ALLFACES: case NDT_ALLFACES:
f->solidness = 0; f->solidness = 0;
f->visual_solidness = 1; f->visual_solidness = 1;

View File

@ -149,7 +149,9 @@ enum NodeDrawType
NDT_GLASSLIKE_FRAMED, // Glass-like, draw connected frames and all all NDT_GLASSLIKE_FRAMED, // Glass-like, draw connected frames and all all
// visible faces // visible faces
// uses 2 textures, one for frames, second for faces // uses 2 textures, one for frames, second for faces
NDT_FIRELIKE, // Draw faces slightly rotated and only on connecting nodes NDT_FIRELIKE, // Draw faces slightly rotated and only on connecting nodes,
NDT_GLASSLIKE_FRAMED_OPTIONAL, // enabled -> connected, disabled -> Glass-like
// uses 2 textures, one for frames, second for faces
}; };
#define CF_SPECIAL_COUNT 6 #define CF_SPECIAL_COUNT 6

View File

@ -35,6 +35,7 @@ struct EnumString ScriptApiNode::es_DrawType[] =
{NDT_FLOWINGLIQUID, "flowingliquid"}, {NDT_FLOWINGLIQUID, "flowingliquid"},
{NDT_GLASSLIKE, "glasslike"}, {NDT_GLASSLIKE, "glasslike"},
{NDT_GLASSLIKE_FRAMED, "glasslike_framed"}, {NDT_GLASSLIKE_FRAMED, "glasslike_framed"},
{NDT_GLASSLIKE_FRAMED_OPTIONAL, "glasslike_framed_optional"},
{NDT_ALLFACES, "allfaces"}, {NDT_ALLFACES, "allfaces"},
{NDT_ALLFACES_OPTIONAL, "allfaces_optional"}, {NDT_ALLFACES_OPTIONAL, "allfaces_optional"},
{NDT_TORCHLIKE, "torchlike"}, {NDT_TORCHLIKE, "torchlike"},

View File

@ -645,7 +645,8 @@ ShaderInfo generate_shader(std::string name, u8 material_type, u8 drawtype,
"NDT_RAILLIKE", "NDT_RAILLIKE",
"NDT_NODEBOX", "NDT_NODEBOX",
"NDT_GLASSLIKE_FRAMED", "NDT_GLASSLIKE_FRAMED",
"NDT_FIRELIKE" "NDT_FIRELIKE",
"NDT_GLASSLIKE_FRAMED_OPTIONAL"
}; };
for (int i = 0; i < 14; i++){ for (int i = 0; i < 14; i++){