Fix GeometryVisualizer material batching

The code that handled the primary material in a given batch changing was simply bad.  Added a test fixed the problem.

Fixes #1974