I feel like a camera is a pretty straightforward concept to implement, but I've been going through a bit of an architectural crisis because I didn't realize how intertwine it can be with other systems. My current design has a scene class that's kind of like a database of things for the renderer to use so it made sense that the scene would have ownership of the camera since it sort of exisits in the scene and the renderer uses it.
class Camera {
public:
glm::mat4 getViewMatrix() const;
glm::mat4 getProjectionMatrix() const;
// ...
};
class Scene {
private:
std::shared_ptr<Camera> activeCamera;
// ...
};
class Renderer {
public:
void render(Scene* scene) {
// use the camera from the scene
}
};
The problem I'm facing with this though is for the editor camera (the one you would use to move around the scene while editing) although it's still a camera I feel like an editor camera is more of a tool that lives outside of the scene/gameworld rather than something that is part of it, but I want the ability to add camera nodes to my scene which would be part of the game so I guess what I'm trying to ask is if there two type of cameras are different/separate and if so how do you manage that? Hopefully that's not to confusing I'll try my best to clarify if needed.