Well, I finally got the scene elements of all types and their properties to serialize. I have no idea whether it is correct or efficient at this point though, since I have not yet been able to get it all to deserialize.
In order to load a new scene into memory, we need a way to clear the current scene out of memory. This would be the effect of the File -> New menu item. A File -> Open is a File -> New followed by a deserialization and then initialization of runtime state based on the deserialized property and scene element data. The trouble is that clearing the scene does not currently work as intended because of the way our design was laid out.
We have an ownership conflict regarding the RenderNode corresponding to a SceneElement. A RenderNode is the visual representation of something, typically (but not necessarily) a SceneElement. The Renderer component of the Engine has to know of all the RenderNodes in the world so that it can render them. There do exist RenderNodes which do not belong to SceneElements, which suggests that all RenderNodes should simply belong to the Renderer. On the other hand, never should a SceneElement be destroyed without its corresponding RenderNode also being destroyed. Thus it seems reasonable that a SceneElement should own its RenderNode.
A proposed solution was to have the Renderer provide an interface for destroying RenderNodes, just as it presently does for creating them. This would work fine except it implies that every SceneElement must be aware of its Renderer, or that it must be told who its Renderer is when it is destroyed. Neither of these seems desirable. Creation of a RenderNode has been messy and involved passing in who the Renderer is to date, so it seems the time has come for a refactoring in the SceneElement code. It should simply know its Renderer from the moment of its birth.
Saving and Loading! Yeaaargh!
No Comments for this post yet...
Comments are closed for this post.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| << < | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | |||