Factorize and comment generateCubemapFromTextures