Hi Wang
I integrated your latest submission in my current project. Since I didn't want
to patch my osg 3.1.5, I used your code side by side and changed the namespace
to prevent clashes.
The shadow runs smooth and fast. But I noticed that although there is support
for parrallel split, the SplitterZ uniform is not evaluated in the fragment
shader.
Somehow I still didn't find the code that handles deleting of the
ShadowMapData...
I give you an extract of my code:
HPP:
Code:
class EfxViewDependentShadow : public osgShadowDev::ViewDependentShadowMap,
public osg::Observer
CPP
Code:
// ---------------------------------------------------------------
// returns viewdependent data
// ---------------------------------------------------------------
osgShadowDev::ViewDependentShadowMap::ViewDependentData*
EfxViewDependentShadow::createViewDependentData(osgUtil::CullVisitor* a_cv)
{
osg::Camera* l_Camera = a_cv->getCurrentCamera();
if (l_Camera)
{
m_ViewMap[a_cv] = l_Camera;
l_Camera->addObserver(this);
}
return ViewDependentShadowMap::createViewDependentData(a_cv);
}
// ---------------------------------------------------------------
// observer callback method
// ---------------------------------------------------------------
void EfxViewDependentShadow::objectDeleted(void* a_ptr)
{
const osg::Camera* l_Camera = reinterpret_cast<const osg::Camera*>(a_ptr);
ViewMapType::iterator itr = m_ViewMap.begin();
while (itr != m_ViewMap.end())
{
osg::Camera* camera = itr->second;
osgUtil::CullVisitor* cv = itr->first;
if (camera == l_Camera)
{
OpenThreads::ScopedLock<OpenThreads::Mutex>
lock(_viewDependentDataMapMutex);
ViewDependentDataMap::iterator itrVD = _viewDependentDataMap.find(cv);
if (itrVD != _viewDependentDataMap.end())
{
_viewDependentDataMap.erase(itrVD);
M_INFO("ViewDependentData has been Deleted from Map");
}
m_ViewMap.erase(itr);
itr = m_ViewMap.begin();
continue;
}
itr++;
}
}
Cheers
Daniel
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53183#53183
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org