· by Steve · Read in about 2 min · (309 Words)

The last couple of days have been about refactoring. I’ve been getting towards the end of the resource work in OgreMain (still lots to do in the plugins and samples, mind), and as I came to sort out the particle systems, I realised that whilst I was changing them, it would be a good idea to redesign one aspect of them that I’ve always regretted - the fact that ParticleSystem subclasses from BillboardSet. In hindsight, it’s an obvious design mistake - particle systems can be rendered in ways other than using billboards. So now I’ve finally done something about it - particle systems are independent of billboards, and have a plugin ‘renderer’ class which determines how they’re rendered. The new structure is represented in this quick UML Diagram I knocked up. This design will pave the way for ribbon particles and hardware point rendering particle renderers, although _mental_ will be tackling those rather than me.

Secondly, I realised that Overlays were not resources at all - they’re not shared, they’re not unloadable / pageable. OverlayManager was a ResourceManager just for convenience of scripting and lookup. So, I refactored out the scripting provider aspect of it to ScriptLoader, and now non-ResourceManagers can register to be scripted when resource groups are initialised (there is still the attachment to resource groups since this is where search paths are set up). ParticleSystemManager also falls into this group. It does mean that the instance lookup is separate, but on the whole the design is much cleaner.

I’m beginning to dread the inevitable time that I’ll have to merge resource-unstable back into the head, I’m sure there will be plenty of conflicts to resolve. There are some interface breaking changes on the way for 1.0.0, but the benefits are definitely worth it. Best we get them out of the way before 1.0.0 though, eh? 😀