Having almost finished our application, we are going to add compositors to make the application more interesting.
We are going to use compositors in our
FrameListener
, so we need a member variable containing the viewport:Ogre::Viewport* _viewport;
We also are going to need to save which compositor is turned on; add three
Booleans
for this task:bool _comp1, _comp2, _comp3;
We are going to use keyboard input to switch the compositors on and off. To be able to differentiate between key presses, we need to know the previous state of the key:
bool _down1, _down2, _down3;
Change the constructor of the
FrameListener
to take the viewport as a parameter:MyFrameListener(Ogre::RenderWindow* win,Ogre::Camera* cam,Ogre::Viewport* viewport)
Assign the viewport pointer to the member and assign the Boolean value their starting value:
_viewport = viewport; _comp1 = false; _comp2 = false; _comp3 = false; _down1 = false; _down2 = false; _down3 = false;
If the key number 1...