I ask because compositors are assigned to cameras not entities. So, we can't send any custom parameters to their material script.
This will be especially useful for compositors that effect screen settings.
EDIT:
Quick question does CompositorEffectParameter(#Effect, TechniqueID, PassID, EffectName$, DataType, *Data) work on the compositor's material script or does it only work with the compositor script?
If it will work on the compositor's material script then my request is invalid.
Also I found this on the Ogre forums which explains why I can't just reload the compositor's material script with new data.
This code looks like it might be in the ballpark, but I'm going to do a little more research on CompositorInstance::Listener to double check.Sinbad wrote: The reason is that the compositor clones the original materials provided, because each instance has to hook up the input textures differently.
You need to use a CompositorInstance::Listener. Demo_Compositor uses one precisely for the same reason, please refer to that. You can listen in on the original material getting created (notifyMaterialSetup), and also on the material getting rendered (notifyMaterialRender).
Attach a CompositorInstance:Listener via CompositorInstance::addListener to your compostor instance in order to modify
material/shader parameters.Code: Select all
class SomeListener : public Ogre::CompositorInstance::Listener { public: void notifyMaterialSetup( uint32 pass_id, Ogre::MaterialPtr & mat ) { // modify material here (wont alter the base material!) in the setup stage } void notifyMaterialSetup( uint32 pass_id, Ogre::MaterialPtr & mat ) { // modify material here (wont alter the base material!), called for every drawn geometry instance (i.e. compositor render_quad) } }; // Usage Ogre::CompositorInstance * inst = Ogre::CompositorManager::getSingleton().addCompositor( ... ); inst->addListener( new SomeListener );