Skip to content

Commit 7f4c6f3

Browse files
obneqparamat
authored andcommittedAug 18, 2016
Mapblock mesh: Fix updateFastFaceRow tiling issue
Increase maximum length of tiled node rows from 2 to mapblock size.
1 parent 5c0e659 commit 7f4c6f3

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed
 

‎src/mapblock_mesh.cpp

+13-18
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ static void updateFastFaceRow(
839839
{
840840
v3s16 p = startpos;
841841

842-
u16 continuous_tiles_count = 0;
842+
u16 continuous_tiles_count = 1;
843843

844844
bool makes_face = false;
845845
v3s16 p_corrected;
@@ -889,8 +889,8 @@ static void updateFastFaceRow(
889889
&& (tile.material_flags & MATERIAL_FLAG_TILEABLE_HORIZONTAL)
890890
&& (tile.material_flags & MATERIAL_FLAG_TILEABLE_VERTICAL)) {
891891
next_is_different = false;
892-
}
893-
else{
892+
continuous_tiles_count++;
893+
} else {
894894
/*if(makes_face){
895895
g_profiler->add("Meshgen: diff: next_makes_face != makes_face",
896896
next_makes_face != makes_face ? 1 : 0);
@@ -915,8 +915,6 @@ static void updateFastFaceRow(
915915
g_profiler->add("Meshgen: diff: last position", 1);*/
916916
}
917917

918-
continuous_tiles_count++;
919-
920918
if(next_is_different)
921919
{
922920
/*
@@ -928,8 +926,6 @@ static void updateFastFaceRow(
928926
v3f pf(p_corrected.X, p_corrected.Y, p_corrected.Z);
929927
// Center point of face (kind of)
930928
v3f sp = pf - ((f32)continuous_tiles_count / 2.0 - 0.5) * translate_dir_f;
931-
if(continuous_tiles_count != 1)
932-
sp += translate_dir_f;
933929
v3f scale(1,1,1);
934930

935931
if(translate_dir.X != 0) {
@@ -952,19 +948,18 @@ static void updateFastFaceRow(
952948
}
953949
}
954950

955-
continuous_tiles_count = 0;
956-
957-
makes_face = next_makes_face;
958-
p_corrected = next_p_corrected;
959-
face_dir_corrected = next_face_dir_corrected;
960-
lights[0] = next_lights[0];
961-
lights[1] = next_lights[1];
962-
lights[2] = next_lights[2];
963-
lights[3] = next_lights[3];
964-
tile = next_tile;
965-
light_source = next_light_source;
951+
continuous_tiles_count = 1;
966952
}
967953

954+
makes_face = next_makes_face;
955+
p_corrected = next_p_corrected;
956+
face_dir_corrected = next_face_dir_corrected;
957+
lights[0] = next_lights[0];
958+
lights[1] = next_lights[1];
959+
lights[2] = next_lights[2];
960+
lights[3] = next_lights[3];
961+
tile = next_tile;
962+
light_source = next_light_source;
968963
p = p_next;
969964
}
970965
}

0 commit comments

Comments
 (0)