2015-11-07 16:45:22 +00:00
|
|
|
#include "additivelayer.hpp"
|
|
|
|
|
|
|
|
#include <osg/BlendFunc>
|
|
|
|
#include <osg/StateSet>
|
|
|
|
|
|
|
|
#include "myguirendermanager.hpp"
|
|
|
|
|
|
|
|
namespace osgMyGUI
|
|
|
|
{
|
|
|
|
|
|
|
|
AdditiveLayer::AdditiveLayer()
|
|
|
|
{
|
|
|
|
mStateSet = new osg::StateSet;
|
|
|
|
mStateSet->setAttributeAndModes(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE));
|
|
|
|
}
|
|
|
|
|
|
|
|
AdditiveLayer::~AdditiveLayer()
|
|
|
|
{
|
|
|
|
// defined in .cpp file since we can't delete incomplete types
|
|
|
|
}
|
|
|
|
|
|
|
|
void AdditiveLayer::renderToTarget(MyGUI::IRenderTarget *_target, bool _update)
|
|
|
|
{
|
2020-05-01 19:37:01 +00:00
|
|
|
StateInjectableRenderTarget* injectableTarget = static_cast<StateInjectableRenderTarget*>(_target);
|
2015-11-07 16:45:22 +00:00
|
|
|
|
2020-05-01 19:37:01 +00:00
|
|
|
injectableTarget->setInjectState(mStateSet.get());
|
2015-11-07 16:45:22 +00:00
|
|
|
|
|
|
|
MyGUI::OverlappedLayer::renderToTarget(_target, _update);
|
|
|
|
|
2020-05-01 19:37:01 +00:00
|
|
|
injectableTarget->setInjectState(nullptr);
|
2015-11-07 16:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|