added LSPSM shadow technique in SDRender

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5480 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 0e5bc395d5d6f4458eec16c4b5d775ffbdd29fb1
Former-commit-id: 8b8fbfb1e5837f3d2b9f9569cc851c4632dd6f14
This commit is contained in:
torcs-ng 2013-05-26 15:19:06 +00:00
parent 7ff5ad2872
commit 09ea392b46

View file

@ -467,14 +467,34 @@ void SDRender::ShadowedScene()
osg::ref_ptr<osgShadow::ParallelSplitShadowMap> pssm =
new osgShadow::ParallelSplitShadowMap(NULL, 3);
pssm->setTextureResolution(2048);
pssm->setMinNearDistanceForSplits(0.25);
pssm->setMaxFarDistance(512.0);
pssm->setMinNearDistanceForSplits(0.25f);
pssm->setMaxFarDistance(1024.0f);
pssm->setPolygonOffset(osg::Vec2(10.0f, 20.0f));
shadowRoot = new osgShadow::ShadowedScene;
shadowRoot->setReceivesShadowTraversalMask(rcvShadowMask);
shadowRoot->setCastsShadowTraversalMask(castShadowMask);
shadowRoot->setShadowTechnique((pssm.get()));
}
else if (SHADOW_TECHNIQUE == 4)
{
osg::ref_ptr<osgShadow::LightSpacePerspectiveShadowMapCB> lspsm =
new osgShadow::LightSpacePerspectiveShadowMapCB;
unsigned int baseTexUnit = 0;
unsigned int shadowTexUnit = 1;
lspsm->setMinLightMargin(10.0f);
lspsm->setMaxFarPlane(1024.0f);
lspsm->setTextureSize(osg::Vec2s(4096, 4096));
lspsm->setShadowTextureCoordIndex(shadowTexUnit);
lspsm->setShadowTextureUnit(shadowTexUnit);
lspsm->setBaseTextureCoordIndex(baseTexUnit);
lspsm->setBaseTextureUnit(baseTexUnit);
shadowRoot = new osgShadow::ShadowedScene;
shadowRoot->setReceivesShadowTraversalMask(rcvShadowMask);
shadowRoot->setCastsShadowTraversalMask(castShadowMask);
shadowRoot->setShadowTechnique((lspsm.get()));
}
shadowRoot->addChild(m_scene.get());
shadowRoot->addChild(m_CarRoot.get());