DebugTools: common mesh building implementation for all shape renderers.