What I want is to be able to set up a listener (perhaps "Overrider" is a better name) for Material and RenderingOperations in the SceneManager. This means that everytime a material is being used (that is, when rendering) it will retrieve this material *via* the materiallistener, which may return the material of the given Renderble, or it may override the material of the Renderable and pass some other material back.
The MaterialListener class has a method like:
Code: Select all
MaterialPtr &getMaterial(Renderable* r) const
This is useful for *so* many effects, and also for many useful debugging features, such as drawing the world with a "+1" material to visualize overdraw-complexity, or rendering the world in wireframe to visualize geometric complexity (that's where the RenderingOperationListener comes in).
Doing any of the cool new full-scene effects that the latest graphics cards allows us to do is quite simiply impossible to do robustly and elegantly in Ogre without this feature.
You can hack up a little demo that looks cool with a single object or so (see the Cel-shading example), but you can't do it robustly for a general scene (such as turning on/off full-scene heat-vision, image-space post-processing motion blur, or an).
Adding this functionality on top of ogre is really tedious and results unneeded inefficiency (especially with regards to memory usage).
I am now in the process of writing a decorator for SceneNode, SceneManager, MovableObject and Renderable, which hopefully will allow me to add the ability to override all materials in a general scene (BSP, OctTree, whatever) - but I don't think that approach is generally viable, it' just a stop-gap meassure to make it work for my app.