Merge pull request #47346 from nekomatata/heightmap-draw-triangles-3.x

This commit is contained in:
Rémi Verschelde 2021-09-16 15:23:06 +02:00 committed by GitHub
commit 627577d615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,7 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
PoolRealArray::Read r = map_data.read();
// reserve some memory for our points..
points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2));
points.resize(((map_width - 1) * map_depth * 2) + (map_width * (map_depth - 1) * 2) + (map_width - 1) * (map_depth - 1) * 2);
// now set our points
int r_offset = 0;
@ -65,6 +65,11 @@ Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
points.write[w_offset++] = Vector3(height.x, r[r_offset + map_width - 1], height.z + 1.0);
}
if ((w != map_width - 1) && (d != map_depth - 1)) {
points.write[w_offset++] = Vector3(height.x + 1.0, r[r_offset], height.z);
points.write[w_offset++] = Vector3(height.x, r[r_offset + map_width - 1], height.z + 1.0);
}
height.x += 1.0;
}