A question about where to store the Camera!

Started by
10 comments, last by Muzzy A 10 years, 1 month ago

I am not a fan of cameras being a component or an entity. I do make them using a class and have helper functions for culling etc but they live in thier own hierarchy outside of my object system. I have found it's better for things to have a reference to a camera instead if they really must. Now where the camera is created and stored will be specific to your game. Create in your script perhaps and make it the currently active camera in the world is the simplest and may be enough for your game. It's hard to say without seeing everthing and know the scope f the game.

The most important part of this question IMHO is the rendering part and I would say without a doubt it should be passed to the rendering functions. I have a RenderJob I pass around and it's main purpose is for multi-threading but it does also hold a reference to the camera, lights, rendertarget etc. This is more flexible for rendering objects. I use the same render call with a different job to render an entity to a texture and use it in my ui as I do for rendering in the actual world.

Advertisement

I like the idea of using the camera like a scene object, I never would have thought to use it like that. It makes everything go together smoothly and there isn't code in random places for the camera. To me a hierarchy beats having references all over the place any day. I guess it's all about preferences.

This topic is closed to new replies.

Advertisement