Use when-fu to eliminate lots of tricky code.
Merge pull request #492 from AnalyticalGraphicsInc/loadCubeMapCleanup

Simplify and improve loadCubeMap function