Wall building in a level-editor

In this variant the calculation is much clearer.

ProfiledContourGeometry MultiMaterial

Will also be in the Collection of examples from discourse.threejs.org
in 2019.