Original Post
So I'm mapping out a few classes that might be good starting points to an engine I'd like to write. Something simple to get me running again, been a long while since I've done any game-related programming. Basically I've hit a relationship wall between some of my classes, and was hoping for some input. One example of this is the Renderer class and Model/Mesh classes.. I'd like to keep things neat if I can, and have possibly a base class which renderable classes will derive from:
This way I can use dynamic binding to pass objects to the renderer, as well as call the Render() function from the class itself.
However the problem is that these classes would need a pointer to the rendering device/class which for some reason strikes me as annoying.. Can't explain it, it just does. What would be a good solution to this? I'm trying to keep things as abstract as possible for the obvious reason that things will change in later stages of development.
Another example of this would be a file/resource manager class which would load files/parse meshes/etc. I'd like to keep the load() function in the class which needs to be loaded itself.. Construct an empty object, call load() with a file name parameter, then go from there. However again, the class would need a reference to the loader/resource manager.
What would be the best way around having all these references passed around to different objects? Or is this a problem in the first place?(It annoys me..)
class IRenderable{public: virtual void Render() = 0; //Possibly another return type, I'm not that far along yet.};class CModel : public IRenderable{public: void Render();};This way I can use dynamic binding to pass objects to the renderer, as well as call the Render() function from the class itself.
However the problem is that these classes would need a pointer to the rendering device/class which for some reason strikes me as annoying.. Can't explain it, it just does. What would be a good solution to this? I'm trying to keep things as abstract as possible for the obvious reason that things will change in later stages of development.
Another example of this would be a file/resource manager class which would load files/parse meshes/etc. I'd like to keep the load() function in the class which needs to be loaded itself.. Construct an empty object, call load() with a file name parameter, then go from there. However again, the class would need a reference to the loader/resource manager.
What would be the best way around having all these references passed around to different objects? Or is this a problem in the first place?(It annoys me..)