added support for writing the camera matrix