void RenderAction::dropFunctor(DrawEnv::DrawFunctor &func, Material *pMat, bool bIgnoreOverrides) { if(pMat == NULL) return; PrimeMaterial *pPrimeMat = pMat->finalize(_oCurrentRenderProp, _pWindow); if(pPrimeMat == NULL) return; UInt32 uiNPasses = pPrimeMat->getNPasses(); for(UInt32 uiPass = 0; uiPass < uiNPasses; ++uiPass) { State *st = pPrimeMat->getState(uiPass); if(st != NULL) { this->dropFunctor(func, st, pPrimeMat->getSortKey() + uiPass, bIgnoreOverrides ); } else { #ifndef WIN32 FINFO(("%s: hit material with NULL state!\n", __func__)); #else FINFO(("Hit material with NULL state!\n")); #endif } } }
Action::ResultE MaterialDrawable::renderActionEnterHandler(Action *action) { RenderAction *a = dynamic_cast<RenderAction *>(action); Material *m = a->getMaterial(); PrimeMaterial *pPrimeMat = NULL; if(m == NULL) { if(this->getMaterial() != NULL) { pPrimeMat = this->getMaterial()->finalize(a->getRenderProperties(), a->getWindow() ); } } else { pPrimeMat = m->finalize(a->getRenderProperties(), a->getWindow ()); } if(pPrimeMat == NULL) { pPrimeMat = getDefaultMaterial(); FNOTICE(("MaterialDrawable::render: no Material!?!\n")); } UInt32 uiNPasses = pPrimeMat->getNPasses(); for(UInt32 uiPass = 0; uiPass < uiNPasses; ++uiPass) { State *st = pPrimeMat->getState(uiPass); if(st != NULL) { a->dropFunctor(_drawFunc, st, pPrimeMat->getSortKey() + uiPass); } else { FINFO(("%s: Material %p has NULL state for pass %d\n", OSG_FUNCNAME_MACRO, pPrimeMat, uiPass)); } } if(a->pushVisibility()) { if(a->selectVisibles() == 0) { a->popVisibility(); return Action::Skip; } } return Action::Continue; }
void CPUSkinningAlgorithm::renderGeometry( RenderAction *ract, SkinnedGeometry *skinGeo, CPUSkinningDataAttachment *data ) { Material *pMat = ract->getMaterial(); PrimeMaterial *pPrimeMat = NULL; if(pMat == NULL) { if(skinGeo->getMaterial() != NULL) { pPrimeMat = skinGeo->getMaterial()->finalize( ract->getRenderProperties(), ract->getCurrentOverrides(), ract->getWindow()); } } else { pPrimeMat = pMat->finalize( ract->getRenderProperties(), ract->getCurrentOverrides(), ract->getWindow()); } if(pPrimeMat == NULL) { SNOTICE << "CPUSkinningAlgorithm::preDrawPrimitives: No Material " << "for SkinnedGeometry " << skinGeo << std::endl; pPrimeMat = getDefaultMaterial(); } DrawEnv::DrawFunctor drawFunc = boost::bind( &CPUSkinningAlgorithm::drawPrimitives, this, skinGeo, data, _1); UInt32 uiNPasses = pPrimeMat->getNPasses(); for(UInt32 uiPass = 0; uiPass < uiNPasses; ++uiPass) { State *st = pPrimeMat->getState(uiPass); if(st != NULL) { ract->dropFunctor(drawFunc, st, pPrimeMat->getSortKey() + uiPass); } else { FINFO(("%s: Material %p has NULL state for pass %d\n", OSG_FUNCNAME_MACRO, pPrimeMat, uiPass)); } } }