void DepthPeelingStage::setupRenderScene(RenderAction* a, Int32 iVPWidth, Int32 iVPHeight, bool isInitial, bool isPing ) { this->pushPartition(a); { RenderPartition *pPart = a->getActivePartition(); FrameBufferObject *pTarget = NULL; Viewarea *pArea = a->getViewarea (); Camera *pCam = a->getCamera (); Background *pBack = NULL; DepthPeelingStageDataUnrecPtr pData = a->getData<DepthPeelingStageData *>(_iDataSlotId); if(!pData) { this->initData(a, iVPWidth, iVPHeight); } else { this->updateData(a, iVPWidth, iVPHeight); } pData = a->getData<DepthPeelingStageData *>(_iDataSlotId); if (isInitial) { pTarget = pData->getBlendFBO(); pBack = a->getBackground (); } else { if (isPing) pTarget = pData->getPeelPingFBO(); else pTarget = pData->getPeelPongFBO(); pBack = pData->getBackground(); } pPart->setRenderTarget(pTarget); if(pArea != NULL) { pPart->setWindow (a->getWindow()); if(pTarget != NULL) { pPart->calcViewportDimension(pArea->getLeft (), pArea->getBottom(), pArea->getRight (), pArea->getTop (), pTarget->getWidth (), pTarget->getHeight ()); } else { pPart->calcViewportDimension(pArea->getLeft (), pArea->getBottom(), pArea->getRight (), pArea->getTop (), a->getWindow()->getWidth (), a->getWindow()->getHeight()); } if(pCam != NULL) { Matrix m, t; // set the projection pCam->getProjection (m, pPart->getViewportWidth (), pPart->getViewportHeight()); pCam->getProjectionTranslation(t, pPart->getViewportWidth (), pPart->getViewportHeight()); pPart->setupProjection(m, t); pCam->getViewing(m, pPart->getViewportWidth (), pPart->getViewportHeight()); pPart->setupViewing(m); pPart->setNear (pCam->getNear()); pPart->setFar (pCam->getFar ()); pPart->calcFrustum(); } pPart->setBackground(pBack); } pPart->addSetupModeBit(RenderPartition::BackgroundSetup); pPart->pushState(); if (!isInitial) { FrameBufferObject* fbo = isPing ? pData->getPeelPongFBO() : pData->getPeelPingFBO(); TextureBuffer* texbuf = static_cast<TextureBuffer *>(fbo->getDepthAttachment()); TextureObjChunk* depthTexChunk = texbuf->getTexture(); pPart->addOverride(depthTexChunk->getClassId() + getDepthTexUnit(), depthTexChunk ); pPart->addOverride(pData->getSpvIsPeelChunk()->getClassId(), pData->getSpvIsPeelChunk() ); } else { pPart->addOverride(pData->getSpvIsInitialChunk()->getClassId(), pData->getSpvIsInitialChunk() ); } pPart->addOverride(pData->getDepthChunk()->getClassId(), pData->getDepthChunk() ); this->recurseFromThis(a); a->useNodeList(false); pPart->popState(); } this->popPartition(a); }