in file OgreEntity.cpp, visitRenderables i've added visibility testing flag:
Code: Select all
void Entity::visitRenderables(Renderable::Visitor* visitor,
bool debugRenderables)
{
// Visit each SubEntity
for (SubEntityList::iterator i = mSubEntityList.begin(); i != mSubEntityList.end(); ++i)
{
- visitor->visit(*i, 0, false);
+ if ((*i)->isVisible())
+ visitor->visit(*i, 0, false);
}
// if manual LOD is in use, visit those too
ushort lodi = 1;
for (LODEntityList::iterator e = mLodEntityList.begin();
e != mLodEntityList.end(); ++e, ++lodi)
{
uint nsub = (*e)->getNumSubEntities();
for (uint s = 0; s < nsub; ++s)
{
- visitor->visit((*e)->getSubEntity(s), lodi, false);
+ if ((*e)->getSubEntity(s)->isVisible())
+ visitor->visit((*e)->getSubEntity(s), lodi, false);
}
}
}
then i've modified OgreSceneManager.cpp, validateRenderableForRendering:
Code: Select all
bool SceneManager::validateRenderableForRendering(const Pass* pass, const Renderable* rend)
{
// Skip this renderable if we're doing modulative texture shadows, it casts shadows
// and we're doing the render receivers pass and we're not self-shadowing
// also if pass number > 0
if (!mSuppressShadows && mCurrentViewport->getShadowsEnabled() &&
isShadowTechniqueTextureBased())
{
- if (mIlluminationStage == IRS_RENDER_RECEIVER_PASS &&
+ if (mIlluminationStage == IRS_RENDER_RECEIVER_PASS &&
+ !rend->getMaterial()->getReceiveShadows())
+ {
+ return false;
+ }
+ if (mIlluminationStage == IRS_RENDER_RECEIVER_PASS &&
rend->getCastsShadows() && !mShadowTextureSelfShadow)
{
return false;
}
// Some duplication here with validatePassForRendering, for transparents
if (((isShadowTechniqueModulative() && mIlluminationStage == IRS_RENDER_RECEIVER_PASS)
|| mIlluminationStage == IRS_RENDER_TO_TEXTURE || mSuppressRenderStateChanges) &&
pass->getIndex() > 0)
{
return false;
}
}
are those modifications correct? in my case the opengl frame doesn't show up anymore unnecessary draw call for not visible subentities and only shadow receiver meshes are renderer with shadows.