Skip to content

Commit

Permalink
Bug 423 - Fix for looking up for texture definitions in very complex …
Browse files Browse the repository at this point in the history
…compositor setups in getSourceForTex and getTargetForTex
  • Loading branch information
davidjrogers committed Apr 11, 2011
1 parent 59e7187 commit 334fc4b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions OgreMain/src/OgreCompositorInstance.cpp
Expand Up @@ -528,6 +528,7 @@ void CompositorInstance::setScheme(const String& schemeName, bool reuseTextures)
if (tech)
{
setTechnique(tech, reuseTextures);
mActiveScheme = tech->getSchemeName();
}
}
//-----------------------------------------------------------------------
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 334fc4b

Please sign in to comment.