mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
Merge pull request #2 from scrawl/shadows
Enable shadows for terrain & restore cull mask
This commit is contained in:
commit
2bfd45fb40
3 changed files with 11 additions and 6 deletions
|
@ -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);
|
||||
|
@ -268,7 +268,7 @@ namespace MWRender
|
|||
mViewer->setLightingMode(osgViewer::View::NO_LIGHT);
|
||||
|
||||
osg::ref_ptr<osg::LightSource> source = new osg::LightSource;
|
||||
//source->setNodeMask(Mask_Lighting);
|
||||
source->setNodeMask(Mask_Lighting);
|
||||
mSunLight = new osg::Light;
|
||||
source->setLight(mSunLight);
|
||||
mSunLight->setDiffuse(osg::Vec4f(0,0,0,1));
|
||||
|
@ -315,8 +315,7 @@ namespace MWRender
|
|||
mViewer->getCamera()->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
|
||||
mViewer->getCamera()->setCullingMode(cullingMode);
|
||||
|
||||
//mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor|Mask_SimpleWater));
|
||||
mViewer->getCamera()->setCullMask(~(Mask_Lighting));
|
||||
mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor|Mask_SimpleWater));
|
||||
|
||||
mNearClip = Settings::Manager::getFloat("near clip", "Camera");
|
||||
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace MWRender
|
|||
"void main(void) \n"
|
||||
"{ \n"
|
||||
#if 1
|
||||
" float f = texture2D( texture, gl_TexCoord[0] ).r; \n"
|
||||
" float f = texture2D( texture, gl_TexCoord[0].xy ).r; \n"
|
||||
" \n"
|
||||
" f = 256.0 * f; \n"
|
||||
" float fC = floor( f ) / 256.0; \n"
|
||||
|
@ -45,7 +45,7 @@ namespace MWRender
|
|||
" \n"
|
||||
" gl_FragColor = vec4( fS + fH * color, 1 ); \n"
|
||||
#else
|
||||
" gl_FragColor = texture2D(texture, gl_TexCoord[0]); \n"
|
||||
" gl_FragColor = texture2D(texture, gl_TexCoord[0].xy); \n"
|
||||
" //gl_FragColor = vec4(1.0, 0.5, 0.5, 1.0); \n"
|
||||
#endif
|
||||
"} \n";
|
||||
|
|
|
@ -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…
Reference in a new issue