void PostShaderStage::initData(RenderAction *pAction) { PostShaderStageDataUnrecPtr pData = NULL; pData = setupStageData(pAction->getActivePartition()->getViewportWidth (), pAction->getActivePartition()->getViewportHeight()); pData->setWidth (pAction->getActivePartition()->getViewportWidth ()); pData->setHeight(pAction->getActivePartition()->getViewportHeight()); this->setData(pData, _iDataSlotId, pAction); }
CubeMapGeneratorStageData *CubeMapGenerator::initData(RenderActionBase *pAction) { CubeMapGeneratorStageDataUnrecPtr pData = pAction->getData<CubeMapGeneratorStageData *>(_iDataSlotId); if(pData == NULL) { pData = setupStageData(pAction); this->setData(pData, _iDataSlotId, pAction); } return pData; }
void HDRStage::initData(Viewport *pViewport, RenderActionBase *pAction ) { HDRStageDataUnrecPtr pData = pAction->getData<HDRStageData *>(_iDataSlotId); if(pData == NULL) { pData = setupStageData(pViewport->getPixelWidth(), pViewport->getPixelHeight()); pData->setWidth (pViewport->getPixelWidth ()); pData->setHeight(pViewport->getPixelHeight()); this->setData(pData, _iDataSlotId, pAction); } }
void PostShaderStage::initData(Viewport *pViewport, RenderActionBase *pAction ) { PostShaderStageDataUnrecPtr pData;// = pAction->getData<PostShaderStageData *>(_iDataSlotId); //if(pData == NULL) //{ pData = setupStageData(pViewport->getPixelWidth(), pViewport->getPixelHeight()); pData->setWidth (pViewport->getPixelWidth ()); pData->setHeight(pViewport->getPixelHeight()); this->setData(pData, _iDataSlotId, pAction); //} }
void HDRStage::initData(RenderAction *pAction, Int32 iVPWidth, Int32 iVPHeight) { HDRStageDataUnrecPtr pData = pAction->getData<HDRStageData *>(_iDataSlotId); if(pData == NULL) { pData = setupStageData(iVPWidth, iVPHeight); pData->setWidth (iVPWidth ); pData->setHeight(iVPHeight); this->setData(pData, _iDataSlotId, pAction); } }
void DepthPeelingStage::initData(RenderAction *a, Int32 iVPWidth, Int32 iVPHeight) { DepthPeelingStageDataUnrecPtr pData = a->getData<DepthPeelingStageData *>(_iDataSlotId); if(!pData) { pData = setupStageData(iVPWidth, iVPHeight); pData->setWidth (iVPWidth ); pData->setHeight(iVPHeight); this->setData(pData, _iDataSlotId, a); } }
Action::ResultE DisplayFilterStage::renderEnter(Action *action) { RenderAction *ract = dynamic_cast<RenderAction *>(action); if(ract == NULL) return Action::Continue; DisplayFilterStageDataUnrecPtr pData = ract->getData<DisplayFilterStageData *>(_iDataSlotId); DrawEnv &oEnv = ract->getActivePartition()->getDrawEnv(); bool bFilterActive = false; RenderPartition::Mode partMode = RenderPartition::StateSorting; CalibrationPatternFilter *pCalibFilter = NULL; ResolutionDisplayFilter *pResFilter = NULL; DistortionDisplayFilter *pDistFilter = NULL; ColorDisplayFilter *pColFilter = NULL; bool bDoDraw = true; if(_mfFilterGroups.size() == 0) { pCalibFilter = this->getCalibrationPatternFilter(); pResFilter = this->getResolutionFilter(); pColFilter = this->getColorFilter(); pDistFilter = this->getDistortionFilter(); } else { // Linear search, optimize of needed MFFilterGroupsType::const_iterator gIt = _mfFilterGroups.begin(); MFFilterGroupsType::const_iterator gEnd = _mfFilterGroups.end (); for(; gIt != gEnd; ++gIt) { if((*gIt)->matches(oEnv.getDrawerId(), oEnv.getDrawableId()) == true) { pCalibFilter = (*gIt)->getCalibrationPatternFilter(); pResFilter = (*gIt)->getResolutionFilter(); pColFilter = (*gIt)->getColorFilter(); pDistFilter = (*gIt)->getDistortionFilter(); bDoDraw = ((*gIt)->matches(this->getActiveGroup(), oEnv. getDrawableId ()) == true) || (this->getActiveGroup() == -1 ) ; break; } } } if(pCalibFilter != NULL && pCalibFilter->getEnabled() == true) { if(pData != NULL) pData->setCalibFilter(pCalibFilter); bFilterActive = true; partMode = RenderPartition::SimpleCallback; } else { if(pData != NULL) pData->setCalibFilter(NULL); } if(pColFilter != NULL && pColFilter->getEnabled() == true ) { if(pData != NULL) pData->setColFilter(pColFilter); bFilterActive = true; } else { if(pData != NULL) { pData->setColFilter(NULL); ColorDisplayFilter::deactivate(pData); } } if(pDistFilter != NULL && pDistFilter->getEnabled() == true ) { if(pData != NULL) pData->setDistFilter(pDistFilter); bFilterActive = true; } else { if(pData != NULL) pData->setDistFilter(NULL); } UInt32 uiTargetWidth = oEnv.getPixelWidth (); UInt32 uiTargetHeight = oEnv.getPixelHeight(); Int32 iLeft = oEnv.getPixelLeft (); Int32 iRight = oEnv.getPixelRight (); Int32 iBottom = oEnv.getPixelBottom(); Int32 iTop = oEnv.getPixelTop (); if(pResFilter != NULL && pResFilter->getEnabled() == true ) { bFilterActive = true; uiTargetWidth = UInt32(uiTargetWidth * pResFilter->getDownScale()); uiTargetHeight = UInt32(uiTargetHeight * pResFilter->getDownScale()); iLeft = Int32(iLeft * pResFilter->getDownScale()); iRight = Int32(iRight * pResFilter->getDownScale()); iBottom = Int32(iBottom * pResFilter->getDownScale()); iTop = Int32(iTop * pResFilter->getDownScale()); } if(pData == NULL) { pData = setupStageData(uiTargetWidth, uiTargetHeight); if(pData == NULL) return Action::Continue; this->setData(pData, _iDataSlotId, ract); pData->setColFilter (pColFilter ); pData->setDistFilter (pDistFilter ); pData->setCalibFilter(pCalibFilter); } if((pData->getWidth () != uiTargetWidth ) || (pData->getHeight() != uiTargetHeight) ) { resizeStageData(pData, uiTargetWidth, uiTargetHeight); } if(bFilterActive == false) return Action::Continue; ract->disableDefaultPartition(); this->beginPartitionGroup(ract); { this->pushPartition(ract, 0x0000, partMode); { RenderPartition *pPart = ract ->getActivePartition(); FrameBufferObject *pTarget = pData->getTarget(); Viewarea *pArea = ract ->getViewarea(); Camera *pCam = ract ->getCamera (); Background *pBack = ract ->getBackground(); pPart->setRenderTarget(pTarget); if(pArea != NULL) { pPart->setWindow(ract->getWindow()); if(pTarget != NULL) { pPart->calcViewportDimension(iLeft , iBottom, iRight , iTop , pTarget->getWidth (), pTarget->getHeight ()); } else { pPart->calcViewportDimension( pArea->getLeft (), pArea->getBottom(), pArea->getRight (), pArea->getTop (), ract->getWindow()->getWidth (), ract->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); } if(pCalibFilter != NULL && pCalibFilter->getEnabled() == true) { RenderPartition::SimpleDrawCallback f; if(bDoDraw == true) { f = boost::bind(&DisplayFilterStage::processCalibActive, this, _1); } else { f = boost::bind(&DisplayFilterStage::processCalibInactive, this, _1); } pPart->dropFunctor(f); } else { MFForegroundsType::const_iterator fIt = this->getMFForegrounds()->begin(); MFForegroundsType::const_iterator fEnd = this->getMFForegrounds()->end (); for(; fIt != fEnd; ++fIt) { pPart->pushToForegrounds(*fIt); } this->recurseFromThis(ract); } } this->popPartition(ract); this->pushPartition(ract, (RenderPartition::CopyWindow | RenderPartition::CopyViewportSize), RenderPartition::SimpleCallback); { RenderPartition *pPart = ract->getActivePartition(); Matrix m, t; m.setIdentity(); t.setIdentity(); MatrixOrthogonal( m, 0.f, 1.f, 0.f, 1.f, -1.f, 1.f); pPart->setupProjection(m, t); RenderPartition::SimpleDrawCallback f; f = boost::bind(&DisplayFilterStage::postProcess, this, _1); pPart->dropFunctor(f); } this->popPartition(ract); } this->endPartitionGroup(ract); return Action::Skip; }