+ u8 i;
+ TileSpec tiles[6];
+ for (i = 0; i < 6; i++)
+ tiles[i] = getNodeTile(n, p, dirs[i], data);
+
+ TileSpec glass_tiles[6];
+ if (tiles[1].texture && tiles[2].texture && tiles[3].texture) {
+ glass_tiles[0] = tiles[2];
+ glass_tiles[1] = tiles[3];
+ glass_tiles[2] = tiles[1];
+ glass_tiles[3] = tiles[1];
+ glass_tiles[4] = tiles[1];
+ glass_tiles[5] = tiles[1];
+ } else {
+ for (i = 0; i < 6; i++)
+ glass_tiles[i] = tiles[1];
+ }
+
+ u8 param2 = n.getParam2();
+ bool H_merge = ! bool(param2 & 128);
+ bool V_merge = ! bool(param2 & 64);
+ param2 = param2 & 63;
+
+ u16 l = getInteriorLight(n, 1, nodedef);
+ video::SColor c = MapBlock_LightColor(255, l, f.light_source);
+ v3f pos = intToFloat(p, BS);
+ static const float a = BS / 2;
+ static const float g = a - 0.003;
+ static const float b = .876 * ( BS / 2 );
+
+ static const aabb3f frame_edges[12] = {
+ aabb3f( b, b,-a, a, a, a), // y+
+ aabb3f(-a, b,-a,-b, a, a), // y+
+ aabb3f( b,-a,-a, a,-b, a), // y-
+ aabb3f(-a,-a,-a,-b,-b, a), // y-
+ aabb3f( b,-a, b, a, a, a), // x+
+ aabb3f( b,-a,-a, a, a,-b), // x+
+ aabb3f(-a,-a, b,-b, a, a), // x-
+ aabb3f(-a,-a,-a,-b, a,-b), // x-
+ aabb3f(-a, b, b, a, a, a), // z+
+ aabb3f(-a,-a, b, a,-b, a), // z+
+ aabb3f(-a,-a,-a, a,-b,-b), // z-
+ aabb3f(-a, b,-a, a, a,-b) // z-
+ };
+ static const aabb3f glass_faces[6] = {
+ aabb3f(-g, g,-g, g, g, g), // y+
+ aabb3f(-g,-g,-g, g,-g, g), // y-
+ aabb3f( g,-g,-g, g, g, g), // x+
+ aabb3f(-g,-g,-g,-g, g, g), // x-
+ aabb3f(-g,-g, g, g, g, g), // z+
+ aabb3f(-g,-g,-g, g, g,-g) // z-
+ };
+
+ // table of node visible faces, 0 = invisible
+ int visible_faces[6] = {0,0,0,0,0,0};
+
+ // table of neighbours, 1 = same type, checked with g_26dirs
+ int nb[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+ // g_26dirs to check when only horizontal merge is allowed
+ int nb_H_dirs[8] = {0,2,3,5,10,11,12,13};
+
+ content_t current = n.getContent();
+ content_t n2c;
+ MapNode n2;
+ v3s16 n2p;
+
+ // neighbours checks for frames visibility
+
+ if (!H_merge && V_merge) {
+ n2p = blockpos_nodes + p + g_26dirs[1];
+ n2 = data->m_vmanip.getNodeNoEx(n2p);
+ n2c = n2.getContent();
+ if (n2c == current || n2c == CONTENT_IGNORE)
+ nb[1] = 1;
+ n2p = blockpos_nodes + p + g_26dirs[4];
+ n2 = data->m_vmanip.getNodeNoEx(n2p);
+ n2c = n2.getContent();
+ if (n2c == current || n2c == CONTENT_IGNORE)
+ nb[4] = 1;
+ } else if (H_merge && !V_merge) {
+ for(i = 0; i < 8; i++) {
+ n2p = blockpos_nodes + p + g_26dirs[nb_H_dirs[i]];
+ n2 = data->m_vmanip.getNodeNoEx(n2p);
+ n2c = n2.getContent();
+ if (n2c == current || n2c == CONTENT_IGNORE)
+ nb[nb_H_dirs[i]] = 1;