Imported by @reduz from b8ec29b6b6 Custom changes will be remade properly in the next commit. (cherry picked from commit 1e39fee140)
b8ec29b6b6
1e39fee140
Did some hacks to it to avoid it from failing on bad geometry.