Commit 4f3c9fcb authored by Pavel Rojtberg's avatar Pavel Rojtberg

ovis: add setCompositors method

enables an ordered chain of full-screen post processing effects
parent 25a01dc4
......@@ -62,6 +62,16 @@ public:
/// @overload
CV_WRAP_AS(setBackgroundColor) virtual void setBackground(const Scalar& color) = 0;
/**
* enable an ordered chain of full-screen post processing effects
*
* this way you can add distortion or SSAO effects.
* The effects themselves must be defined inside Ogre .compositor scripts.
* @see addResourceLocation
* @param names compositor names that will be applied in order of appearance
*/
CV_WRAP virtual void setCompositors(const std::vector<String>& names) = 0;
/**
* place an entity of an mesh in the scene
*
......
......@@ -7,6 +7,7 @@
#include <OgreApplicationContext.h>
#include <OgreCameraMan.h>
#include <OgreRectangle2D.h>
#include <OgreCompositorManager.h>
#include <opencv2/calib3d.hpp>
......@@ -339,6 +340,23 @@ public:
bgplane->setVisible(true);
}
void setCompositors(const std::vector<String>& names)
{
Viewport* vp = frameSrc->getViewport(0);
CompositorManager& cm = CompositorManager::getSingleton();
cm.removeCompositorChain(vp); // remove previous configuration
for(size_t i = 0; i < names.size(); i++)
{
if (!cm.addCompositor(vp, names[i])) {
LogManager::getSingleton().logError("Failed to add compositor: " + names[i]);
continue;
}
cm.setCompositorEnabled(vp, names[i], true);
}
}
void setBackground(const Scalar& color)
{
// hide background plane
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment