I think we should change a little bit the way the
Render Device,
Renderer and
Modules classes are in relationship.
At the moment, the structure is:
*
Modules has a
Render Device pointer. It also duplicate this pointer assigning its value to a global pointer
(!!), called
gRDI.
*
Modules has also a
Renderer.
*
Renderer uses the
Render Device through the global pointer
(!!).
* Many classes
uses the
Render Device through the global pointer
(!!).
So there are some kind of circular relationships which make a little bit hard to understand the ownership structure.
In general, it would be more clear and logical to give the ownership of the "Render Device" to the "Renderer" class and remove the ugly gRDI global pointer, so the general structure will become:
*
Modules has a
Renderer. No more
Render Device pointer here (local nor global).
*
Renderer has the
Render Device with a simple method
getRenderDevice().
* Many classes
uses the
Renderer and could access to the low-level
Render Device through its getter.
Linear and logical. Isn't it?
I already have a working patch in my fork.
To provide a retro-compatibility layer, we can use a simple:
Code:
#define gRDI Modules::renderer().getRenderDevice()
And mark it as
deprecated (with the idea to remove it in the future).