Enable shadow casting for terrain

Add a check to TerrainDrawable to make sure shadows are only drawn once, not once per blending pass
pull/541/head
scrawl 7 years ago
parent 8141ee47d5
commit ceaf0ee409

@ -206,7 +206,7 @@ namespace MWRender
osgShadow::ShadowSettings* settings = shadowedScene->getShadowSettings();
settings->setLightNum(0);
settings->setCastsShadowTraversalMask(Mask_Scene|Mask_Actor|Mask_Player);
settings->setCastsShadowTraversalMask(Mask_Scene|Mask_Actor|Mask_Player|Mask_Terrain);
settings->setReceivesShadowTraversalMask(~0u);
//settings->setShadowMapProjectionHint(osgShadow::ShadowSettings::PERSPECTIVE_SHADOW_MAP);

@ -51,6 +51,12 @@ void TerrainDrawable::cull(osgUtil::CullVisitor *cv)
if (osg::isNaN(depth))
return;
if (cv->getCurrentCamera()->getName() == "ShadowCamera")
{
cv->addDrawableAndDepth(this, &matrix, depth);
return;
}
bool pushedLight = mLightListCallback && mLightListCallback->pushLightState(this, cv);
for (PassVector::const_iterator it = mPasses.begin(); it != mPasses.end(); ++it)

Loading…
Cancel
Save