From 334fc4b75ebc0546e21e9e8ae2ece75a325bb358 Mon Sep 17 00:00:00 2001 From: David Rogers Date: Sun, 10 Apr 2011 20:52:17 -0500 Subject: [PATCH] Bug 423 - Fix for looking up for texture definitions in very complex compositor setups in getSourceForTex and getTargetForTex --- OgreMain/src/OgreCompositorInstance.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/OgreMain/src/OgreCompositorInstance.cpp b/OgreMain/src/OgreCompositorInstance.cpp index d6797eb9151..2e07e4df1db 100644 --- a/OgreMain/src/OgreCompositorInstance.cpp +++ b/OgreMain/src/OgreCompositorInstance.cpp @@ -528,6 +528,7 @@ void CompositorInstance::setScheme(const String& schemeName, bool reuseTextures) if (tech) { setTechnique(tech, reuseTextures); + mActiveScheme = tech->getSchemeName(); } } //----------------------------------------------------------------------- @@ -958,13 +959,14 @@ RenderTarget *CompositorInstance::getTargetForTex(const String &name) if (texDef != 0 && !texDef->refCompName.empty()) { //This is a reference - find the compositor and referenced texture definition - const CompositorPtr& refComp = CompositorManager::getSingleton().getByName(texDef->refCompName); - if (refComp.isNull()) + Ogre::CompositorInstance *refCompInst = mChain->getCompositor(texDef->refCompName); + if(refCompInst == 0) { OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Referencing non-existent compositor", "CompositorInstance::getTargetForTex"); } - CompositionTechnique::TextureDefinition* refTexDef = refComp->getSupportedTechnique()->getTextureDefinition(texDef->refTexName); + Ogre::Compositor *refComp = refCompInst->getCompositor(); + CompositionTechnique::TextureDefinition* refTexDef = refComp->getSupportedTechnique(refCompInst->getScheme())->getTextureDefinition(texDef->refTexName); if (refTexDef == 0) { OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Referencing non-existent compositor texture", @@ -1028,14 +1030,14 @@ const String &CompositorInstance::getSourceForTex(const String &name, size_t mrt if (!texDef->refCompName.empty()) { - //This is a reference - find the compositor and referenced texture definition - const CompositorPtr& refComp = CompositorManager::getSingleton().getByName(texDef->refCompName); - if (refComp.isNull()) + Ogre::CompositorInstance *refCompInst = mChain->getCompositor(texDef->refCompName); + if(refCompInst == 0) { OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Referencing non-existent compositor", - "CompositorInstance::getSourceForTex"); + "CompositorInstance::getSourceForTex"); } - CompositionTechnique::TextureDefinition* refTexDef = refComp->getSupportedTechnique()->getTextureDefinition(texDef->refTexName); + Ogre::Compositor *refComp = refCompInst->getCompositor(); + CompositionTechnique::TextureDefinition* refTexDef = refComp->getSupportedTechnique(refCompInst->getScheme())->getTextureDefinition(texDef->refTexName); if (refTexDef == 0) { OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Referencing non-existent compositor texture",