Your code looks a lot like a C game structure. Structures are used in functions instead of class calling their own functions passing data to their children which call their own methods with their own sub-data.
Instead of what you have done with structures and global functions, try implementing it into an Application class that is created inside your program's entry point, not globally, so that an object may only get a pointer to the Application if the parent of that object hands it out (and the parent knows about it itself).
class Application{public: SceneGraph* GetSceneGraph(); bool Open (void); void Logic (double delta_time); void Render (); void Close (void); bool IsRunning (void);private: /* application objects */ bool m_Running; std::list <IGameObject*> m_Objects; Renderer* m_Renderer;};int main (){ Application app; if (app.Open ()) { Timer timer; while (app.IsRunning ()) { timer.Start (); app.Logic (timer.DeltaTime); // delta time of last frame.. app.Render (); timer.End (); } app.Close(); } }// Application::Logic () functionvoid Application::Logic (double dt){ std::list <IGameObject*>::iterator obj = m_Objects.begin (); while (obj != m_Objects.end ()) { (*obj)->Update (this, dt); // pass the Application object and delta time ++obj; }}
In this design, the heirarchy is only loosely coupled. Objects don't know about their parents until its time to update them every frame. Theyre not explicitly coupled to one particular Application or one particular Renderer.
Alternatively to relinquish immediate access to the Application object, have a World class or something which contains a list of the game objects. The World class would further abstract the Application from its contents so that the Application can simply update whatever 'world' its currently loaded, and the world class manages changes and whatnot to all objects.
The game objects can either be passed a World* object into their Update functions or they may contain a pointer to their parent World class.