mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
osgMyGUI: implement AdditiveLayer
This commit is contained in:
parent
51f3a8fec6
commit
57b9eafa0f
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <components/myguiplatform/myguiplatform.hpp>
|
#include <components/myguiplatform/myguiplatform.hpp>
|
||||||
#include <components/myguiplatform/myguirendermanager.hpp>
|
#include <components/myguiplatform/myguirendermanager.hpp>
|
||||||
|
#include <components/myguiplatform/additivelayer.hpp>
|
||||||
|
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
@ -216,6 +217,7 @@ namespace MWGui
|
|||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<VideoWidget>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<VideoWidget>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<BackgroundImage>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<BackgroundImage>("Widget");
|
||||||
|
MyGUI::FactoryManager::getInstance().registerFactory<osgMyGUI::AdditiveLayer>("Layer");
|
||||||
BookPage::registerMyGUIComponents ();
|
BookPage::registerMyGUIComponents ();
|
||||||
ItemView::registerComponents();
|
ItemView::registerComponents();
|
||||||
ItemWidget::registerComponents();
|
ItemWidget::registerComponents();
|
||||||
|
33
components/myguiplatform/additivelayer.cpp
Normal file
33
components/myguiplatform/additivelayer.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#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)
|
||||||
|
{
|
||||||
|
RenderManager& renderManager = static_cast<RenderManager&>(MyGUI::RenderManager::getInstance());
|
||||||
|
|
||||||
|
renderManager.setInjectState(mStateSet.get());
|
||||||
|
|
||||||
|
MyGUI::OverlappedLayer::renderToTarget(_target, _update);
|
||||||
|
|
||||||
|
renderManager.setInjectState(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
33
components/myguiplatform/additivelayer.hpp
Normal file
33
components/myguiplatform/additivelayer.hpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef OPENMW_COMPONENTS_MYGUIPLATFORM_ADDITIVELAYER
|
||||||
|
#define OPENMW_COMPONENTS_MYGUIPLATFORM_ADDITIVELAYER
|
||||||
|
|
||||||
|
#include <MyGUI_OverlappedLayer.h>
|
||||||
|
|
||||||
|
#include <osg/ref_ptr>
|
||||||
|
|
||||||
|
namespace osg
|
||||||
|
{
|
||||||
|
class StateSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace osgMyGUI
|
||||||
|
{
|
||||||
|
|
||||||
|
/// @brief A Layer rendering with additive blend mode.
|
||||||
|
class AdditiveLayer : public MyGUI::OverlappedLayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MYGUI_RTTI_DERIVED( AdditiveLayer )
|
||||||
|
|
||||||
|
AdditiveLayer();
|
||||||
|
~AdditiveLayer();
|
||||||
|
|
||||||
|
virtual void renderToTarget(MyGUI::IRenderTarget* _target, bool _update);
|
||||||
|
|
||||||
|
private:
|
||||||
|
osg::ref_ptr<osg::StateSet> mStateSet;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user