@@ -50,9 +50,9 @@ void makeCuboid(MeshCollector *collector, const aabb3f &box,
50
50
51
51
v3f min = box.MinEdge ;
52
52
v3f max = box.MaxEdge ;
53
-
54
-
55
-
53
+
54
+
55
+
56
56
if (txc == NULL ) {
57
57
static const f32 txc_default[24 ] = {
58
58
0 ,0 ,1 ,1 ,
@@ -350,7 +350,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
350
350
*/
351
351
if (top_is_same_liquid)
352
352
continue ;
353
-
353
+
354
354
video::S3DVertex vertices[4 ] =
355
355
{
356
356
video::S3DVertex (-BS/2 ,0 ,BS/2 , 0 ,0 ,0 , c, 0 ,1 ),
@@ -383,7 +383,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
383
383
content_t c_source = nodedef->getId (f.liquid_alternative_source );
384
384
if (ntop.getContent () == c_flowing || ntop.getContent () == c_source)
385
385
top_is_same_liquid = true ;
386
-
386
+
387
387
u16 l = 0 ;
388
388
// If this liquid emits light and doesn't contain light, draw
389
389
// it at what it emits, for an increased effect
@@ -399,7 +399,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
399
399
else
400
400
l = getInteriorLight (n, 0 , nodedef);
401
401
video::SColor c = MapBlock_LightColor (f.alpha , l, f.light_source );
402
-
402
+
403
403
u8 range = rangelim (nodedef->get (c_flowing).liquid_range , 1 , 8 );
404
404
405
405
// Neighbor liquid levels (key = relative position)
@@ -451,15 +451,15 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
451
451
n2.getContent () == c_flowing)
452
452
flags |= neighborflag_top_is_same_liquid;
453
453
}
454
-
454
+
455
455
neighbor_levels[neighbor_dirs[i]] = level;
456
456
neighbor_contents[neighbor_dirs[i]] = content;
457
457
neighbor_flags[neighbor_dirs[i]] = flags;
458
458
}
459
459
460
460
// Corner heights (average between four liquids)
461
461
f32 corner_levels[4 ];
462
-
462
+
463
463
v3s16 halfdirs[4 ] = {
464
464
v3s16 (0 ,0 ,0 ),
465
465
v3s16 (1 ,0 ,0 ),
@@ -539,14 +539,14 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
539
539
540
540
content_t neighbor_content = neighbor_contents[dir];
541
541
const ContentFeatures &n_feat = nodedef->get (neighbor_content);
542
-
542
+
543
543
// Don't draw face if neighbor is blocking the view
544
544
if (n_feat.solidness == 2 )
545
545
continue ;
546
-
546
+
547
547
bool neighbor_is_same_liquid = (neighbor_content == c_source
548
548
|| neighbor_content == c_flowing);
549
-
549
+
550
550
// Don't draw any faces if neighbor same is liquid and top is
551
551
// same liquid
552
552
if (neighbor_is_same_liquid == true
@@ -558,15 +558,15 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
558
558
const TileSpec *current_tile = &tile_liquid;
559
559
if (n_feat.solidness != 0 || n_feat.visual_solidness != 0 )
560
560
current_tile = &tile_liquid_bfculled;
561
-
561
+
562
562
video::S3DVertex vertices[4 ] =
563
563
{
564
564
video::S3DVertex (-BS/2 ,0 ,BS/2 , 0 ,0 ,0 , c, 0 ,1 ),
565
565
video::S3DVertex (BS/2 ,0 ,BS/2 , 0 ,0 ,0 , c, 1 ,1 ),
566
566
video::S3DVertex (BS/2 ,0 ,BS/2 , 0 ,0 ,0 , c, 1 ,0 ),
567
567
video::S3DVertex (-BS/2 ,0 ,BS/2 , 0 ,0 ,0 , c, 0 ,0 ),
568
568
};
569
-
569
+
570
570
/*
571
571
If our topside is liquid, set upper border of face
572
572
at upper border of node
@@ -584,7 +584,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
584
584
vertices[2 ].Pos .Y = corner_levels[side_corners[i][0 ]];
585
585
vertices[3 ].Pos .Y = corner_levels[side_corners[i][1 ]];
586
586
}
587
-
587
+
588
588
/*
589
589
If neighbor is liquid, lower border of face is corner
590
590
liquid levels
@@ -603,7 +603,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
603
603
vertices[0 ].Pos .Y = -0.5 *BS;
604
604
vertices[1 ].Pos .Y = -0.5 *BS;
605
605
}
606
-
606
+
607
607
for (s32 j=0 ; j<4 ; j++)
608
608
{
609
609
if (dir == v3s16 (0 ,0 ,1 ))
@@ -614,7 +614,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
614
614
vertices[j].Pos .rotateXZBy (90 );
615
615
if (dir == v3s16 (1 ,0 ,-0 ))
616
616
vertices[j].Pos .rotateXZBy (-90 );
617
-
617
+
618
618
// Do this to not cause glitches when two liquids are
619
619
// side-by-side
620
620
/* if(neighbor_is_same_liquid == false){
@@ -629,11 +629,11 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
629
629
// Add to mesh collector
630
630
collector.append (*current_tile, vertices, 4 , indices, 6 );
631
631
}
632
-
632
+
633
633
/*
634
634
Generate top side, if appropriate
635
635
*/
636
-
636
+
637
637
if (top_is_same_liquid == false )
638
638
{
639
639
video::S3DVertex vertices[4 ] =
@@ -643,7 +643,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
643
643
video::S3DVertex (BS/2 ,0 ,-BS/2 , 0 ,0 ,0 , c, 1 ,0 ),
644
644
video::S3DVertex (-BS/2 ,0 ,-BS/2 , 0 ,0 ,0 , c, 0 ,0 ),
645
645
};
646
-
646
+
647
647
// To get backface culling right, the vertices need to go
648
648
// clockwise around the front of the face. And we happened to
649
649
// calculate corner levels in exact reverse order.
@@ -657,8 +657,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
657
657
vertices[i].Pos .Y += corner_levels[j];
658
658
vertices[i].Pos += intToFloat (p, BS);
659
659
}
660
-
661
- // Default downwards-flowing texture animation goes from
660
+
661
+ // Default downwards-flowing texture animation goes from
662
662
// -Z towards +Z, thus the direction is +Z.
663
663
// Rotate texture to make animation go in flow direction
664
664
// Positive if liquid moves towards +Z
@@ -721,7 +721,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
721
721
video::S3DVertex (BS/2 ,BS/2 ,BS/2 , dir.X ,dir.Y ,dir.Z , c, 0 ,0 ),
722
722
video::S3DVertex (-BS/2 ,BS/2 ,BS/2 , dir.X ,dir.Y ,dir.Z , c, 1 ,0 ),
723
723
};
724
-
724
+
725
725
// Rotations in the g_6dirs format
726
726
if (j == 0 ) // Z+
727
727
for (u16 i=0 ; i<4 ; i++)
@@ -770,7 +770,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
770
770
TileSpec tiles[6 ];
771
771
for (i = 0 ; i < 6 ; i++)
772
772
tiles[i] = getNodeTile (n, p, dirs[i], data);
773
-
773
+
774
774
TileSpec glass_tiles[6 ];
775
775
if (tiles[1 ].texture && tiles[2 ].texture && tiles[3 ].texture ) {
776
776
glass_tiles[0 ] = tiles[2 ];
@@ -781,21 +781,21 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
781
781
glass_tiles[5 ] = tiles[1 ];
782
782
} else {
783
783
for (i = 0 ; i < 6 ; i++)
784
- glass_tiles[i] = tiles[1 ];
784
+ glass_tiles[i] = tiles[1 ];
785
785
}
786
-
786
+
787
787
u8 param2 = n.getParam2 ();
788
788
bool H_merge = ! bool (param2 & 128 );
789
789
bool V_merge = ! bool (param2 & 64 );
790
790
param2 = param2 & 63 ;
791
-
791
+
792
792
u16 l = getInteriorLight (n, 1 , nodedef);
793
793
video::SColor c = MapBlock_LightColor (255 , l, f.light_source );
794
794
v3f pos = intToFloat (p, BS);
795
795
static const float a = BS / 2 ;
796
796
static const float g = a - 0.003 ;
797
797
static const float b = .876 * ( BS / 2 );
798
-
798
+
799
799
static const aabb3f frame_edges[12 ] = {
800
800
aabb3f ( b, b,-a, a, a, a), // y+
801
801
aabb3f (-a, b,-a,-b, a, a), // y+
@@ -818,16 +818,16 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
818
818
aabb3f (-g,-g, g, g, g, g), // z+
819
819
aabb3f (-g,-g,-g, g, g,-g) // z-
820
820
};
821
-
821
+
822
822
// table of node visible faces, 0 = invisible
823
823
int visible_faces[6 ] = {0 ,0 ,0 ,0 ,0 ,0 };
824
-
824
+
825
825
// table of neighbours, 1 = same type, checked with g_26dirs
826
826
int nb[18 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
827
-
827
+
828
828
// g_26dirs to check when only horizontal merge is allowed
829
829
int nb_H_dirs[8 ] = {0 ,2 ,3 ,5 ,10 ,11 ,12 ,13 };
830
-
830
+
831
831
content_t current = n.getContent ();
832
832
content_t n2c;
833
833
MapNode n2;
@@ -845,14 +845,14 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
845
845
n2 = data->m_vmanip .getNodeNoEx (n2p);
846
846
n2c = n2.getContent ();
847
847
if (n2c == current || n2c == CONTENT_IGNORE)
848
- nb[4 ] = 1 ;
848
+ nb[4 ] = 1 ;
849
849
} else if (H_merge && !V_merge) {
850
850
for (i = 0 ; i < 8 ; i++) {
851
851
n2p = blockpos_nodes + p + g_26dirs[nb_H_dirs[i]];
852
852
n2 = data->m_vmanip .getNodeNoEx (n2p);
853
853
n2c = n2.getContent ();
854
854
if (n2c == current || n2c == CONTENT_IGNORE)
855
- nb[nb_H_dirs[i]] = 1 ;
855
+ nb[nb_H_dirs[i]] = 1 ;
856
856
}
857
857
} else if (H_merge && V_merge) {
858
858
for (i = 0 ; i < 18 ; i++) {
@@ -878,7 +878,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
878
878
visible_faces[i] = 1 ;
879
879
}
880
880
}
881
-
881
+
882
882
if (!H_merge) {
883
883
visible_faces[2 ] = 1 ;
884
884
visible_faces[3 ] = 1 ;
@@ -893,7 +893,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
893
893
visible_faces[i] = 1 ;
894
894
}
895
895
}
896
-
896
+
897
897
static const u8 nb_triplet[12 *3 ] = {
898
898
1 ,2 , 7 , 1 ,5 , 6 , 4 ,2 ,15 , 4 ,5 ,14 ,
899
899
2 ,0 ,11 , 2 ,3 ,13 , 5 ,0 ,10 , 5 ,3 ,12 ,
@@ -1010,7 +1010,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1010
1010
case NDT_TORCHLIKE:
1011
1011
{
1012
1012
v3s16 dir = n.getWallMountedDir (nodedef);
1013
-
1013
+
1014
1014
u8 tileindex = 0 ;
1015
1015
if (dir == v3s16 (0 ,-1 ,0 )){
1016
1016
tileindex = 0 ; // floor
@@ -1070,7 +1070,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1070
1070
1071
1071
u16 l = getInteriorLight (n, 0 , nodedef);
1072
1072
video::SColor c = MapBlock_LightColor (255 , l, f.light_source );
1073
-
1073
+
1074
1074
float d = (float )BS/16 ;
1075
1075
float s = BS/2 *f.visual_scale ;
1076
1076
// Wall at X+ of node
@@ -1113,7 +1113,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1113
1113
1114
1114
u16 l = getInteriorLight (n, 1 , nodedef);
1115
1115
video::SColor c = MapBlock_LightColor (255 , l, f.light_source );
1116
-
1116
+
1117
1117
float s = BS / 2 * f.visual_scale ;
1118
1118
1119
1119
for (int j = 0 ; j < 2 ; j++)
@@ -1125,16 +1125,16 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1125
1125
video::S3DVertex ( s,-BS/2 + s*2 ,0 , 0 ,0 ,0 , c, 1 ,0 ),
1126
1126
video::S3DVertex (-s,-BS/2 + s*2 ,0 , 0 ,0 ,0 , c, 0 ,0 ),
1127
1127
};
1128
+ float rotate_degree = 0 ;
1129
+ if (f.param_type_2 == CPT2_DEGROTATE)
1130
+ rotate_degree = n.param2 * 2 ;
1128
1131
1129
- if (j == 0 )
1130
- {
1132
+ if (j == 0 ) {
1131
1133
for (u16 i = 0 ; i < 4 ; i++)
1132
- vertices[i].Pos .rotateXZBy (46 + n.param2 * 2 );
1133
- }
1134
- else if (j == 1 )
1135
- {
1134
+ vertices[i].Pos .rotateXZBy (46 + rotate_degree);
1135
+ } else if (j == 1 ) {
1136
1136
for (u16 i = 0 ; i < 4 ; i++)
1137
- vertices[i].Pos .rotateXZBy (-44 + n. param2 * 2 );
1137
+ vertices[i].Pos .rotateXZBy (-44 + rotate_degree );
1138
1138
}
1139
1139
1140
1140
for (int i = 0 ; i < 4 ; i++)
@@ -1507,7 +1507,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1507
1507
v3s16 (0 , 0 , -1 )
1508
1508
};
1509
1509
TileSpec tiles[6 ];
1510
-
1510
+
1511
1511
u16 l = getInteriorLight (n, 1 , nodedef);
1512
1512
video::SColor c = MapBlock_LightColor (255 , l, f.light_source );
1513
1513
@@ -1526,7 +1526,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1526
1526
aabb3f box = *i;
1527
1527
box.MinEdge += pos;
1528
1528
box.MaxEdge += pos;
1529
-
1529
+
1530
1530
f32 temp;
1531
1531
if (box.MinEdge .X > box.MaxEdge .X )
1532
1532
{
@@ -1615,7 +1615,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1615
1615
break ;}
1616
1616
}
1617
1617
}
1618
-
1618
+
1619
1619
/*
1620
1620
Caused by incorrect alpha blending, selection mesh needs to be created as
1621
1621
last element to ensure it gets blended correct over nodes with alpha channel
@@ -1643,15 +1643,15 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1643
1643
u16 l = 0 ;
1644
1644
u16 l1 = 0 ;
1645
1645
for (u8 i = 0 ; i < 7 ; i++) {
1646
- MapNode n1 = data->m_vmanip .getNodeNoEx (blockpos_nodes + p + dirs[i]);
1646
+ MapNode n1 = data->m_vmanip .getNodeNoEx (blockpos_nodes + p + dirs[i]);
1647
1647
l1 = getInteriorLight (n1, -4 , nodedef);
1648
- if (l1 > l)
1648
+ if (l1 > l)
1649
1649
l = l1;
1650
1650
}
1651
1651
video::SColor c = MapBlock_LightColor (255 , l, 0 );
1652
1652
data->m_highlight_mesh_color = c;
1653
1653
std::vector<aabb3f> boxes = n.getSelectionBoxes (nodedef);
1654
- TileSpec h_tile;
1654
+ TileSpec h_tile;
1655
1655
h_tile.material_flags |= MATERIAL_FLAG_HIGHLIGHTED;
1656
1656
h_tile.texture = tsrc->getTextureForMesh (" halo.png" ,&h_tile.texture_id );
1657
1657
v3f pos = intToFloat (p, BS);
0 commit comments