If you look thru that link i posted about half way down there is a picture of grid in blue just below that is a fully working camera class with the grid as well.
All the code is right on the page so you could just copy paste it.
You probably should look at the bottom of the class though as i separated all the methods for motion and movement into there own little methods. The only thing i didn’t include in it is roll but you could easily add it as well to the local rotation controls.
Further up is a old camera class i made in another link so that link actually has a working camera and a link to another one both copy pasteable right off the topic.
It also has a free camera mode as well as a fixed camera the free camera shows how to make a free cam matrix that can’t gimble lock and explains how to avoid it with a fixed camera which is a bit more of a art. Quaternions can also gimble lock despite the common myth that they can’t they are best used when there are a ton of rotations alone that must be computed in a chain as they are slightly cheaper for the pure rotations but conversion is expensive.