Replicate HighResScreenShot in C++

How do I replicate the functionality of HighResScreenShot from a camera’s viewpoint? Specifically the ability to see depth and world normal buffer.

I’d read the source code if someone points me, I’ll go. It’s just too big to trawl through (I tried and got lost)