mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-26 02:38:04 +00:00
Create shaders on first render in shader based MyGUI manager
This commit is contained in:
parent
7c7c71428a
commit
f31a5490f3
@ -135,28 +135,6 @@ public:
|
|||||||
setRenderWindow(_window);
|
setRenderWindow(_window);
|
||||||
setSceneManager(_scene);
|
setSceneManager(_scene);
|
||||||
|
|
||||||
// ADDED
|
|
||||||
sh::MaterialInstance* mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
|
|
||||||
sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
|
|
||||||
mVertexProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
|
||||||
->getVertexProgram()->_getBindingDelegate();
|
|
||||||
|
|
||||||
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
|
|
||||||
sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
|
|
||||||
mVertexProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
|
||||||
->getVertexProgram()->_getBindingDelegate();
|
|
||||||
|
|
||||||
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
|
|
||||||
sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
|
|
||||||
mFragmentProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
|
||||||
->getFragmentProgram()->_getBindingDelegate();
|
|
||||||
|
|
||||||
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
|
|
||||||
sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
|
|
||||||
mFragmentProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
|
||||||
->getFragmentProgram()->_getBindingDelegate();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
|
MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
|
||||||
mIsInitialise = true;
|
mIsInitialise = true;
|
||||||
@ -359,6 +337,30 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initShaders()
|
||||||
|
{
|
||||||
|
// ADDED
|
||||||
|
sh::MaterialInstance* mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
|
||||||
|
sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
|
||||||
|
mVertexProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
||||||
|
->getVertexProgram()->_getBindingDelegate();
|
||||||
|
|
||||||
|
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
|
||||||
|
sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
|
||||||
|
mVertexProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
||||||
|
->getVertexProgram()->_getBindingDelegate();
|
||||||
|
|
||||||
|
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
|
||||||
|
sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
|
||||||
|
mFragmentProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
||||||
|
->getFragmentProgram()->_getBindingDelegate();
|
||||||
|
|
||||||
|
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
|
||||||
|
sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
|
||||||
|
mFragmentProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
|
||||||
|
->getFragmentProgram()->_getBindingDelegate();
|
||||||
|
}
|
||||||
|
|
||||||
void doRender(IVertexBuffer* _buffer, ITexture* _texture, size_t _count)
|
void doRender(IVertexBuffer* _buffer, ITexture* _texture, size_t _count)
|
||||||
{
|
{
|
||||||
if (getManualRender())
|
if (getManualRender())
|
||||||
@ -368,6 +370,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ADDED
|
// ADDED
|
||||||
|
if (!mVertexProgramNoTexture)
|
||||||
|
initShaders();
|
||||||
|
|
||||||
if (_texture)
|
if (_texture)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user