Add optional framed glasslike drawtype 1694/head
authorBlockMen <nmuelll@web.de>
Sat, 27 Sep 2014 16:16:26 +0000 (18:16 +0200)
committerBlockMen <nmuelll@web.de>
Thu, 2 Oct 2014 09:35:15 +0000 (11:35 +0200)
builtin/mainmenu/tab_settings.lua
doc/lua_api.txt
minetest.conf.example
src/content_mapblock.cpp
src/defaultsettings.cpp
src/nodedef.cpp
src/nodedef.h
src/script/cpp_api/s_node.cpp
src/shader.cpp

index d97dd0051221d99953eed120b644f44691a24f94..630267478e812231a70c200074cd810661b83954 100644 (file)
@@ -132,18 +132,18 @@ local function formspec(tabview, name, tabdata)
        local tab_string =
                "vertlabel[0,-0.25;" .. fgettext("SETTINGS") .. "]" ..
                "box[0.75,0;3.25,4;#999999]" ..
-               "checkbox[1,0;cb_fancy_trees;".. fgettext("Fancy Trees") .. ";"
-                               .. dump(core.setting_getbool("new_style_leaves")) .. "]"..
-               "checkbox[1,0.5;cb_smooth_lighting;".. fgettext("Smooth Lighting")
+               "checkbox[1,0;cb_smooth_lighting;".. fgettext("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") .. ";"
                                .. 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")) .. "]"..
-               "checkbox[1,2.0;cb_pre_ivis;".. fgettext("Preload item visuals") .. ";"
-                               .. dump(core.setting_getbool("preload_item_visuals"))   .. "]"..
-               "checkbox[1,2.5;cb_particles;".. fgettext("Enable Particles") .. ";"
-                               .. dump(core.setting_getbool("enable_particles"))       .. "]"..
+               "checkbox[1,2.5;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
+                               .. dump(core.setting_getbool("connected_glass"))        .. "]"..
                "dropdown[1,3.25;3;dd_video_driver;"
                        .. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
                "tooltip[dd_video_driver;" ..
@@ -259,8 +259,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
                end
                return true
        end
-       if fields["cb_pre_ivis"] then
-               core.setting_set("preload_item_visuals", fields["cb_pre_ivis"])
+       if fields["cb_connected_glass"] then
+               core.setting_set("connected_glass", fields["cb_connected_glass"])
                return true
        end
        if fields["cb_particles"] then
index 0cdca506f23ad37005c033c2bd0e8025fc223344..4c3a9d0743023e39f9b8dbf85dd3cf66735f6813 100644 (file)
@@ -406,8 +406,7 @@ Nodes can also contain extra data. See "Node Metadata".
 
 Node drawtypes
 ---------------
-There are a bunch of different looking node types. These are mostly just
-copied from Minetest 0.3; more may be made in the future.
+There are a bunch of different looking node types.
 
 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
 - glasslike
 - glasslike_framed
+- glasslike_framed_optional
 - allfaces
 - allfaces_optional
 - torchlike
@@ -427,6 +427,8 @@ Look for examples in games/minimal or games/minetest_game.
 - raillike
 - nodebox -- See below. EXPERIMENTAL
 
+*_optional drawtypes need less rendering time if deactivated (always client side)
+
 Node boxes
 -----------
 Node selection boxes are defined using "node boxes"
index 689596fc07e841b626705b993c13ef6b39975890..3e7689c7655eb5e1ba05d9cfbd8e3e2b2b2375d4 100644 (file)
 #liquid_update = 1.0
 # Enable nice leaves; disable for speed
 #new_style_leaves = true
+# Connects glass if supported by node
+#connected_glass = false
 # Enable smooth lighting with simple ambient occlusion;
 # disable for speed or for different looks.
 #smooth_lighting = true
index 6d7a69bb8d0231a68d7955019d6da4f7462b439e..c84e75ac072f527a91da53df1ba58525d53fdb95 100644 (file)
@@ -794,6 +794,10 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
                                collector.append(tile, vertices, 4, indices, 6);
                        }
                break;}
+               case NDT_GLASSLIKE_FRAMED_OPTIONAL:
+                       // This is always pre-converted to something else
+                       assert(0);
+                       break;
                case NDT_GLASSLIKE_FRAMED:
                {
                        static const v3s16 dirs[6] = {
index ccde6b5779339f5246f2a00fb7157ea0ce80bcce..dc4a59be32b6bb05a450f22815736ea9ae648183 100644 (file)
@@ -100,6 +100,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("view_bobbing", "true");
        settings->setDefault("new_style_water", "false");
        settings->setDefault("new_style_leaves", "true");
+       settings->setDefault("connected_glass", "false");
        settings->setDefault("smooth_lighting", "true");
        settings->setDefault("texture_path", "");
        settings->setDefault("shader_path", "");
index 31156ce68ce55a2a0fc03df85145dc44bcf50de5..8a5cff3bf40781f58642e565496c1b688358e7ca 100644 (file)
@@ -607,6 +607,7 @@ public:
 
                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");
                bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
@@ -666,6 +667,15 @@ public:
                                f->solidness = 0;
                                f->visual_solidness = 1;
                                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:
                                f->solidness = 0;
                                f->visual_solidness = 1;
index 262f4bc4e945d6a6aeee1828842bf13667b9b1ab..b737e02379f77a5adf2f956acba25a9f6c42469f 100644 (file)
@@ -149,7 +149,9 @@ enum NodeDrawType
        NDT_GLASSLIKE_FRAMED, // Glass-like, draw connected frames and all all
                              // visible 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
index 2b8d02d7494f7c3acc8a28e515b77d0b1079cb93..8c9b46c2a88277990f7c7af197fda7393da30dd3 100644 (file)
@@ -35,6 +35,7 @@ struct EnumString ScriptApiNode::es_DrawType[] =
                {NDT_FLOWINGLIQUID, "flowingliquid"},
                {NDT_GLASSLIKE, "glasslike"},
                {NDT_GLASSLIKE_FRAMED, "glasslike_framed"},
+               {NDT_GLASSLIKE_FRAMED_OPTIONAL, "glasslike_framed_optional"},
                {NDT_ALLFACES, "allfaces"},
                {NDT_ALLFACES_OPTIONAL, "allfaces_optional"},
                {NDT_TORCHLIKE, "torchlike"},
index cf3bbd76174239332573a337431375087de5f146..1670458040f07da0052fa9e5fa7d6f544319a7f7 100644 (file)
@@ -645,7 +645,8 @@ ShaderInfo generate_shader(std::string name, u8 material_type, u8 drawtype,
                "NDT_RAILLIKE",
                "NDT_NODEBOX",
                "NDT_GLASSLIKE_FRAMED",
-               "NDT_FIRELIKE"
+               "NDT_FIRELIKE",
+               "NDT_GLASSLIKE_FRAMED_OPTIONAL"
        };
        
        for (int i = 0; i < 14; i++){