mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Create shaders on first render in shader based MyGUI manager
This commit is contained in:
parent
7c7c71428a
commit
f31a5490f3
1 changed files with 26 additions and 22 deletions
|
@ -135,28 +135,6 @@ public:
|
|||
setRenderWindow(_window);
|
||||
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");
|
||||
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)
|
||||
{
|
||||
if (getManualRender())
|
||||
|
@ -368,6 +370,8 @@ public:
|
|||
}
|
||||
|
||||
// ADDED
|
||||
if (!mVertexProgramNoTexture)
|
||||
initShaders();
|
||||
|
||||
if (_texture)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue