bool RenderTexTargetBinManager::setTargetFormat(const GFXFormat &newTargetFormat) { if(mTargetFormat == newTargetFormat) return true; mTargetFormat = newTargetFormat; ConditionerFeature *conditioner = mNamedTarget.getConditioner(); if(conditioner) conditioner->setBufferFormat(mTargetFormat); return _updateTargets(); }
bool RenderPrePassMgr::_updateTargets() { PROFILE_SCOPE(RenderPrePassMgr_updateTargets); bool ret = Parent::_updateTargets(); // check for an output conditioner, and update it's format ConditionerFeature *outputConditioner = dynamic_cast<ConditionerFeature *>(FEATUREMGR->getByType(MFT_PrePassConditioner)); if( outputConditioner && outputConditioner->setBufferFormat(mTargetFormat) ) { // reload materials, the conditioner needs to alter the generated shaders } // Attach the light info buffer as a second render target, if there is // lightmapped geometry in the scene. AdvancedLightBinManager *lightBin; if ( Sim::findObject( "AL_LightBinMgr", lightBin ) && lightBin->MRTLightmapsDuringPrePass() && lightBin->isProperlyAdded() ) { // Update the size of the light bin target here. This will call _updateTargets // on the light bin ret &= lightBin->setTargetSize( mTargetSize ); if ( ret ) { // Sanity check AssertFatal(lightBin->getTargetChainLength() == mTargetChainLength, "Target chain length mismatch"); // Attach light info buffer to Color1 for each target in the chain for ( U32 i = 0; i < mTargetChainLength; i++ ) { GFXTexHandle lightInfoTex = lightBin->getTargetTexture(0, i); mTargetChain[i]->attachTexture(GFXTextureTarget::Color1, lightInfoTex); } } } return ret; }