//----------------------------------------------------------------------- void CompositorChain::postViewportUpdate(const RenderTargetViewportEvent& evt) { // Only tidy up if there is at least one compositor enabled, and it's this viewport if(evt.source != mViewport || !mAnyCompositorsEnabled) return; Camera *cam = mViewport->getCamera(); postTargetOperation(mOutputOperation, mViewport, cam); }
//----------------------------------------------------------------------- void CompositorChain::preRenderTargetUpdate(const RenderTargetEvent& evt) { /// Compile if state is dirty if(mDirty) _compile(); // Do nothing if no compositors enabled if (!mAnyCompositorsEnabled) { return; } /// Update dependent render targets; this is done in the preRenderTarget /// and not the preViewportUpdate for a reason: at this time, the /// target Rendertarget will not yet have been set as current. /// ( RenderSystem::setViewport(...) ) if it would have been, the rendering /// order would be screwed up and problems would arise with copying rendertextures. Camera *cam = mViewport->getCamera(); if (!cam) { return; } cam->getSceneManager()->_setActiveCompositorChain(this); /// Iterate over compiled state CompositorInstance::CompiledState::iterator i; for(i=mCompiledState.begin(); i!=mCompiledState.end(); ++i) { /// Skip if this is a target that should only be initialised initially if(i->onlyInitial && i->hasBeenRendered) continue; i->hasBeenRendered = true; /// Setup and render preTargetOperation(*i, i->target->getViewport(0), cam); i->target->update(); postTargetOperation(*i, i->target->getViewport(0), cam); } }